AutomationDataset/gbtunney/gbtunney_automations.yaml

796 lines
23 KiB
YAML

- id: '1736734609929'
alias: Alert Acknowledge Push Notification
description: ''
triggers:
- event_type: mobile_app_notification_action
trigger: event
event_data: {}
conditions:
- condition: template
value_template: '{{ trigger.event.data.action is defined and trigger.event.data.action
in action_mapping }}'
actions:
- variables:
resolved:
alert: '{{ action_mapping[trigger.event.data.action].alert }}'
controlling_binary_sensor: '{{ action_mapping[trigger.event.data.action].controlling_binary_sensor}}'
controlling_timer: '{{ action_mapping[trigger.event.data.action].controlling_timer}}'
controlling_sensor_state: '{{ bool( is_state(resolved.controlling_binary_sensor
,[''on''] ) )}}'
controlling_timer_state: '{{ states( resolved.controlling_timer) }}'
error: '{{ bool( is_state(resolved.controlling_binary_sensor ,[''unavailable'',''unknown'']
),false ) or bool( is_state(resolved.controlling_timer,[''unavailable'',''unknown'']
),false )}}'
- if:
- condition: template
value_template: '{{bool( is_state( resolved.controlling_binary_sensor ,[''on'']),false
)}}'
then:
- action: timer.pause
metadata: {}
data: {}
target:
entity_id: '{{resolved.controlling_timer}}'
- action: logbook.log
data:
name: ALERT REPLACEMENT ACKNOWLEDGE
message: 'Pausing Timer: Alert has been acknowledged. Controlling sensor {{resolved.controlling_binary_sensor}}
({{controlling_sensor_state|upper}}) | Timer
{{resolved.controlling_timer }}
({{controlling_timer_state|upper}})
'
entity_id: '{{ resolved.controlling_binary_sensor }}'
enabled: true
else:
- action: timer.cancel
metadata: {}
data: {}
target:
entity_id: '{{resolved.controlling_timer}}'
- action: logbook.log
data:
name: ALERT REPLACEMENT ACKNOWLEDGE
message: 'Canceling Timer: Alert has been canceled via acknowledge script
| Controller
{{resolved.controlling_binary_sensor}}
({{controlling_sensor_state|upper}}) | Timer
{{resolved.controlling_timer }}
({{controlling_timer_state|upper}})
'
entity_id: '{{ resolved.controlling_binary_sensor }}'
enabled: true
mode: single
variables:
action_mapping:
ACK_WARN_TUYA_DISCONNECT:
alert: alert.warn_irregular_off
controlling_timer: timer.timer_warn_tuya_disconnect
controlling_binary_sensor: binary_sensor.alert_state_warning_tuya_disconnect
ACK_WARN_IRREGULAR_OFF:
alert: alert.warn_irregular_off
controlling_timer: timer.notification_warn_irregular_off
controlling_binary_sensor: binary_sensor.alert_state_warn_irregular_off
- id: '1733720729443'
alias: Aquarium Lighting Scheduled On/Off
description: Aquarium Lighting turned On/Off according to a schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.aquarium_lighting_schedule
attribute: next_update
enabled: true
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
enabled: true
actions:
- action: script.set_state_switch_light
data:
bool_invert_state: 'Off'
select_state: Unknown
target_entity_set:
entity_id: light.aquarium_lighting
entity_trigger:
entity_id: '{{trigger.entity_id}}'
mode: single
- id: '1733723752388'
alias: Aquarium CO2 Scheduled On/Off
description: Aquarium C02 turned On/Off according to a schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.aquarium_co2_schedule
attribute: next_update
enabled: true
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
enabled: true
actions:
- action: script.set_state_switch_light
data:
bool_invert_state: 'Off'
select_state: Unknown
target_entity_set:
entity_id: switch.20g_rack_co2
entity_trigger:
entity_id: '{{trigger.entity_id}}'
mode: single
- id: '1730622599095'
alias: Leak Alert (Unlocated)
description: 'todo: fix'
triggers:
- trigger: state
entity_id:
- binary_sensor.leak_sensor_group
from: 'off'
to: 'on'
for:
hours: 0
minutes: 0
seconds: 30
conditions: []
actions:
- variables:
message: '{% from ''notifications.jinja'' import leak_detector_notification
%} {{ leak_detector_notification(trigger.entity_id) }}'
- action: logbook.log
metadata: {}
data:
name: leak test problem
message: '{{message}}'
entity_id: '{{ trigger.entity_id }}'
- action: script.notification_dispatcher
metadata: {}
data:
notification_channel:
- iPhone
- persistant
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
message: 'Device {{ state_attr(trigger.entity_id,''friendly_name'' ) }} in
Area: {{ area_name(trigger.entity_id) }} is detecting moisture. Please fix
immediately!!'
enabled: false
mode: single
- id: '1733535410225'
alias: Temperature Alert
description: Alerts if temperature is below 65 or above 85
triggers:
- trigger: numeric_state
entity_id:
- input_number.dummy_thermometer
- sensor.reptile_room_hygrometer_temperature
below: 65
- trigger: numeric_state
entity_id:
- input_number.dummy_thermometer
- sensor.reptile_room_hygrometer_temperature
above: 85
conditions: []
actions:
- action: script.notification_dispatcher
metadata: {}
data:
message: '"{% set entity = trigger.entity_id %}ALERT! {% if trigger.above ==
none %}Low {% else %}High {% endif %} temperature! Device: {{ trigger.to_state.name
}} is registering temp of {{ trigger.to_state.state }}F in Area: {{ area_name(trigger.entity_id)
}} :: Please fix!!"
'
notification_channel:
- iPhone
- iPad
- macBook
- persistant
- alexa
- sms
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
mode: single
- id: '1733554565177'
alias: Motion Capture
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.ffmpeg_motion_detection_camera_1
for:
hours: 0
minutes: 0
seconds: 30
to: null
conditions: []
actions:
- if:
- condition: state
entity_id: binary_sensor.ffmpeg_motion_detection_camera_1
state: 'on'
for:
hours: 0
minutes: 0
seconds: 30
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 44
- 114
- 39
target:
entity_id: light.led_strip_color
- action: script.notification_dispatcher
metadata: {}
data:
notification_channel:
- iPhone
- persistant
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
message: Motion detected - green
- action: script.notification_dispatcher
metadata: {}
data:
notification_channel:
- iPhone
- persistant
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
message: Motion detected
enabled: false
else:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 246
- 26
- 25
target:
entity_id: light.led_strip_color
- action: script.notification_dispatcher
metadata: {}
data:
notification_channel:
- iPhone
- persistant
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
message: Motion NOT DETECTED BACM TO RED
mode: single
- id: '1733563292567'
alias: Device Unavailable
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.aq_and_rept_connectivity_status_group
for:
hours: 0
minutes: 6
seconds: 0
to:
- 'off'
- unknown
- unavailable
conditions:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_home
actions:
- variables:
message: '{% from ''notifications.jinja'' import device_unavailable_notification
%} {{ device_unavailable_notification(trigger.entity_id) }}'
message_bk: "Device {{ state_attr(trigger.entity_id,'friendly_name' ) }} in\
\ Area: {{\n area_name(trigger.entity_id) }} is disconnected. Please fix immediately!!"
- action: script.notification_dispatcher
metadata: {}
data:
notification_channel:
- iPhone
- iPad
- macBook
- persistant
- alexa
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
message: '{{message}}'
- choose:
- conditions: []
sequence: []
enabled: false
mode: single
- id: '1733605050618'
alias: Lighting & Powerstrip Connectivity Warning
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.hallway_light_status
- binary_sensor.living_room_light_status
- binary_sensor.bedroom_light_status
- binary_sensor.seafoam_light_status
- binary_sensor.dorn_lighting_status
- binary_sensor.10g_m_powerstrip_status
- binary_sensor.120g_powerstrip_status
- binary_sensor.20g_powerstrip_status
- binary_sensor.55g_powerstrip_status
to: 'off'
for:
hours: 0
minutes: 5
seconds: 0
conditions:
- condition: state
entity_id: alarm_control_panel.home_alarm
state: armed_home
actions:
- action: script.notification_dispatcher
metadata: {}
data:
message: 'Device: {{ device_attr(trigger.entity_id, ''name'') }} in Area: {{
area_name(trigger.entity_id) }} is disconnected. Please fix immediately!!'
notification_channel:
- iPhone
- iPad
- macBook
- persistant
- alexa
- sms
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
mode: single
- id: '1733711998590'
alias: Reptile Room Motion Light
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.ffmpeg_motion_detection_camera_2
from: 'off'
to: 'on'
conditions: []
actions:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 129
- 255
- 26
target:
entity_id: light.led_strip_color
- action: notify.mobile_app_iphone
metadata: {}
data:
message: motion was detected
mode: single
- id: '1733724698026'
alias: iTag Light Color Test
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.itag_tracking_hub_itag_1_button
- binary_sensor.itag_tracking_hub_itag_1_button_doubleclick
- binary_sensor.itag_tracking_hub_itag_2_button
- binary_sensor.itag_tracking_hub_itag_2_button_doubleclick
from: 'on'
to: 'off'
conditions: []
actions:
- if:
- condition: template
value_template: '{% if trigger.entity_id == ''binary_sensor.itag_tracking_hub_itag_1_button''
%}true{%else%}false{%endif%}'
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 1
- 208
- 80
target:
entity_id: light.smart_bulb_1
- if:
- condition: template
value_template: '{% if trigger.entity_id == ''binary_sensor.itag_tracking_hub_itag_1_button_doubleclick''
%}true{%else%}false{%endif%}'
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 36
- 80
- 255
target:
entity_id: light.smart_bulb_1
- if:
- condition: template
value_template: '{% if trigger.entity_id == ''binary_sensor.itag_tracking_hub_itag_2_button''
%}true{%else%}false{%endif%}'
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 251
- 0
- 255
target:
entity_id: light.smart_bulb_1
- if:
- condition: template
value_template: '{% if trigger.entity_id ==''binary_sensor.itag_tracking_hub_itag_2_button_doubleclick''
%}true{%else%}false{%endif%}'
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 255
- 0
- 89
target:
entity_id: light.smart_bulb_1
mode: single
- id: '1735089085485'
alias: 'Sensor: Home Assistant Last Started'
description: ''
triggers:
- trigger: homeassistant
event: start
conditions: []
actions:
- action: input_datetime.set_datetime
metadata: {}
data:
timestamp: '{{float(as_timestamp(now()),0)}}'
target:
entity_id: input_datetime.ha_last_start
mode: single
- id: '1744261059099'
alias: Reptile Lighting Schedule UI
description: Uses Time of day sensor now
triggers:
- trigger: state
entity_id:
- binary_sensor.reptile_lighting_schedule
enabled: true
attribute: next_update
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
actions:
- variables:
list_lights:
- light.dorn_and_marceline_lighting
- light.seafoam_styx_lighting_switch_1
list_status:
- binary_sensor.dorn_lighting_status
- binary_sensor.seafoam_light_status
- repeat:
sequence:
- if:
- condition: template
value_template: '{{ is_state( repeat.item ,[''on'',''off'']) }} '
enabled: true
then:
- alias: if disconnected,
if:
- condition: template
value_template: '{{ bool( is_state( repeat.item ,''off'' ) ,false ) }}'
then:
- variables:
message: Reptile Schedule Error! {{ state_attr( repeat.item,'friendly_name'
) }} is disconnected. Cannot turn device to {{ trigger.to_state.state
}}
- action: logbook.log
metadata: {}
data:
name: Reptile Schedule Error!
message: '{{message}}||||'
entity_id: automation.reptile_lighting_schedule_ui
- action: script.custom_alexa_notification
metadata: {}
data:
target_alexa_speaker:
entity_id: media_player.alexa_s_baby
message: '{{message}}'
volume: Normal Volume
sound: christmas_05
else:
- if:
- condition: template
value_template: '{{ is_state( list_lights[(repeat.index - 1) | int ]
, [''on'',''off'']) }}'
then:
- variables:
message: Reptile lights schedule executed, setting {{ state_attr(
list_lights[(repeat.index - 1) | int ],'friendly_name' ) }} to
{{ trigger.to_state.state }}
- action: logbook.log
metadata: {}
data:
name: Reptile Schedule Executed
message: '{{message}}|||'
entity_id: automation.reptile_lighting_schedule_ui
enabled: false
- action: script.custom_alexa_notification
metadata: {}
data:
target_alexa_speaker:
entity_id: media_player.alexa_s_baby
message: '{{message}}'
volume: Normal Volume
sound: christmas_05
enabled: false
- action: script.set_state_switch_light
data:
bool_invert_state: 'Off'
select_state: Unknown
target_entity_set:
entity_id: '{{list_lights[(repeat.index - 1) | int ]}}'
entity_trigger:
entity_id: '{{trigger.entity_id}}'
enabled: true
else:
- action: logbook.log
metadata: {}
data:
name: Reptile Schedule Error!
message: Problem with reptile lights schedule, {{ state_attr(list_lights[(repeat.index
- 1) | int ], 'friendly_name') }} is unavailable, Cannot turn device
to {{ trigger.to_state.state }}
entity_id: automation.reptile_lighting_schedule_ui
for_each: '{{ list_status | list }}'
mode: single
- id: '1744768566586'
alias: Staging LED Strip Motion Detect
description: ''
triggers:
- trigger: state
entity_id:
- binary_sensor.motion_sensor_29_motion
from: 'off'
to: 'on'
- trigger: state
entity_id:
- binary_sensor.motion_sensor_29_motion
from: 'on'
to: 'off'
conditions: []
actions:
- if:
- condition: template
value_template: '{{ bool( is_state(''binary_sensor.motion_sensor_29_motion'',[''on''])
,false) }}'
then:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 255
- 204
- 2
brightness_step_pct: 100
target:
entity_id: light.led_strip_color
else:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 1
- 97
- 253
brightness_step_pct: 0
target:
entity_id: light.led_strip_color
mode: single
- id: '1749869580049'
alias: Aquarium Lighting Scheduled On/Off 120
description: Aquarium Lighting turned On/Off according to a schedule
triggers:
- trigger: state
entity_id:
- binary_sensor.120g_aquarium_lighting_schedule
attribute: next_update
enabled: true
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
enabled: true
actions:
- action: script.set_state_switch_light
data:
bool_invert_state: 'Off'
select_state: Unknown
entity_trigger:
entity_id: '{{trigger.entity_id}}'
target_entity_set:
entity_id:
- light.120g_aquarium_light
- switch.120g_aquarium_pump
mode: single
- id: '1733562107777'
alias: Cat Fountain Problem Notification
description: "Detects and notifies based on problems with: \n- Tank Disconnected\
\ \n- Low Water Level.\rNOTE: This automation does NOT set any sensor values."
triggers:
- trigger: numeric_state
entity_id:
- sensor.cat_fountain_remaining_water
below: 33
for:
hours: 0
minutes: 20
seconds: 0
enabled: true
above: 0
- trigger: state
entity_id:
- binary_sensor.cat_fountain_water_tank_status
for:
hours: 0
minutes: 9
seconds: 0
to: 'off'
from: 'on'
conditions:
- condition: template
value_template: '{{ bool( states(''binary_sensor.cat_fountain_wi_fi''),false
) }}'
enabled: true
actions:
- variables:
water_level: '{{ states(''sensor.cat_fountain_remaining_water'') | int(999)
}}'
critical_threshold_upper: 30
critical: "{%- if water_level | int(0) <= critical_threshold_upper | int(0)\
\ %}\n ON\n{%- else %}\n OFF\n{%- endif %}\n"
message: 'Cat water is {% if critical == "ON" %}extremely low{% endif %} at
{{ water_level }}% in Area: {{ area_name(trigger.entity_id) }} :: Please fill
immediately!!'
- if:
- condition: template
value_template: '{{ bool( states(''binary_sensor.cat_fountain_water_tank_status'')
,false)}}'
then:
- action: script.notification_dispatcher
metadata: {}
data:
message: '{{message}}'
notification_channel:
- iPhone
- iPad
- macBook
- persistant
- sms
- alexa
bool_critical: '{{critical}}'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
alias: Low Water Notification
else:
- action: script.notification_dispatcher
metadata: {}
data:
message: 'Cat fountain tank appears to be disconnected for more than 10 min
in Area: {{ area_name(trigger.entity_id) }}. The last recorded water remaining
was {{ states(''sensor.cat_fountain_water_volume'') | int(999) }} % :: Please
fix immediately!!'
notification_channel:
- iPhone
- iPad
- macBook
- persistant
- alexa
bool_critical: 'OFF'
sound: default
sms_targets:
- 7188138156@mms.att.net
email_targets:
- gbtunney@mac.com
alias: Cat Fountain Disconnected Notification
alias: Notification Conditional
mode: single
- id: '1734249603918'
alias: 'Sensor: Cat Fountain Tank Filled'
description: '- Determines if the tank has been filled based on if new volume is
HIGHER than last recorded. - If filled, sets a timestamp variable so there is
a ''days since last fill'' counter.'
triggers:
- trigger: numeric_state
entity_id:
- sensor.cat_fountain_remaining_water
value_template: '{{ bool( (( states( trigger.entity_id ) | int(999) - states(''sensor.cat_fountain_water_volume'') |
int(999) ) > 20 ) ) }} '
above: 0
below: 100
conditions:
- condition: template
value_template: '{{ bool( states(''binary_sensor.cat_fountain_water_tank_status''),false
)and bool( states(''binary_sensor.cat_fountain_wi_fi''),false ) }}'
actions:
- action: logbook.log
metadata: {}
data:
name: Cat Fountain Tank Filled!
message: The cat fountain was just filled and is currently at {{ states( trigger.entity_id
) }}%. It was previously filled {{ states('sensor.cat_fountain_days_since_last_fill')}}
days ago.
entity_id: sensor.cat_fountain_days_since_last_fill
- action: input_datetime.set_datetime
metadata: {}
data:
timestamp: '{{float(as_timestamp(now()),0)}}'
target:
entity_id: input_datetime.cat_fountain_tank_last_filled_date
mode: single
- id: '1733608231107'
alias: Reptile Lighting Schedule
description: Uses Time of day sensor now
triggers:
- trigger: state
entity_id:
- binary_sensor.reptile_lighting_schedule
enabled: true
attribute: next_update
conditions:
- condition: template
value_template: '{{ trigger.to_state.state in [''on'', ''off''] }}'
actions:
- action: script.set_state_switch_light
data:
bool_invert_state: 'Off'
select_state: Unknown
target_entity_set:
entity_id: light.reptile_lights
entity_trigger:
entity_id: '{{trigger.entity_id}}'
mode: single