Skip to content

Commit

Permalink
stfu home-assistant.log
Browse files Browse the repository at this point in the history
  • Loading branch information
matt8707 committed Nov 8, 2021
1 parent 37f039a commit d265366
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 56 deletions.
4 changes: 2 additions & 2 deletions include/sensor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ sensor:
command: !secret imac_cpu
unit_of_measurement: '%'
value_template: >
{{ (100 - value[:-1] | float) | round(1) }}
{{ (100 - value[:-1] | float(default=0)) | round(1) }}
scan_interval: 86400

- platform: command_line
Expand All @@ -255,7 +255,7 @@ sensor:
name: imac_uptime
command: !secret imac_uptime
value_template: >
{{ value[:-1] | int | timestamp_custom('%Y-%m-%dT%H:%M:%S') }}
{{ value[:-1] | int(default=0) | timestamp_custom('%Y-%m-%dT%H:%M:%S') }}
scan_interval: 86400

- platform: command_line
Expand Down
48 changes: 27 additions & 21 deletions include/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ template:
select:
- name: vacuum_speed
state: >
{{ state_attr('vacuum.morty', 'fan_speed') | default }}
{% set fan_speed = state_attr('vacuum.morty', 'fan_speed') %}
{{ 'Standard' if fan_speed == None else fan_speed }}
options: >
{{ state_attr('vacuum.morty', 'fan_speed_list') | default }}
{% set fan_speed_list = state_attr('vacuum.morty', 'fan_speed_list') %}
{{ ['Standard'] if fan_speed_list == None else fan_speed_list }}
select_option:
service: vacuum.set_fan_speed
target:
Expand All @@ -15,9 +17,11 @@ template:
- name: hdmi_bravia
state: >
{{ state_attr('media_player.sony_bravia_tv', 'source') | default }}
{% set source = state_attr('media_player.sony_bravia_tv', 'source') %}
{{ 'HDMI' if source == None else source }}
options: >
{{ state_attr('media_player.sony_bravia_tv', 'source_list') | default }}
{% set source_list = state_attr('media_player.sony_bravia_tv', 'source_list') %}
{{ ['HDMI'] if source_list == None else source_list }}
select_option:
service: media_player.select_source
target:
Expand All @@ -28,9 +32,11 @@ template:
- name: hdmi_samsung
state: >
{{ state_attr('media_player.samsung_tv', 'source') | default }}
{% set source = state_attr('media_player.samsung_tv', 'source') %}
{{ 'Apple' if source == None else source }}
options: >
{{ state_attr('media_player.samsung_tv', 'source_list') | default }}
{% set source_list = state_attr('media_player.samsung_tv', 'source_list') %}
{{ ['Apple'] if source_list == None else source_list }}
select_option:
service: media_player.select_source
target:
Expand Down Expand Up @@ -186,7 +192,7 @@ template:
</b>
mailbox: |
{% set mailbox = states('sensor.mailbox') %}
{% if mailbox | int > 0 %}
{% if mailbox | int(default=0) > 0 %}
{{ '\U0001F4EC' }} <font color='#6a7377'><b>Brevlåda ({{ mailbox }})</b></font>
{% endif %}
vacuum: |
Expand All @@ -201,9 +207,9 @@ template:
{%- set apparent = states('sensor.dark_sky_apparent_temperature') | round %}
{%- set precip = states('sensor.dark_sky_precip_probability') | round %}
{% if not is_state('sensor.dark_sky_temperature', 'unknown') %}
{%- if temperature | float <= 0.0 -%}
{%- if temperature | float(default=0) <= 0.0 -%}
Känns som {{ apparent }}° med {{ precip }}% risk för snö {{'\u2744\uFE0F'}}
{%- elif temperature | float > 0.0 -%}
{%- elif temperature | float(default=0) > 0.0 -%}
Känns som {{ apparent}}° med {{ precip }}% risk för regn {{ '\u2614\uFE0F' if precip > 30 }}
{%- endif %}
{%- else %}
Expand All @@ -215,7 +221,7 @@ template:
{%- set start_time = state_attr('calendar.tvatta', 'start_time') %}
{% if start_time != None %}
{%- set time = as_timestamp(start_time) | timestamp_custom('%H:%M') %}
{%- set hours = as_timestamp(start_time) | timestamp_custom('%H') | int / 24 %}
{%- set hours = as_timestamp(start_time) | timestamp_custom('%H') | int(default=0) / 24 %}
{%- set count = (as_timestamp(start_time) - as_timestamp(now())) / 86400 - hours %}
{%- set day = strptime(start_time, '%Y-%m-%d %H:%M:%S').strftime('%A')
| replace('Monday', 'Måndag')
Expand Down Expand Up @@ -256,7 +262,7 @@ template:
{% if start_time != None %}
{%- set time = as_timestamp(start_time) | timestamp_custom('%H:%M') %}
{%- set time_end = as_timestamp(end_time) | timestamp_custom('%H:%M') %}
{%- set hours = as_timestamp(start_time) | timestamp_custom('%H') | int / 24 %}
{%- set hours = as_timestamp(start_time) | timestamp_custom('%H') | int(default=0) / 24 %}
{%- set count = (as_timestamp(start_time) - as_timestamp(now())) / 86400 - hours %}
{%- set day = strptime(start_time, '%Y-%m-%d %H:%M:%S').strftime('%A')
| replace('Monday', 'Måndag')
Expand Down Expand Up @@ -492,42 +498,42 @@ template:
icon: custom:roborock-filter
unit_of_measurement: '%'
state: >
{{ (states('sensor.morty_filter_left') | int / 5400) | int(default=0) }}
{{ (states('sensor.morty_filter_left') | int(default=0) / 5400) | int(default=0) }}
attributes:
friendly_name: Filter

- unique_id: vacuum_mainbrush
icon: custom:roborock-mainbrush
unit_of_measurement: '%'
state: >
{{ (states('sensor.morty_main_brush_left') | int / 10800) | int(default=0) }}
{{ (states('sensor.morty_main_brush_left') | int(default=0) / 10800) | int(default=0) }}
attributes:
friendly_name: Huvudborste

- unique_id: vacuum_sensors
icon: custom:roborock-sensor
unit_of_measurement: '%'
state: >
{{ (states('sensor.morty_sensor_dirty_left') | int / 1080) | int(default=0) }}
{{ (states('sensor.morty_sensor_dirty_left') | int(default=0) / 1080) | int(default=0) }}
attributes:
friendly_name: Sensorer

- unique_id: vacuum_sidebrush
icon: custom:roborock-sidebrush
unit_of_measurement: '%'
state: >
{{ (states('sensor.morty_side_brush_left') | int / 7200) | int(default=0) }}
{{ (states('sensor.morty_side_brush_left') | int(default=0) / 7200) | int(default=0) }}
attributes:
friendly_name: Sidoborste

- unique_id: fullykiosk_storage
icon: mdi:sd
unit_of_measurement: '%'
state: >
{% set FreeSpace = states('sensor.galaxy_tab_a_internal_storage_free_space') | float %}
{% set TotalSpace = states('sensor.galaxy_tab_a_internal_storage_total_space') | float %}
{% set FreeSpace = states('sensor.galaxy_tab_a_internal_storage_free_space') | float(default=0) %}
{% set TotalSpace = states('sensor.galaxy_tab_a_internal_storage_total_space') | float(default=0) %}
{% if not (FreeSpace == 0.0 or TotalSpace == 0.0) %}
{{ 100 - (FreeSpace / TotalSpace * 100) | int }}
{{ 100 - (FreeSpace / TotalSpace * 100) | int(default=0) }}
{% endif %}
attributes:
friendly_name: Lagring
Expand All @@ -536,10 +542,10 @@ template:
icon: mdi:memory
unit_of_measurement: '%'
state: >
{% set FreeMemory = states('sensor.galaxy_tab_a_ram_free_memory') | float %}
{% set TotalMemory = states('sensor.galaxy_tab_a_ram_total_memory') | float %}
{% set FreeMemory = states('sensor.galaxy_tab_a_ram_free_memory') | float(default=0) %}
{% set TotalMemory = states('sensor.galaxy_tab_a_ram_total_memory') | float(default=0) %}
{% if not (FreeMemory == 0.0 or TotalMemory == 0.0) %}
{{ 100 - (FreeMemory / TotalMemory * 100) | int }}
{{ 100 - (FreeMemory / TotalMemory * 100) | int(default=0) }}
{% endif %}
attributes:
friendly_name: Minne
Expand Down
67 changes: 34 additions & 33 deletions secrets [REDACTED].yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ udm_unifios: |-
influxdb_host: [REDACTED IP]

playstation_5_state: /config/www/ps5.py -b [REDACTED IP]
playstation_5_wake: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor wake --host-name PS5-635"'
playstation_5_sleep: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor standby --host-name PS5-635"'
playactor_version_installed: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor about"'
playstation_5_wake: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor wake --host-name PS5-635" 2>/dev/null'
playstation_5_sleep: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor standby --host-name PS5-635" 2>/dev/null'
playactor_version_installed: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'docker exec playactor sh -c "playactor about" 2>/dev/null'

switchbot_mqtt_command: homeassistant/switch/switchbot/[REDACTED MAC]/set
switchbot_mqtt_state: homeassistant/switch/switchbot/[REDACTED MAC]/state
Expand All @@ -66,38 +66,39 @@ ha_dockermon_restart_container: 'curl [REDACTED URL:PORT]/container/home-assista
wake_on_lan_mac: [REDACTED MAC]
wake_on_lan_host: [REDACTED IP]

kemper_version: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] /usr/local/bin/python3 kemper-version/kemper-version.py
kemper_version: >
ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] /usr/local/bin/python3 kemper-version/kemper-version.py || echo '{"profiler_latest": "", "profiler_installed": "", "rigmanager_latest": "", "rigmanager_installed": ""}'
waste_collection_schedule_url: https://nsr.se/wp/wp-admin/admin-ajax.php?action=fetchDataFromFetchPlannerCalendar&query=[REDACTED]

