Refactor automation scripts to log significant events to the Activity feed using script.send_to_logbook. This includes updates to high wind speed notifications, bad login attempts, trigger dumps, startup notifications, and various other automations across multiple packages, enhancing visibility and tracking of system activities.

This commit is contained in:
Carlo Costanzo
2025-12-12 16:38:24 -05:00
parent 8ec5173f4d
commit c365a1c233
33 changed files with 348 additions and 352 deletions

View File

@@ -1,43 +0,0 @@
You can use this code to quickly create files from the template editor in HA. I use it mainly for `emulated_hue` and to quickly add in new Customize options to all things HA!
For the sandbox.
{% set trigger = {'entity_id':'sensor.downstairs_thermostat_hvac_state','to_state':'cooling'} %}
#########################################################
Create fast Customize for groups, sensors, covers etc... Just change that first line below 'sensor' to 'group', 'covers' etc..
{% for state in states.group -%}
{% if loop.first %}
{% elif loop.last %}
{% else %}
{% endif %}
{{- state.entity_id }}:
friendly_name: '{{ state.attributes.friendly_name|replace("_"," ",)|title() if state.attributes.friendly_name is defined else state.name|replace("_"," ",)|title() }}'
hidden: {{state.attributes.hidden if state.attributes.hidden is defined else "False"}}
homebridge_hidden: {{state.attributes.homebridge_hidden if state.attributes.homebridge_hidden is defined else "true"}}
{{'icon: '+ state.attributes.icon if state.attributes.icon is defined}}
{{'homebridge_cover_type: '+ state.attributes.homebridge_cover_type if state.attributes.homebridge_cover_type is defined}}
{{'assumed_state: '+ state.attributes.assumed_state if state.attributes.assumed_state is defined}}
{% endfor -%}
#########################################################
#This code lists out EVERY possible entity and attribute for that entity.
# source: https://github.com/skalavala/smarthome/blob/primary/Entities.md
#########################################################
{{ "_".ljust(90, "_") }}
{%- set domains = [states.light, states.switch, states.automation, states.device_tracker, states.group, states.media_player, states.proximity, states.script, states.zone, states.zwave, states.sensor, states.calendar ] %}
{{ "Entity ID".ljust(50) }}{{ "Entity Name" }}
{%- for domain in domains -%}
{% for item in domain %}
{{ "_".ljust(90, "_") }}
{{ item.entity_id.ljust(50) }}{{ item.name }}
{% for attrib in item.attributes %}
{%- if attrib is defined %}
{{attrib.ljust(50)}}: {{ item.attributes[attrib] }}
{%- endif %}
{%- endfor %}
{%- endfor %}
{%- endfor %}
#########################################################

View File

@@ -1,12 +0,0 @@
#!/bin/bash
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd /home/hass/docker_files/homeassistant
git pull origin master
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd ~
exit

View File

@@ -1,16 +0,0 @@
#!/bin/bash
cd /home/hass/docker_files
docker-compose exec home-assistant python -m homeassistant --config /config --script check_config
cd /home/hass/docker_files/homeassistant
git add .
git status
echo -n "Enter the Description for the Change: [Minor Edit] "
read CHANGE_MSG
CHANGE_MSG=${CHANGE_MSG:-Minor Edit}
git commit -m "${CHANGE_MSG}"
git push origin master
cd ~
exit

View File

@@ -1,17 +0,0 @@
## These scripts are run from /home/pi
#!/bin/bash
cat hassuser
sudo su -s /bin/bash hass
# source /srv/hass/hass_venv/bin/activate
# to Upgrade:
# pip3 install --upgrade homeassistant - Use HAUpdate.sh script
# To view The HA logs realtime
# sudo journalctl -u home-assistant -f | ccze

View File

@@ -1,6 +0,0 @@
# Restart Homebridge on HASS start
# shell_command:
# restart_homebridge: 'sudo su pi -c "pm2 restart homebridge"'
# start_homebridge: 'sudo su pi -c "pm2 start homebridge"'
# stop_homebridge: 'sudo su pi -c "pm2 stop homebridge"'

View File

@@ -1,23 +0,0 @@
#!/bin/sh
# this script uses hard-coded paths
# This deletes the readme file and begins rebuilding it..
cat /home/hass/.homeassistant/script/header.md > /home/hass/.homeassistant/script/README.md
grep -e '^[a-z]' /home/hass/.homeassistant/script/*.yaml | tr : '\n' > /tmp/scriptnames.txt
sed -i '/^$/d' /tmp/scriptnames.txt
for item in `cat /tmp/scriptnames.txt`
do
res=`grep -R script.$item /home/hass/.homeassistant/. --include=*.yaml`
echo "\n $item \n" | sed 's|/home/hass/\.homeassistant/| https://github\.com/CCOSTAN/Home-AssistantConfig/blob/master/|g'>> /home/hass/.homeassistant/script/README.md
echo "\n $res \n" | sed 's|/home/hass/\.homeassistant/\.| https://github\.com/CCOSTAN/Home-AssistantConfig/blob/master|g' >> /home/hass/.homeassistant/script/README.md
sed -i '/^$/d' /home/hass/.homeassistant/script/README.md
done
cat /home/hass/.homeassistant/script/README.md