1226 lines
37 KiB
YAML
1226 lines
37 KiB
YAML
- alias: AUT-Notify home connect entity finish(Testing)
|
|
id: AUT-Notify_Home_Connect_Entity_Finish_Testing
|
|
description: 'Testing automation that logs all Home Connect events except those
|
|
that already have specific handling. This helps in discovering and debugging new
|
|
events.
|
|
|
|
'
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: home_connect_alt_event
|
|
id: input_event
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set skip_events = [\n 'Dishcare.Dishwasher.Event.RinseAidNearlyEmpty',\n\
|
|
\ 'BSH.Common.Event.ProgramFinished',\n 'BSH.Common.Status.OperationState'\n\
|
|
] %} {{ trigger.event.data.key not in skip_events }}\n"
|
|
actions:
|
|
- service: notify.manolo
|
|
data:
|
|
title: An event was triggered from home connect
|
|
message: 'Event: `{{ trigger.event }}` Event.Data: `{{ trigger.event.data }}`
|
|
|
|
'
|
|
- alias: AUT-Notify home connect entity finished
|
|
id: AUT-Notify_Home_Connect_Entity_Finished
|
|
description: Notifies when the dishwasher program has finished
|
|
initial_state: 'on'
|
|
triggers:
|
|
- domain: home_connect_alt
|
|
type: program_finished
|
|
trigger: device
|
|
device_id: secret momahome_dishwasher_device_id
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Dishwasher finished
|
|
message: 'Ey, dishwasher just finished.
|
|
|
|
'
|
|
- alias: AUT-Notify dishwasher rinse aid level
|
|
id: AUT-Notify_Dishwasher_Rinse_Aid_Level
|
|
description: Monitors and notifies about changes in the dishwasher rinse aid level
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: home_connect_alt_event
|
|
event_data:
|
|
key: Dishcare.Dishwasher.Event.RinseAidNearlyEmpty
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Dishwasher Rinse Aid Status
|
|
message: '{% if trigger.event.data.value == ''BSH.Common.EnumType.EventPresentState.Present''
|
|
%} Warning: Dishwasher rinse aid is nearly empty. Please refill soon. {% elif
|
|
trigger.event.data.value == ''BSH.Common.EnumType.EventPresentState.Off''
|
|
%} Rinse aid level is now OK. {% else %} Rinse aid status changed to: {{ trigger.event.data.value
|
|
}} {% endif %}
|
|
|
|
'
|
|
- alias: AUT-Update presence of man-005 devices
|
|
mode: parallel
|
|
max: 1000
|
|
triggers:
|
|
- platform: event
|
|
event_type: state_changed
|
|
conditions:
|
|
- alias: Filter by device
|
|
condition: template
|
|
value_template: '{{ trigger.event.data.entity_id is match (''binary_sensor.man_005'')
|
|
}}
|
|
|
|
'
|
|
actions:
|
|
- variables:
|
|
triggered_entity_id: '{{ trigger.event.data.entity_id }}'
|
|
- service: device_tracker.see
|
|
data:
|
|
dev_id: '{{ triggered_entity_id | regex_replace(''binary_sensor.'', '''')}}'
|
|
host_name: '{{ device_attr(device_id(triggered_entity_id), ''name'') }}.{{ triggered_entity_id
|
|
}}'
|
|
location_name: "{% if trigger.event.data.new_state.state == 'on' %}\n home\n\
|
|
{% elif trigger.event.data.new_state.state == 'off' %}\n not_home\n{% else\
|
|
\ %}\n unknown\n{% endif %}\n"
|
|
source_type: bluetooth_le
|
|
- alias: AUT-New Release
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.docker_hub_update_available
|
|
from: 'off'
|
|
to: 'on'
|
|
actions:
|
|
service: notify.manolo
|
|
data:
|
|
title: '*New Home Assistant Release*'
|
|
message: '[Home Assistant {{ states(''sensor.docker_hub'') }}](https://github.com/home-assistant/core/releases/tag/{{
|
|
states(''sensor.docker_hub'') }}) is now available'
|
|
- alias: AUT-Backup Home Assistant
|
|
triggers:
|
|
- platform: time
|
|
at: 05:00:00
|
|
- platform: homeassistant
|
|
event: shutdown
|
|
actions:
|
|
- alias: Create backup now
|
|
service: backup.create
|
|
- alias: AUT-Clean old backups Home Assistant
|
|
triggers:
|
|
- platform: time
|
|
at: 05:10:00
|
|
actions:
|
|
- service: shell_command.delete_old_ha_backups
|
|
- alias: AUT-NightstandButtons
|
|
id: automation_nightstand_buttons
|
|
initial_state: 'on'
|
|
trace:
|
|
stored_traces: 5
|
|
mode: queued
|
|
trigger_variables:
|
|
monica_nightstand_button_id: d207bfdca66e300274e57e4d3ff883f6
|
|
manolo_nightstand_button_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
tmp_yaml_defined_aliases:
|
|
tmp_trigger_nightstand_monica_button:
|
|
platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
tmp_trigger_nightstand_manolo_button:
|
|
platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
tmp_trigger_nightstand_pulsation_and_scene__single_press_01:
|
|
type: remote_button_short_press
|
|
subtype: button_1
|
|
variables: &id002
|
|
scene_alias: beforeSleep
|
|
scene_data:
|
|
state: 'on'
|
|
brightness: 3
|
|
color_temp: 454
|
|
tmp_trigger_nightstand_pulsation_and_scene__double_press_01:
|
|
type: remote_button_double_press
|
|
subtype: button_1
|
|
variables: &id003
|
|
scene_alias: readOnBed
|
|
scene_data:
|
|
state: 'on'
|
|
brightness: 180
|
|
color_temp: 285
|
|
tmp_trigger_nightstand_pulsation_and_scene__long_press_01:
|
|
type: remote_button_long_press
|
|
subtype: button_1
|
|
variables: &id004
|
|
scene_alias: maxIllumination
|
|
scene_data:
|
|
state: 'on'
|
|
brightness: 255
|
|
color_temp: 250
|
|
tmp_trigger_nightstand_pulsation_and_scene__single_press_02:
|
|
type: remote_button_short_press
|
|
subtype: button_2
|
|
variables: &id005
|
|
scene_alias: singleOff
|
|
scene_data:
|
|
state: 'off'
|
|
tmp_trigger_nightstand_pulsation_and_scene__double_press_02:
|
|
type: remote_button_double_press
|
|
subtype: button_2
|
|
variables: &id001
|
|
scene_alias: allOff
|
|
scene_data:
|
|
state: 'off'
|
|
tmp_trigger_nightstand_pulsation_and_scene__long_press_02:
|
|
type: remote_button_long_press
|
|
subtype: button_2
|
|
variables: *id001
|
|
triggers:
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_short_press
|
|
subtype: button_1
|
|
variables: *id002
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_double_press
|
|
subtype: button_1
|
|
variables: *id003
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_long_press
|
|
subtype: button_1
|
|
variables: *id004
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_short_press
|
|
subtype: button_2
|
|
variables: *id005
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_double_press
|
|
subtype: button_2
|
|
variables: *id001
|
|
- platform: device
|
|
domain: zha
|
|
device_id: d207bfdca66e300274e57e4d3ff883f6
|
|
type: remote_button_long_press
|
|
subtype: button_2
|
|
variables: *id001
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_short_press
|
|
subtype: button_1
|
|
variables: *id002
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_double_press
|
|
subtype: button_1
|
|
variables: *id003
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_long_press
|
|
subtype: button_1
|
|
variables: *id004
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_short_press
|
|
subtype: button_2
|
|
variables: *id005
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_double_press
|
|
subtype: button_2
|
|
variables: *id001
|
|
- platform: device
|
|
domain: zha
|
|
device_id: 66e6c2331edc3c62560fab9b8285ad85
|
|
type: remote_button_long_press
|
|
subtype: button_2
|
|
variables: *id001
|
|
actions:
|
|
- alias: Device(s) to apply the scene
|
|
variables:
|
|
entity_to_set: "{% set all_lights_on = is_state('light.monica_nightstand_light',\
|
|
\ 'on') and is_state('light.manolo_nightstand_light', 'on') %} {% set cross_device_already_on_01\
|
|
\ = (trigger.event.data.device_id == monica_nightstand_button_id) and (is_state('light.manolo_nightstand_light',\
|
|
\ 'on')) %} {% set cross_device_already_on_02 = (trigger.event.data.device_id\
|
|
\ == manolo_nightstand_button_id) and (is_state('light.monica_nightstand_light',\
|
|
\ 'on')) %} {% set cross_device_already_on = cross_device_already_on_01 or\
|
|
\ cross_device_already_on_02 %} {% set should_apply_to_all = cross_device_already_on\
|
|
\ or (scene_alias in ['allOff', 'maxIllumination']) %} {% set force_apply_to_one\
|
|
\ = (scene_alias in ['singleOff']) %} {% if (not force_apply_to_one) and (should_apply_to_all)\
|
|
\ %}\n light.bedroom_nightstand_lights\n{% elif trigger.event.data.device_id\
|
|
\ == monica_nightstand_button_id %}\n light.monica_nightstand_light\n{% elif\
|
|
\ trigger.event.data.device_id == manolo_nightstand_button_id %}\n light.manolo_nightstand_light\n\
|
|
{% endif %}"
|
|
- service: scene.apply
|
|
data:
|
|
entities:
|
|
'{{ entity_to_set }}': '{{ scene_data }}'
|
|
- alias: AUT-ManoloWorkMode
|
|
initial_state: 'on'
|
|
trace:
|
|
stored_traces: 5
|
|
mode: queued
|
|
triggers:
|
|
- platform: device
|
|
domain: zha
|
|
device_id: fc590f181eaddcfcfc6d6984c7ec76c5
|
|
type: remote_button_short_press
|
|
subtype: turn_on
|
|
actions:
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id:
|
|
- switch.man_001
|
|
- alias: AUT-ManoloNotWorkingMode
|
|
initial_state: 'on'
|
|
trace:
|
|
stored_traces: 5
|
|
mode: queued
|
|
triggers:
|
|
- platform: device
|
|
domain: zha
|
|
device_id: fc590f181eaddcfcfc6d6984c7ec76c5
|
|
type: remote_button_double_press
|
|
subtype: turn_on
|
|
actions:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id:
|
|
- switch.man_001
|
|
- alias: PTR-Mark person as just arrived
|
|
id: ptr_mark_person_as_just_arrived
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
from: not_home
|
|
to: home
|
|
entity_id: &id007
|
|
- person.monica
|
|
- person.manolo
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: "{% if trigger.entity_id == 'person.manolo' %}\n input_select.manolo_status_dropdown\n\
|
|
{% else %}\n input_select.monica_status_dropdown\n{% endif %}\n"
|
|
option: Just Arrived
|
|
- alias: PTR-Mark person as home
|
|
id: ptr_mark_person_as_home
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
entity_id: &id006
|
|
- input_select.manolo_status_dropdown
|
|
- input_select.monica_status_dropdown
|
|
to: Just Arrived
|
|
for:
|
|
minutes: 10
|
|
- platform: state
|
|
entity_id: *id006
|
|
from: Just Left
|
|
to: Just Arrived
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: "{% if trigger.entity_id == 'input_select.manolo_status_dropdown'\
|
|
\ %}\n input_select.manolo_status_dropdown\n{% else %}\n input_select.monica_status_dropdown\n\
|
|
{% endif %}\n"
|
|
option: Home
|
|
- alias: PTR-Mark person as just left
|
|
id: ptr_mark_person_as_just_left
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
entity_id: *id007
|
|
from: home
|
|
to: not_home
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: "{% if trigger.entity_id == 'person.manolo' %}\n input_select.manolo_status_dropdown\n\
|
|
{% else %}\n input_select.monica_status_dropdown\n{% endif %}\n"
|
|
option: Just Left
|
|
- alias: PTR-Mark person as away
|
|
id: ptr_mark_person_as_away
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
entity_id: *id006
|
|
to: Just Left
|
|
for:
|
|
minutes: 10
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: "{% if trigger.entity_id == 'input_select.manolo_status_dropdown'\
|
|
\ %}\n input_select.manolo_status_dropdown\n{% else %}\n input_select.monica_status_dropdown\n\
|
|
{% endif %}\n"
|
|
option: Away
|
|
- alias: PTR-Mark person as extended away
|
|
id: ptr_mark_person_as_extended_away
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
entity_id: *id006
|
|
to: Away
|
|
for:
|
|
hours: 24
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: "{% if trigger.entity_id == 'input_select.manolo_status_dropdown'\
|
|
\ %}\n input_select.manolo_status_dropdown\n{% else %}\n input_select.monica_status_dropdown\n\
|
|
{% endif %}\n"
|
|
option: Extended Away
|
|
- alias: PTR-Update home occupancy
|
|
id: ptr_update_home_occupancy
|
|
mode: queued
|
|
triggers:
|
|
- platform: state
|
|
entity_id: *id006
|
|
actions:
|
|
- service: input_select.select_option
|
|
data_template:
|
|
entity_id: input_select.home_occupancy_status_dropdown
|
|
option: "{%- if states(trigger.entity_id) == states('input_select.home_occupancy_status_dropdown')\
|
|
\ -%}\n {{ states(trigger.entity_id) }}\n{%- else -%}\n {# Loop over all\
|
|
\ states and get the most restrictive #}\n {%- set status_json = {\n \
|
|
\ \"Home\": 0,\n \"Just Arrived\": 1,\n \"Just Left\": 2,\n \
|
|
\ \"Away\": 3,\n \"Extended Away\": 4\n } -%}\n {%- set next_home_occupancy\
|
|
\ = namespace(value=status_json['Extended Away'],name='Extended Away') -%}\n\
|
|
\ {%- for tracker in expand('group.people_status') if status_json[tracker.state]\
|
|
\ < next_home_occupancy.value -%}\n {%- set next_home_occupancy.value\
|
|
\ = status_json[tracker.state] -%}\n {%- set next_home_occupancy.name\
|
|
\ = tracker.state -%}\n {%- endfor -%}\n {{next_home_occupancy.name}}\n\
|
|
{%- endif -%}\n"
|
|
- alias: AUT-New device found
|
|
id: AUT-New_Device_Found
|
|
initial_state: 'on'
|
|
mode: parallel
|
|
triggers:
|
|
- platform: event
|
|
event_type: device_tracker_new_device
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data: &id008
|
|
title: 'ALERT: New device found !'
|
|
message: New device called `{{ trigger.event.data.host_name }}` with MAC `{{
|
|
trigger.event.data.mac }}` found
|
|
- service: notify.manolo
|
|
data: *id008
|
|
- alias: AUT-Notify failed login attempt
|
|
id: AUT-Notify_Failed_Login_Attempt
|
|
initial_state: 'on'
|
|
mode: parallel
|
|
triggers:
|
|
- trigger: persistent_notification
|
|
update_type:
|
|
- added
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ ''Login attempt'' in trigger.notification.title }}'
|
|
actions:
|
|
service: notify.manolo
|
|
data:
|
|
title: '*{{ trigger.notification.title }} !*'
|
|
message: '{{ trigger.notification.message }}'
|
|
- alias: AUT-Notify ip_banned
|
|
id: AUT-Notify_IP_Banned
|
|
initial_state: 'on'
|
|
mode: parallel
|
|
triggers:
|
|
- trigger: persistent_notification
|
|
update_type:
|
|
- added
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ ''Banning IP'' in trigger.notification.title }}'
|
|
actions:
|
|
- alias: Set variables
|
|
variables:
|
|
banned_ip: '{{ trigger.notification.message.split('' '') | last }}'
|
|
- service: notify.manolo
|
|
data:
|
|
title: '*{{ trigger.notification.title }} !*'
|
|
message: '{{ trigger.notification.message }}'
|
|
data:
|
|
inline_keyboard:
|
|
- Unban {{ banned_ip }} and restart Home Assistant:/unban_ip {{ banned_ip
|
|
}}
|
|
- alias: AUT-Unban IP
|
|
id: AUT-Unban_IP
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
id: event_telegram_command
|
|
event_type: telegram_command
|
|
event_data: &id009
|
|
command: /unban_ip
|
|
variables:
|
|
ip_to_unban: '{{ trigger.event.data[''args''][0] }}'
|
|
- platform: event
|
|
id: event_telegram_callback
|
|
event_type: telegram_callback
|
|
event_data: *id009
|
|
variables:
|
|
ip_to_unban: '{{ trigger.event.data[''data''].split('' '')[1] }}'
|
|
actions:
|
|
- service: shell_command.unban_ip
|
|
data:
|
|
ip_to_unban: '{{ ip_to_unban }}'
|
|
- if: '{{ trigger.id == ''event_telegram_callback'' }}'
|
|
then:
|
|
- service: telegram_bot.answer_callback_query
|
|
data:
|
|
callback_query_id: '{{ trigger.event.data.id }}'
|
|
message: Unbanned and restarting HomeAssistant
|
|
- service: homeassistant.restart
|
|
- alias: AUT-Notify Entrance Door Opened
|
|
id: AUT-Notify_Entrance_Door_Opened
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.entrance_door_sensor_opened
|
|
to: 'on'
|
|
actions:
|
|
- service: notify.manolo
|
|
data:
|
|
title: '[Debug] *Door Opened*'
|
|
message: The entrance door has been opened.
|
|
data:
|
|
disable_notification: true
|
|
- alias: AUT-Notify Entrance Door Opened Extended Away
|
|
id: AUT-Notify_Entrance_Door_Opened_Extended_Away
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.entrance_door_sensor_opened
|
|
to: 'on'
|
|
conditions:
|
|
- condition: state
|
|
entity_id: sensor.home_occupancy_status
|
|
state:
|
|
- Extended Away
|
|
- Just Arrived
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: 'Alert: Door Opened'
|
|
message: The entrance door has been opened while the house is in Extended Away
|
|
mode.
|
|
- alias: AUT-Notify Entrance Door Opened Too much time
|
|
id: AUT-Notify_Entrance_Door_Opened_Too_Much_Time
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.entrance_door_sensor_opened
|
|
to: 'on'
|
|
for: 00:03:00
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: 'Alert: Door Left Open'
|
|
message: The entrance door has been left open for more than 3 minutes.
|
|
- alias: AUT-Notify Centinel Mode on Extended Away
|
|
id: AUT-Notify_Centinel_Mode_On_Extended_Away
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: sensor.home_occupancy_status
|
|
to: Extended Away
|
|
actions:
|
|
- service: input_boolean.turn_on
|
|
target:
|
|
entity_id: input_boolean.centinel_mode
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Centinel Mode
|
|
message: Centinel Mode has been enabled automatically due to Extended Away status.
|
|
data:
|
|
inline_keyboard:
|
|
- Disable Centinel Mode:/disable_centinel_mode
|
|
- alias: AUT-Disable Centinel Mode
|
|
id: AUT-Disable_Centinel_Mode
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id010
|
|
command: /disable_centinel_mode
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id010
|
|
actions:
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.centinel_mode
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Centinel Mode
|
|
message: Centinel Mode has been disabled.
|
|
- condition: template
|
|
value_template: '{{ trigger.event.event_type == ''telegram_callback'' }}'
|
|
- service: telegram_bot.answer_callback_query
|
|
data:
|
|
callback_query_id: '{{ trigger.event.data.id }}'
|
|
message: Done!
|
|
- alias: AUT-Centinel Mode Door Camera Recording
|
|
id: AUT-Centinel_Mode_Door_Camera_Recording
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.entrance_door_sensor_opened
|
|
to: 'on'
|
|
variables:
|
|
trigger_time: '{{ now().strftime(''%Y%m%d_%H%M%S'') }}'
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.centinel_mode
|
|
state: 'on'
|
|
actions:
|
|
- parallel:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: 'Alert: Door Opened - Starting Video Recording'
|
|
message: The entrance door has been opened at {{ trigger_time }} while Centinel
|
|
Mode is active. Starting video recordings.
|
|
- sequence:
|
|
- service: camera.record
|
|
target:
|
|
entity_id: camera.entrance_camera
|
|
data:
|
|
duration: 4
|
|
lookback: 4
|
|
filename: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time
|
|
}}_4s.mp4
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Door Recording - 4s
|
|
message: First video recording (4s) completed.
|
|
data:
|
|
video:
|
|
- file: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time
|
|
}}_4s.mp4
|
|
caption: 'Recording #{{ trigger_time }} (4s)'
|
|
- sequence:
|
|
- service: camera.record
|
|
target:
|
|
entity_id: camera.entrance_camera
|
|
data:
|
|
duration: 5
|
|
filename: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time }}_5s.mp4
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Door Recording - 5s
|
|
message: Second video recording (5s) completed.
|
|
data:
|
|
video:
|
|
- file: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time }}_8s.mp4
|
|
caption: 'Continuation recording #{{ trigger_time }} (5s)'
|
|
- sequence:
|
|
- service: camera.record
|
|
target:
|
|
entity_id: camera.entrance_camera
|
|
data:
|
|
duration: 25
|
|
lookback: 20
|
|
filename: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time }}_25s.mp4
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Door Recording - 25s
|
|
message: Final video recording (25s) completed.
|
|
data:
|
|
video:
|
|
- file: /tmp/homeassistant/camera_recordings/entrance_{{ trigger_time }}_25s.mp4
|
|
caption: 'Continuation recording #{{ trigger_time }} (25s)'
|
|
- service: shell_command.delete_old_camera_recordings
|
|
- alias: AUT-Centinel Mode Light Control - Sunset
|
|
id: AUT-Centinel_Mode_Light_Control_Sunset
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: sun
|
|
event: sunset
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.centinel_mode
|
|
state: 'on'
|
|
actions:
|
|
- delay:
|
|
minutes: '{{ range(0, 30) | random }}'
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: group.centinel_mode_lights
|
|
data:
|
|
brightness: '{{ range(180, 255) | random }}'
|
|
- alias: AUT-Centinel Mode Light Control - Night Off
|
|
id: AUT-Centinel_Mode_Light_Control_Night_Off
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: time
|
|
at: '23:00:00'
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.centinel_mode
|
|
state: 'on'
|
|
actions:
|
|
- delay:
|
|
minutes: '{{ range(0, 59) | random }}'
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: group.centinel_mode_lights
|
|
- alias: AUT-No energy in house
|
|
mode: queued
|
|
triggers:
|
|
- platform: template
|
|
value_template: '{% if ''ONBATT'' in states(''sensor.ups_status'') %}true{% endif
|
|
%}'
|
|
actions:
|
|
- service: remote.send_command
|
|
data:
|
|
entity_id: remote.sony_bravia_tv
|
|
command: PowerOff
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: 'ALERT: No energy in home !'
|
|
message: 'Ey, we detected that the UPS status is `{{ states(''sensor.ups_status'')
|
|
}}` and the remaining battery is `{{ states(''sensor.ups_battery'') }}%` so
|
|
probably the power has gone out.
|
|
|
|
With this load (`{{ states(''sensor.ups_load'') }}%`) the expected time of
|
|
battery is `{{ states(''sensor.ups_time_left'') }} minutes`.
|
|
|
|
Any way, I powered off the tv to save energy.
|
|
|
|
'
|
|
- service: notify.manolo
|
|
data:
|
|
title: Debug UPS
|
|
message: 'STATUS: `{{ states(''sensor.ups_status'') }}`
|
|
|
|
STATFLAG: `{{ states(''sensor.ups_status_flag'') }}`
|
|
|
|
XOFFBATT: `{{ states(''sensor.ups_transfer_from_battery'') }}`
|
|
|
|
TONBATT: `{{ states(''sensor.ups_time_on_battery'') }}`
|
|
|
|
CUMONBATT: `{{ states(''sensor.ups_total_time_on_battery'') }}`
|
|
|
|
'
|
|
- alias: AUT-Energy back in house
|
|
mode: queued
|
|
triggers:
|
|
- platform: template
|
|
value_template: '{% if ''ONLINE'' in states(''sensor.ups_status'') %}true{% endif
|
|
%}'
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Energy back in home !
|
|
message: 'Ey, the UPS status now is `{{ states(''sensor.ups_status'') }}` so
|
|
probably the power is back. The current battery is `{{ states(''sensor.ups_battery'')
|
|
}}%`.
|
|
|
|
'
|
|
data:
|
|
disable_notification: true
|
|
- service: notify.manolo
|
|
data:
|
|
title: Debug UPS
|
|
message: 'STATUS: `{{ states(''sensor.ups_status'') }}`
|
|
|
|
STATFLAG: `{{ states(''sensor.ups_status_flag'') }}`
|
|
|
|
XOFFBATT: `{{ states(''sensor.ups_transfer_from_battery'') }}`
|
|
|
|
TONBATT: `{{ states(''sensor.ups_time_on_battery'') }}`
|
|
|
|
CUMONBATT: `{{ states(''sensor.ups_total_time_on_battery'') }}`
|
|
|
|
'
|
|
- alias: AUT-Turn off man-003
|
|
triggers:
|
|
- platform: numeric_state
|
|
entity_id: sensor.man_003_energy_current
|
|
below: 0.3
|
|
for:
|
|
minutes: 10
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.man_003_auto_poweroff
|
|
state: 'on'
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: switch.man_003_left
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: switch.man_003_right
|
|
state: 'on'
|
|
actions:
|
|
- service: switch.turn_off
|
|
entity_id:
|
|
- switch.man_003_left
|
|
- switch.man_003_right
|
|
- service: input_boolean.turn_off
|
|
target:
|
|
entity_id: input_boolean.man_003_auto_poweroff
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Kitchen power plug turned off
|
|
message: 'Ey, I (`AUT-Turn off man-003`) detected low power consumption in the
|
|
kitchen power plug so I turned off *both*.\n
|
|
|
|
Additionally, I disabled auto turn off kitchen power plug
|
|
|
|
'
|
|
data:
|
|
inline_keyboard:
|
|
- Turn on Left:/turn_on switch.man_003_left, Turn on Right:/turn_on switch.man_003_right
|
|
- alias: AUT-Telegram turn on device
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id011
|
|
command: /turn_on
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id011
|
|
actions:
|
|
- service: switch.turn_on
|
|
data_template:
|
|
entity_id: "{% if trigger.event.event_type == 'telegram_command' %}\n {{trigger.event.data[\"\
|
|
args\"][0]|default('entity not passed')}}\n{% elif trigger.event.event_type\
|
|
\ == 'telegram_callback' %}\n {{trigger.event.data[\"data\"].split(' ')[1]|default('entity\
|
|
\ not passed')}}\n{% else %}\n switch.event_not_recognized\n{% endif %}\n"
|
|
- condition: template
|
|
value_template: '{{ trigger.event.event_type == ''telegram_callback'' }}'
|
|
- service: telegram_bot.answer_callback_query
|
|
data:
|
|
callback_query_id: '{{ trigger.event.data.id }}'
|
|
message: Done!
|
|
- alias: AUT-Notify Vacuum Error
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
to: error
|
|
- platform: state
|
|
entity_id:
|
|
- sensor.home_occupancy_status
|
|
to: Home
|
|
for:
|
|
minutes: 2
|
|
conditions:
|
|
condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
state: error
|
|
actions:
|
|
- delay: 00:00:21
|
|
- service: script.take_camera_snapshot_and_send_telegram
|
|
data:
|
|
camera_entity: camera.roborocks5_map
|
|
notify_to: script.notify_in_home_or_all
|
|
message: '*Something fail in the vacuum...*
|
|
|
|
Error was: `{{state_attr("sensor.valetudo_roborocks5_error", "severity")}}`
|
|
|
|
Error was: `{{state_attr("sensor.valetudo_roborocks5_error", "subsystem")}}`
|
|
|
|
Error was: `{{state_attr("sensor.valetudo_roborocks5_error", "message")}}`
|
|
|
|
Error was: `{{states("sensor.valetudo_roborocks5_error")}}`
|
|
|
|
'
|
|
- alias: AUT-Vacuum
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: time
|
|
at: '12:32:00'
|
|
- platform: time
|
|
at: '11:28:00'
|
|
- platform: state
|
|
entity_id:
|
|
- sensor.home_occupancy_status
|
|
to: Away
|
|
for: 00:05:00
|
|
conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.workday_sensor
|
|
state: 'on'
|
|
- condition: time
|
|
after: '10:00:00'
|
|
before: '22:30:00'
|
|
- condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.workday_sensor
|
|
state: 'off'
|
|
- condition: time
|
|
after: '11:30:00'
|
|
before: '22:30:00'
|
|
- condition: template
|
|
value_template: '{{ states("vacuum.valetudo_roborocks5") == "docked" }}'
|
|
- condition: template
|
|
value_template: '{{ states("sensor.home_occupancy_status") != "Extended Away"
|
|
}}'
|
|
- condition: or
|
|
conditions:
|
|
- condition: and
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ ( as_timestamp(now()) - as_timestamp(states("input_datetime.vacuum_last_full_clean"))
|
|
|int(0) ) /60/60 > 23 }}'
|
|
- condition: and
|
|
conditions:
|
|
- condition: template
|
|
value_template: '{{ ( as_timestamp(now()) - as_timestamp(states("input_datetime.vacuum_last_full_clean"))
|
|
|int(0) ) /60/60 > 13 }}'
|
|
- condition: state
|
|
entity_id: sensor.home_occupancy_status
|
|
state:
|
|
- Extended Away
|
|
- Away
|
|
actions:
|
|
- service: timer.start
|
|
entity_id: timer.vacuum_start_in
|
|
data:
|
|
duration: 00:05:00
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Vacuum is going to start
|
|
message: 'Vacuum is going to start in 5 minutes.
|
|
|
|
'
|
|
data:
|
|
inline_keyboard:
|
|
- 🚫 Stop it 🚫:/vacuum_stop, ✅ Start now:/vacuum_start
|
|
- alias: AUT-Vacuum start
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: timer.finished
|
|
event_data:
|
|
entity_id: timer.vacuum_start_in
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id012
|
|
command: /vacuum_start
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id012
|
|
actions:
|
|
- service: vacuum.set_fan_speed
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
data:
|
|
fan_speed: Standard
|
|
- service: vacuum.start
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
- alias: AUT-Vacuum update statistics
|
|
mode: queued
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
to: returning
|
|
actions:
|
|
- delay: 00:00:10
|
|
- condition: template
|
|
value_template: '{{ (states(''input_number.vacuum_xiaomi_historic_cleaning_time'')|int)
|
|
!= (states(''sensor.valetudo_roborocks5_total_statistics_time'')|int) }}'
|
|
- service: input_number.set_value
|
|
target:
|
|
entity_id: input_number.vacuum_xiaomi_historic_cleaning_time
|
|
data:
|
|
value: '{{ states(''sensor.valetudo_roborocks5_total_statistics_time'') }}'
|
|
- service: input_number.set_value
|
|
data_template:
|
|
entity_id: input_number.vacuum_xiaomi_dust_clean_left
|
|
value: '{{ [(states(''input_number.vacuum_xiaomi_dust_clean_left'')|int) - (states(''sensor.valetudo_roborocks5_current_statistics_area'')|int
|
|
// 10000), 0] | max }}
|
|
|
|
'
|
|
- condition: numeric_state
|
|
entity_id: sensor.valetudo_roborocks5_current_statistics_area
|
|
above: 340000
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.vacuum_last_full_clean
|
|
data:
|
|
datetime: '{{ now().strftime(''%Y-%m-%d %H:%M:%S'') }}'
|
|
- delay: 00:00:21
|
|
- service: script.take_camera_snapshot_and_send_telegram
|
|
data:
|
|
camera_entity: camera.roborocks5_map
|
|
notify_to: script.notify_in_home_or_all
|
|
data:
|
|
disable_notification: true
|
|
message: '*Clean finished !*
|
|
|
|
`{{(states(''sensor.valetudo_roborocks5_current_statistics_area'')|int //
|
|
10000)}}` square meters have been cleaned
|
|
|
|
'
|
|
- alias: AUT-Notify Vacuum maintenance
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: state
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
to: returning
|
|
- platform: state
|
|
entity_id: input_number.vacuum_xiaomi_dust_clean_left
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{%- set minimal_notify = 2 -%} {{ \n (states('input_number.vacuum_xiaomi_dust_clean_left')|int)\
|
|
\ < minimal_notify\n}}\n"
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Vacuum need maintenance
|
|
message: 'Cepillo principal*:* `{{ (states(''sensor.valetudo_roborocks5_main_brush'')|int)
|
|
}} h` _restantes_
|
|
|
|
Cepillo lateral: `{{ (states(''sensor.valetudo_roborocks5_right_brush'')|int)
|
|
}} h` restantes
|
|
|
|
Filtro: `{{ (states(''sensor.valetudo_roborocks5_main_filter'')|int) }} h`
|
|
restantes
|
|
|
|
Limpieza de sensores: `{{ (states(''sensor.valetudo_roborocks5_sensor_cleaning'')|int)
|
|
}} h` restantes
|
|
|
|
Vaciado del deposito: `{{ (states(''input_number.vacuum_xiaomi_dust_clean_left'')|int)
|
|
}} m²` restantes
|
|
|
|
'
|
|
data:
|
|
inline_keyboard:
|
|
- Vacuum already cleaned:/vacuum_cleaned
|
|
- alias: AUT-Telegram reset Vacuum meters
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id013
|
|
command: /vacuum_cleaned
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id013
|
|
actions:
|
|
- service: input_number.set_value
|
|
data_template:
|
|
entity_id: input_number.vacuum_xiaomi_dust_clean_left
|
|
value: '{{ state_attr(''input_number.vacuum_xiaomi_dust_clean_left'', ''max'')|int
|
|
}}
|
|
|
|
'
|
|
- condition: template
|
|
value_template: '{{ trigger.event.event_type == ''telegram_callback'' }}'
|
|
- service: telegram_bot.answer_callback_query
|
|
data:
|
|
callback_query_id: '{{ trigger.event.data.id }}'
|
|
message: Done!
|
|
- alias: AUT-Telegram stop Vacuum
|
|
mode: restart
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id014
|
|
command: /vacuum_stop
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id014
|
|
actions:
|
|
- service: timer.cancel
|
|
target:
|
|
entity_id: timer.vacuum_start_in
|
|
- service: vacuum.stop
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
- delay: 00:00:30
|
|
- service: vacuum.return_to_base
|
|
entity_id: vacuum.valetudo_roborocks5
|
|
- alias: AUT-Notify Washing machine finished
|
|
triggers:
|
|
- platform: state
|
|
entity_id: sensor.washing_machine_status
|
|
to: Clean
|
|
- platform: state
|
|
entity_id:
|
|
- sensor.home_occupancy_status
|
|
to: Home
|
|
for:
|
|
minutes: 2
|
|
conditions:
|
|
condition: and
|
|
conditions:
|
|
- condition: state
|
|
entity_id: sensor.washing_machine_status
|
|
state: Clean
|
|
actions:
|
|
- service: script.notify_in_home_or_all
|
|
data:
|
|
title: Washing Machine finished
|
|
message: Hey, the washing machine has finished and is ready to be emptied
|
|
data:
|
|
inline_keyboard:
|
|
- Already empty:/washing_machine_already_empty
|
|
- alias: AUT-Washing machine should power on
|
|
initial_state: 'on'
|
|
triggers:
|
|
- platform: event
|
|
event_type: timer.finished
|
|
event_data:
|
|
entity_id: timer.washing_machine_power_on_in
|
|
actions:
|
|
- service: timer.cancel
|
|
target:
|
|
entity_id: timer.washing_machine_power_on_in
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: 'Off'
|
|
- service: switch.turn_on
|
|
target:
|
|
entity_id:
|
|
- switch.man_002
|
|
- alias: AUT-Washing machine Running
|
|
triggers:
|
|
- platform: numeric_state
|
|
entity_id: sensor.man_002_current_a
|
|
above: 1
|
|
conditions:
|
|
condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: sensor.washing_machine_status
|
|
state:
|
|
- 'Off'
|
|
- Finishing
|
|
- Clean
|
|
- Scheduled
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: Washing
|
|
- alias: AUT-Washing machine Clean
|
|
triggers:
|
|
- platform: numeric_state
|
|
entity_id: sensor.man_002_current_a
|
|
below: 0.001
|
|
for:
|
|
minutes: 8
|
|
conditions:
|
|
condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.washing_machine_status
|
|
state:
|
|
- Washing
|
|
- Finishing
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: Clean
|
|
- alias: AUT-Washing machine Emptying
|
|
triggers:
|
|
- platform: numeric_state
|
|
entity_id: sensor.man_002_current_a
|
|
above: 0.001
|
|
conditions:
|
|
condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.washing_machine_status
|
|
state:
|
|
- Clean
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: Emptying
|
|
- alias: AUT-Washing machine Off
|
|
triggers:
|
|
- platform: numeric_state
|
|
entity_id: sensor.man_002_current_a
|
|
below: 0.001
|
|
for:
|
|
minutes: 15
|
|
conditions:
|
|
condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_select.washing_machine_status
|
|
state:
|
|
- Emptying
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: 'Off'
|
|
- alias: AUT-Washing machine Force Off
|
|
triggers:
|
|
- platform: event
|
|
event_type: telegram_command
|
|
event_data: &id015
|
|
command: /washing_machine_already_empty
|
|
- platform: event
|
|
event_type: telegram_callback
|
|
event_data: *id015
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.washing_machine_status
|
|
option: 'Off'
|
|
- alias: AUT-Mark windows preferred status as close
|
|
mode: queued
|
|
triggers:
|
|
- platform: template
|
|
value_template: '{{ states(''binary_sensor.environment_001_temperature_rising'')
|
|
and states(''binary_sensor.dyson_01_temperature_rising'') }}'
|
|
for: 01:30:00
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.windows_preferred_status
|
|
option: Close
|
|
- alias: AUT-Mark windows preferred status as open
|
|
mode: queued
|
|
triggers:
|
|
- platform: template
|
|
value_template: '{{ states(''binary_sensor.environment_001_temperature_falling'')
|
|
and (states(''sensor.ble_environment_001_temperature'') < states(''sensor.dyson_01_temperature''))
|
|
}}'
|
|
for: 00:10:00
|
|
actions:
|
|
- service: input_select.select_option
|
|
data:
|
|
entity_id: input_select.windows_preferred_status
|
|
option: Open
|