rpi_sd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df / | awk '{print $5}' | tail -n 1
rpi_mem: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] free | grep Mem | awk '{print $3 / $2 * 100}'
rpi_cpu: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] top -bn 1 | grep "Cpu(s)" | awk '{print 100 - $8}'
rpi_uptime: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] uptime -s

imac_notify_motion_hall: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "display notification \"Rörelse i hallen detekterat\" with title \"Home Assistant\""'
imac_notify_laundry: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "display notification \"Tvätten är klar\" with title \"Home Assistant\""'

imac_off: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -h now
imac_sleep: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -s now
imac_restart: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -r now
imac_ip: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] dig +short myip.opendns.com @resolver1.opendns.com

imac_system_ssd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df / | awk '{print $5}' | tail -n 1
imac_macintosh_hd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df /Volumes/Macintosh\\ HD | awk '{ print $5 }' | tail -n 1
imac_cpu: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] top -l 1 | awk '/CPU usage/ {print $7}'
imac_mem: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] ps -A -o %mem | awk '{ mem += $1} END {print mem}'
imac_uptime: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sysctl -n kern.boottime | awk '{print $4}'

monitors_mute_on: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume with output muted"'
monitors_mute_off: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume without output muted"'
monitors_mute_state: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "output muted of (get volume settings)"'
monitors_volume_slider: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume output volume {{ states('input_number.monitors_volume') | int }} --100%"'
monitors_update_volume: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "output volume of (get volume settings)"'

