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.
parent
8ec5173f4d
commit
c365a1c233
@ -0,0 +1,18 @@
|
||||
######################################################################
|
||||
# @CCOSTAN - Follow Me on X
|
||||
# For more info visit https://www.vcloudinfo.com/click-here
|
||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||
# -------------------------------------------------------------------
|
||||
# Logbook Activity Feed - Dummy entity for Activity pseudo-filtering
|
||||
# Related Issue: 1550
|
||||
# Provides `sensor.activity_feed` as a stable entity_id for `logbook.log`.
|
||||
# -------------------------------------------------------------------
|
||||
######################################################################
|
||||
|
||||
template:
|
||||
- sensor:
|
||||
- name: Activity Feed
|
||||
unique_id: activity_feed
|
||||
icon: mdi:clipboard-text
|
||||
state: "ready"
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
#-------------------------------------------
|
||||
# @CCOSTAN
|
||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||
# More information : https://github.com/SmilyOrg/screenmqtt
|
||||
#-------------------------------------------
|
||||
homeassistant:
|
||||
customize:
|
||||
switch.computer_screens:
|
||||
friendly_name: 'Computer Screens'
|
||||
icon: mdi:monitor-multiple
|
||||
emulated_hue_
|
||||
|
||||
#-------------------------------------------
|
||||
button:
|
||||
- platform: mqtt
|
||||
name: computer_screens
|
||||
state_topic: 'carlo-ultra/monitor/all/power/state'
|
||||
command_topic: 'carlo-ultra/monitor/all/power/command'
|
||||
|
||||
#-------------------------------------------
|
||||
#group - Added to group.interior_switches
|
||||
@ -0,0 +1,32 @@
|
||||
######################################################################
|
||||
# @CCOSTAN - Follow Me on X
|
||||
# For more info visit https://www.vcloudinfo.com/click-here
|
||||
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
||||
# -------------------------------------------------------------------
|
||||
# Send To Logbook - Generic helper for Activity/logbook entries
|
||||
# Related Issue: 1550
|
||||
# Calls `logbook.log` using `sensor.activity_feed` as the entity_id.
|
||||
# -------------------------------------------------------------------
|
||||
######################################################################
|
||||
|
||||
send_to_logbook:
|
||||
alias: Send To Logbook
|
||||
mode: queued
|
||||
fields:
|
||||
topic:
|
||||
description: Logbook entry name (headline)
|
||||
example: "n8n"
|
||||
message:
|
||||
description: Logbook entry message
|
||||
example: "Webhook received and workflow started."
|
||||
sequence:
|
||||
- condition: template
|
||||
value_template: >-
|
||||
{{ topic is defined and (topic | string | trim) != '' and
|
||||
message is defined and (message | string | trim) != '' }}
|
||||
- service: logbook.log
|
||||
data:
|
||||
name: "{{ topic | string | trim }}"
|
||||
message: "{{ message | string | trim }}"
|
||||
entity_id: sensor.activity_feed
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
|
||||
<h1 align="center">
|
||||
<a name="logo" href="https://www.vCloudInfo.com/tag/iot"><img src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/x_profile.png" alt="Bear Stone Smart Home" width="200"></a>
|
||||
<br>
|
||||
Bear Stone Smart Home Documentation
|
||||
</h1>
|
||||
<h4 align="center">Be sure to :star: my configuration repo so you can keep up to date on any daily progress!</h4>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://x.com/ccostan)
|
||||
[](https://www.youtube.com/vCloudInfo?sub_confirmation=1)
|
||||
[](https://github.com/CCOSTAN) <br>
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/.HA_VERSION)
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/commits/master)
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/commits/master)
|
||||
|
||||
</div>
|
||||
|
||||
Shell commands Home Assistant can call for maintenance or integrations that need a CLI nudge.
|
||||
|
||||
### Quick navigation
|
||||
- [Repo overview](../../README.md) | [Config index](../README.md) | [Shell scripts](../shell_scripts)
|
||||
|
||||

|
||||
|
||||
### Featured files to browse
|
||||
| File | Why it matters |
|
||||
| --- | --- |
|
||||
| [flush_pm2_logs.yaml](flush_pm2_logs.yaml) | Quick cleanup for PM2 log files. |
|
||||
| [restart_homebridge.yaml](restart_homebridge.yaml) | One-shot command to restart Homebridge. |
|
||||
|
||||
### Tips
|
||||
- Keep commands idempotent and fast; HA will run them synchronously.
|
||||
- Store long scripts in `shell_scripts/` and trigger them from here.
|
||||
|
||||
|
||||
**All of my configuration files are tested against the most stable version of home-assistant.**
|
||||
|
||||
<a name="bottom" href="https://github.com/CCOSTAN/Home-AssistantConfig#logo"><img align="right" border="0" src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/www/custom_ui/floorplan/images/branding/up_arrow.png" width="25" ></a>
|
||||
|
||||
**Still have questions on my Config?** <br>
|
||||
**Message me on X :** [](https://www.x.com/ccostan)
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://www.buymeacoffee.com/vCloudInfo"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"><span style="margin-left:5px">You can buy me a coffee</span></a><a target="_blank" href="https://www.buymeacoffee.com/vCloudInfo"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"></a>
|
||||
<br>
|
||||
<a href="https://eepurl.com/dmXFYz"><img align="center" border="0" src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/www/custom_ui/floorplan/images/branding/email_link.png" height="50" ></a><br>
|
||||
<a href="https://www.vCloudInfo.com/p/affiliate-disclosure.html">
|
||||
Affiliate Disclosure
|
||||
</a></p>
|
||||
@ -1,2 +0,0 @@
|
||||
flush_pm2_logs: >-
|
||||
sudo -u pi -H /usr/bin/pm2 flush
|
||||
@ -1,2 +0,0 @@
|
||||
restart_homebridge: >-
|
||||
sudo -u pi -H /usr/bin/pm2 restart homebridge
|
||||
@ -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 %}
|
||||
|
||||
#########################################################
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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"'
|
||||
|
||||
@ -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
|
||||
@ -1,44 +0,0 @@
|
||||
|
||||
<h1 align="center">
|
||||
<a name="logo" href="https://www.vCloudInfo.com/tag/iot"><img src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/x_profile.png" alt="Bear Stone Smart Home" width="200"></a>
|
||||
<br>
|
||||
Bear Stone Smart Home Documentation
|
||||
</h1>
|
||||
<h4 align="center">Be sure to :star: my configuration repo so you can keep up to date on any daily progress!</h4>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://x.com/ccostan)
|
||||
[](https://www.youtube.com/vCloudInfo?sub_confirmation=1)
|
||||
[](https://github.com/CCOSTAN) <br>
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/.HA_VERSION)
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/commits/master)
|
||||
[](https://github.com/CCOSTAN/Home-AssistantConfig/commits/master)
|
||||
|
||||
</div>
|
||||
|
||||
Standalone switch definitions pulled into automations and dashboards. Keep relays, templates, and rest commands tidy here.
|
||||
|
||||
### Quick navigation
|
||||
- [Repo overview](../../README.md) | [Config index](../README.md) | [Automations](../automation)
|
||||
|
||||

|
||||
|
||||
### Tips
|
||||
- Add new switches here and reference them from packages/automations to stay organized.
|
||||
|
||||
|
||||
**All of my configuration files are tested against the most stable version of home-assistant.**
|
||||
|
||||
<a name="bottom" href="https://github.com/CCOSTAN/Home-AssistantConfig#logo"><img align="right" border="0" src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/www/custom_ui/floorplan/images/branding/up_arrow.png" width="25" ></a>
|
||||
|
||||
**Still have questions on my Config?** <br>
|
||||
**Message me on X :** [](https://www.x.com/ccostan)
|
||||
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://www.buymeacoffee.com/vCloudInfo"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"><span style="margin-left:5px">You can buy me a coffee</span></a><a target="_blank" href="https://www.buymeacoffee.com/vCloudInfo"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"></a>
|
||||
<br>
|
||||
<a href="https://eepurl.com/dmXFYz"><img align="center" border="0" src="https://raw.githubusercontent.com/CCOSTAN/Home-AssistantConfig/master/config/www/custom_ui/floorplan/images/branding/email_link.png" height="50" ></a><br>
|
||||
<a href="https://www.vCloudInfo.com/p/affiliate-disclosure.html">
|
||||
Affiliate Disclosure
|
||||
</a></p>
|
||||
Loading…
Reference in new issue