reference_click: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "ignoring application responses" -e "tell application \"System Events\"" -e "click menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell" -e "end ignoring"'
reference_kill: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'killall System\ Events'
reference_monitors: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "tell application \"System Events\"" -e "click menu item \"KRK Monitors\" of menu 1 of menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell"'
reference_headphones: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "tell application \"System Events\"" -e "click menu item \"Beyerdynamic DT 990 Pro\" of menu 1 of menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell"'
rpi_sd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df / | awk '{print $5}' | tail -n 1 2>/dev/null
rpi_mem: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] free | grep Mem | awk '{print $3 / $2 * 100}' 2>/dev/null
rpi_cpu: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] top -bn 1 | grep "Cpu(s)" | awk '{print 100 - $8}' 2>/dev/null
rpi_uptime: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] uptime -s 2>/dev/null

imac_notify_motion_hall: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "display notification \"Rörelse i hallen detekterat\" with title \"Home Assistant\"" 2>/dev/null'
imac_notify_laundry: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "display notification \"Tvätten är klar\" with title \"Home Assistant\"" 2>/dev/null'

imac_off: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -h now 2>/dev/null
imac_sleep: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -s now 2>/dev/null
imac_restart: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -r now 2>/dev/null
imac_ip: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] dig +short myip.opendns.com @resolver1.opendns.com || echo 0

imac_system_ssd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df / | awk '{print $5}' | tail -n 1 2>/dev/null
imac_macintosh_hd: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df /Volumes/Macintosh\\ HD | awk '{ print $5 }' | tail -n 1 2>/dev/null
imac_cpu: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] top -l 1 | awk '/CPU usage/ {print $7}' 2>/dev/null
imac_mem: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] ps -A -o %mem | awk '{ mem += $1} END {print mem}' 2>/dev/null
imac_uptime: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sysctl -n kern.boottime | awk '{print $4}' 2>/dev/null

monitors_mute_on: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume with output muted" 2>/dev/null'
monitors_mute_off: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume without output muted" 2>/dev/null'
monitors_mute_state: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "output muted of (get volume settings)"' || echo false
monitors_volume_slider: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume output volume {{ states('input_number.monitors_volume') | int }} --100%" 2>/dev/null'
monitors_update_volume: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "output volume of (get volume settings)"' || echo 0

reference_click: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "ignoring application responses" -e "tell application \"System Events\"" -e "click menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell" -e "end ignoring" 2>/dev/null'
reference_kill: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'killall System\ Events 2>/dev/null'
reference_monitors: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "tell application \"System Events\"" -e "click menu item \"KRK Monitors\" of menu 1 of menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell" 2>/dev/null'
reference_headphones: ssh -q -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "tell application \"System Events\"" -e "click menu item \"Beyerdynamic DT 990 Pro\" of menu 1 of menu bar item 1 of menu bar 2 of application process \"Reference Systemwide\"" -e "end tell" 2>/dev/null'

ir_fan_power: b64:[REDACTED IR]
ir_fan_swing: b64:[REDACTED IR]
Expand Down

0 comments on commit d265366

Please sign in to comment.