2044 lines
67 KiB
YAML
2044 lines
67 KiB
YAML
- mode: single
|
|
alias: Alexroom Light Switch
|
|
id: alexroom_light_switch
|
|
description: Handle actions from the Senic Wall Switch in the lalexroom
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_alexroom_action
|
|
from: null
|
|
to: press_1
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_alexroom_action
|
|
from: null
|
|
to: press_2
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_alexroom_action
|
|
from: null
|
|
to: press_3
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_alexroom_action
|
|
from: null
|
|
to: press_4
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.aqara_switch_alexroom_action
|
|
from: null
|
|
to: single
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.aqara_switch_alexroom_action
|
|
from: null
|
|
to: double
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.sensor.senic_wall_switch_alexroom_action.state\
|
|
\ == 'press_2'\n}}"
|
|
sequence:
|
|
- action: switch.toggle
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_alexroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Light toggled by Senic Wall Switch
|
|
logger: homeassistant.components.automation.alexroom_light_switch
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.sensor.aqara_switch_alexroom_action.state ==\
|
|
\ 'single'\n or states.sensor.aqara_switch_alexroom_action.state == 'double'\n\
|
|
}}"
|
|
sequence:
|
|
- action: switch.toggle
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_alexroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Light toggled by Aqara Button Switch
|
|
logger: homeassistant.components.automation.alexroom_light_switch
|
|
- alias: Alexroom Nanoleaf Lines
|
|
id: alexroom_nanoleaf_lines
|
|
description: Turn on the nanoleaf lines when power consumption is above 50W
|
|
mode: single
|
|
triggers:
|
|
- trigger: numeric_state
|
|
entity_id:
|
|
- sensor.aqara_wall_outlet_alexroom_power
|
|
above: 40
|
|
- trigger: numeric_state
|
|
entity_id:
|
|
- sensor.aqara_wall_outlet_alexroom_power
|
|
for:
|
|
seconds: 10
|
|
below: 40
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: numeric_state
|
|
entity_id: sensor.aqara_wall_outlet_alexroom_power
|
|
above: 40
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.lines_5c30
|
|
- conditions:
|
|
- condition: numeric_state
|
|
entity_id: sensor.aqara_wall_outlet_alexroom_power
|
|
below: 40
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.lines_5c30
|
|
- alias: basement_light
|
|
id: basement_light
|
|
description: Turn on the basement light when motion is detected
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_basement
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_basement
|
|
to: 'off'
|
|
for:
|
|
minutes: 10
|
|
- trigger: time
|
|
at: 08:00:01
|
|
- trigger: time
|
|
at: '23:00:01'
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_basement
|
|
state: 'on'
|
|
- condition: time
|
|
after: 08:00:00
|
|
before: '23:00:00'
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.gledopto_dimmer_stairs_basement
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: light.basement
|
|
state: 'off'
|
|
- condition: numeric_state
|
|
entity_id: light.basement
|
|
attribute: brightness
|
|
below: 235
|
|
above: 235
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id:
|
|
- light.gledopto_dimmer_stairs_basement
|
|
data:
|
|
brightness: 255
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: scene.basement_working
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.basement_working turned on
|
|
logger: homeassistant.components.automation.basement_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_basement
|
|
state: 'on'
|
|
- condition: time
|
|
after: '23:00:00'
|
|
before: 08:00:00
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.gledopto_dimmer_stairs_basement
|
|
state: 'off'
|
|
- condition: state
|
|
entity_id: light.basement
|
|
state: 'off'
|
|
- condition: numeric_state
|
|
entity_id: light.basement
|
|
attribute: brightness
|
|
below: 115
|
|
above: 115
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id:
|
|
- light.gledopto_dimmer_stairs_basement
|
|
data:
|
|
brightness: 255
|
|
- action: scene.turn_on
|
|
target:
|
|
entity_id: scene.basement_relax
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.basement_relax turned on
|
|
logger: homeassistant.components.automation.basement_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_basement
|
|
state: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 10
|
|
seconds: 0
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.gledopto_dimmer_stairs_basement
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: light.basement
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id:
|
|
- light.basement
|
|
- light.gledopto_dimmer_stairs_basement
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.basement turned off
|
|
logger: homeassistant.components.automation.basement_light
|
|
- alias: Basement Power on Light Relay if off
|
|
id: basement_light_relay
|
|
description: Turn on the basement light relay if it is off
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- switch.switch_basement_relay
|
|
to: 'off'
|
|
conditions: []
|
|
actions:
|
|
- action: switch.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: switch.switch_basement_relay
|
|
- alias: bathroom_nanoleaf
|
|
id: bathroom_nanoleaf
|
|
description: Bathroom Nanoleaf Skylight motion automation
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.sensor_bathroom_sr501_pir_motion
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.sensor_bathroom_sr501_pir_motion
|
|
to: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 10
|
|
seconds: 0
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.sensor_bathroom_sr501_pir_motion
|
|
state: 'on'
|
|
- condition: time
|
|
after: 08:00:00
|
|
before: 00:00:00
|
|
- condition: state
|
|
entity_id: light.skylight_8a41
|
|
state: 'off'
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_8a41
|
|
data:
|
|
brightness: 255
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a41 turned on (brightness=255)
|
|
logger: homeassistant.components.automation.bathroom_nanoleaf
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.sensor_bathroom_sr501_pir_motion
|
|
state: 'on'
|
|
- condition: time
|
|
after: 00:00:00
|
|
before: 08:00:00
|
|
- condition: state
|
|
entity_id: light.skylight_8a41
|
|
state: 'off'
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_8a41
|
|
data:
|
|
brightness: 77
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a41 turned on (brightness=77)
|
|
logger: homeassistant.components.automation.bathroom_nanoleaf
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.sensor_bathroom_sr501_pir_motion
|
|
state: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 10
|
|
seconds: 0
|
|
- condition: state
|
|
entity_id: light.skylight_8a41
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.skylight_8a41
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a41 turned off
|
|
logger: homeassistant.components.automation.bathroom_nanoleaf
|
|
- alias: Bedroom Aqara Switches
|
|
id: bedroom_aqara_switches
|
|
description: 'Controls skylight with Aqara switches - single press toggles light,
|
|
double press cycles between brightness levels
|
|
|
|
'
|
|
mode: queued
|
|
max_exceeded: silent
|
|
trigger:
|
|
- platform: state
|
|
entity_id:
|
|
- sensor.aqara_switch_bedroom_1_action
|
|
- sensor.aqara_switch_bedroom_2_action
|
|
condition:
|
|
- condition: template
|
|
value_template: '{{ trigger.to_state.state in [''single'', ''double''] }}
|
|
|
|
'
|
|
variables:
|
|
action_type: '{{ trigger.to_state.state }}'
|
|
current_brightness: '{{ state_attr(''light.skylight_9aa7'', ''brightness'') |
|
|
default(120) }}'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ action_type == ''single'' }}'
|
|
sequence:
|
|
- service: light.toggle
|
|
target:
|
|
entity_id: light.skylight_9aa7
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ action_type == ''double'' }}'
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ current_brightness >= 50 }}'
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_9aa7
|
|
data:
|
|
brightness: 50
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ current_brightness < 50 }}'
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_9aa7
|
|
data:
|
|
brightness: 120
|
|
- alias: Bedroom Galaxy Light Projector Auto On
|
|
id: bedroom_galaxy_light_projector_auto_on
|
|
description: 'Automatically turns on the bedroom galaxy light projector after 5
|
|
minutes when the door is closed after 22:00.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.aqara_contact_door_bedroom_contact
|
|
to: 'off'
|
|
for:
|
|
minutes: 5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.galaxy_projector_bedroom_lock_status') !=\
|
|
\ 'locked'\n and states('light.galaxy_light_projector_2') == 'off'\n and states('binary_sensor.aqara_contact_door_bedroom_contact')\
|
|
\ == 'off'\n and (now().hour >= 22 or now.hour <= 1)\n}}\n"
|
|
action:
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: bedroom_galaxy_light_projector
|
|
owner: homeassistant-automation
|
|
duration: 9h
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.galaxy_light_projector_2
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom Galaxy Light Projector turned on after door closed at night.
|
|
logger: homeassistant.components.automation.bedroom_galaxy_light_projector_auto_on
|
|
- alias: Bedroom Power on Light Relay if off
|
|
id: bedroom_light_relay
|
|
description: Turn on the bedroom light relay if it is off
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- switch.aqara_wall_switch_bedroom
|
|
to: 'off'
|
|
conditions: []
|
|
actions:
|
|
- action: switch.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: switch.aqara_wall_switch_bedroom
|
|
- alias: Climate Bedroom Auto Off At Night
|
|
id: climate_bedroom_auto_off_at_night
|
|
description: 'Automatically turns off the bedroom AC after 23:00
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{\n states('climate.bedroom') == 'cool'\n and states('sensor.hisense_ac_bedroom_automation_block_status')\
|
|
\ == 'allowed'\n and (now().hour >= 23 or now().hour < 6)\n}}\n"
|
|
actions:
|
|
- action: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
- action: climate.turn_off
|
|
target:
|
|
entity_id: climate.bedroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom AC turned off after 23:00.
|
|
logger: homeassistant.components.automation.climate_bedroom_auto_off_at_night
|
|
- alias: Climate Bedroom Auto Off on Target Temp
|
|
id: climate_bedroom_auto_off_on_target_temp
|
|
description: 'Automatically turns off the bedroom AC when the temperature drops
|
|
below 22°C and the minimum run time has been met.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
- platform: numeric_state
|
|
entity_id: sensor.qingping_bedroom_temperature
|
|
below: 22
|
|
for:
|
|
minutes: 5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set ac_start_timestamp = as_timestamp(states.input_datetime.climate_bedroom_start_time.state)\
|
|
\ %} {% set current_timestamp = now().timestamp() %} {% set ac_run_time = (current_timestamp\
|
|
\ - ac_start_timestamp) / 60 %} {{\n states('climate.bedroom') == 'cool'\n\
|
|
\ and states('sensor.qingping_bedroom_temperature') | float <= 22\n and ac_run_time\
|
|
\ > 30\n}}\n"
|
|
actions:
|
|
- action: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
- action: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
owner: homeassistant-automation
|
|
duration: 20m
|
|
- action: climate.turn_off
|
|
target:
|
|
entity_id: climate.bedroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom AC turned off due to target temp reached.
|
|
logger: homeassistant.components.automation.climate_bedroom_auto_off_on_target_temp
|
|
- alias: Climate Bedroom Auto Off on Window Open
|
|
id: climate_bedroom_auto_off_on_window_open
|
|
description: 'Automatically turns off the bedroom AC when the window is open for
|
|
more than 5 minutes. The automation checks every 5 minutes and respects the state
|
|
of the climate and window sensors.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
- platform: state
|
|
entity_id: binary_sensor.aqara_contact_window_bedroom_contact
|
|
to: 'on'
|
|
for:
|
|
minutes: 5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set last_changed = states.binary_sensor.aqara_contact_window_bedroom_contact.last_changed\
|
|
\ %} {{\n states('climate.bedroom') == 'on'\n and states('binary_sensor.aqara_contact_window_bedroom_contact')\
|
|
\ == 'on'\n and last_changed is not none\n and (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ > 300\n}}\n"
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.aqara_contact_window_bedroom_contact
|
|
state: 'on'
|
|
- condition: template
|
|
value_template: "{% set last_changed = states.binary_sensor.aqara_contact_window_bedroom_contact.last_changed\
|
|
\ %} {{\n last_changed is not none\n and (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ > 300\n}}\n"
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
- service: climate.turn_off
|
|
target:
|
|
entity_id: climate.bedroom
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom AC turned off due to open window for more than 5 minutes
|
|
logger: homeassistant.components.automation.climate_bedroom_auto_off
|
|
- alias: Bedroom AC Auto On
|
|
id: climatge_bedroom_auto_on
|
|
description: 'Automatically turns on the bedroom AC when the temperature is above
|
|
23°C, the window is closed, and the weather forecast temperature is above 25°C.
|
|
The automation checks every 5 minutes and respects time constraints.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set current_time = now() %} {% set is_weekend = current_time.weekday()\
|
|
\ >= 5 %} {% set start_time = '08:30' if is_weekend else '07:30' %} {% set end_time\
|
|
\ = '23:00' if is_weekend else '22:00' %} {{\n current_time.strftime('%H:%M')\
|
|
\ >= start_time\n and current_time.strftime('%H:%M') < end_time\n and states('sensor.qingping_bedroom_temperature')\
|
|
\ | float > 23\n and states('binary_sensor.aqara_contact_window_bedroom_contact')\
|
|
\ == 'off'\n and states('sensor.weather_forecast_temperature_forecast') | float\
|
|
\ > 25\n and states('sensor.hisense_ac_bedroom_lock_status') != 'locked'\n\
|
|
\ and states('sensor.hisense_ac_bedroom_automation_block_status') == 'allowed'\n\
|
|
}}\n"
|
|
actions:
|
|
- action: script.cool_bedroom
|
|
data:
|
|
reason: hot day and bedroom temperature to high
|
|
- alias: Climate Bedroom Manual Control
|
|
id: climate_bedroom_manual_control
|
|
description: Handle manual AC button presses and override automation
|
|
mode: restart
|
|
triggers:
|
|
- platform: state
|
|
entity_id: climate.bedroom
|
|
to: 'on'
|
|
id: manual_on
|
|
- platform: state
|
|
entity_id: climate.bedroom
|
|
to: 'off'
|
|
id: manual_off
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{\n trigger.from_state is not none and\n trigger.from_state.state\
|
|
\ in ['on', 'off'] and\n trigger.to_state.state in ['on', 'off'] and\n trigger.from_state.state\
|
|
\ != trigger.to_state.state\n}}\n"
|
|
- condition: template
|
|
value_template: "{% set context_id = trigger.to_state.context.id %} {% set user_id\
|
|
\ = trigger.to_state.context.user_id %} {% set parent_id = trigger.to_state.context.parent_id\
|
|
\ %}\n{# Manual UI/App control - user_id is present #} {% if user_id is not\
|
|
\ none %}\n true\n{# Physical button or external control - context.id is None\
|
|
\ #} {% elif context_id is none %}\n true\n{# Exclude our own automation contexts\
|
|
\ #} {% elif 'climate_bedroom_auto_off_on_window_open' in (context_id or '')\
|
|
\ %}\n false\n{% elif 'climate_bedroom_auto_off_on_target_temp' in (context_id\
|
|
\ or '') %}\n false\n{% elif 'climate_bedroom_auto_on' in (context_id or '')\
|
|
\ %}\n false\n{% elif 'cool_bedroom' in (context_id or '') %}\n false\n{#\
|
|
\ Allow other automations to be treated as manual (e.g., other cooling scripts)\
|
|
\ #} {% else %}\n true\n{% endif %}\n"
|
|
actions:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Manual control detected - Context ID: {{ trigger.to_state.context.id
|
|
}}, User ID: {{ trigger.to_state.context.user_id }}, Parent ID: {{ trigger.to_state.context.parent_id
|
|
}}, New state: {{ trigger.to_state.state }}, Old state: {{ trigger.from_state.state
|
|
}}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.climate_bedroom_manual_control
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_on
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 1h
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom cooling manual started by user
|
|
logger: homeassistant.components.automation.climate_bedroom_manual_control
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_off
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_bedroom
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 1h
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Bedroom cooling manual stoped by user
|
|
logger: homeassistant.components.automation.climate_bedroom_manual_control
|
|
- alias: Climate Bedroom Track Start Time
|
|
id: climate_bedroom_track_start_time
|
|
description: 'Updates the climate_bedroom_start_time whenever the bedroom AC changes
|
|
from off to any active mode
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: climate.bedroom
|
|
from: 'off'
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{\n trigger.to_state.state != 'off' and\n trigger.to_state.state\
|
|
\ != 'unknown' and\n trigger.to_state.state != 'unavailable'\n}}\n"
|
|
action:
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.climate_bedroom_start_time
|
|
data:
|
|
datetime: '{{ now() }}'
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Updated Bedroom AC start time: mode changed from off to {{ trigger.to_state.state
|
|
}}'
|
|
logger: homeassistant.components.automation.track_ac_bedroom_start_time
|
|
- alias: Climate Livingroom Auto Off At Night
|
|
id: climate_livingroom_auto_off_at_night
|
|
description: 'Automatically turns off the livingroom AC after 23:00
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{\n states('climate.livingroom') == 'cool'\n and states('sensor.hisense_ac_livingroom_automation_block_status')\
|
|
\ == 'allowed'\n and (now().hour >= 23 or now().hour < 6)\n}}\n"
|
|
actions:
|
|
- action: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
- action: climate.turn_off
|
|
target:
|
|
entity_id: climate.livingroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Livingroom AC turned off after 23:00.
|
|
logger: homeassistant.components.automation.climate_livingroom_auto_off_at_night
|
|
- alias: Climate Livingroom Auto Off on Target Temp
|
|
id: climate_livingroom_auto_off_on_target_temp
|
|
description: 'Automatically turns off the livingroom AC when the temperature drops
|
|
below 22°C and the minimum run time has been met.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
- platform: numeric_state
|
|
entity_id: sensor.qingping_livingroom_temperature
|
|
below: 22
|
|
for:
|
|
minutes: 5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set ac_start_timestamp = as_timestamp(states.input_datetime.climate_livingroom_start_time.state)\
|
|
\ %} {% set current_timestamp = now().timestamp() %} {% set ac_run_time = (current_timestamp\
|
|
\ - ac_start_timestamp) / 60 %} {{\n states('climate.livingroom') == 'cool'\n\
|
|
\ and states('sensor.qingping_livingroom_temperature') | float <= 22\n and\
|
|
\ ac_run_time > 30\n}}\n"
|
|
actions:
|
|
- action: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
- action: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
owner: homeassistant-automation
|
|
duration: 20m
|
|
- action: climate.turn_off
|
|
target:
|
|
entity_id: climate.livingroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Livingroom AC turned off due to target temp reached.
|
|
logger: homeassistant.components.automation.climate_livingroom_auto_off_on_target_temp
|
|
- alias: Livingroom AC Auto On
|
|
id: climatge_livingroom_auto_on
|
|
description: 'Automatically turns on the livingroom AC when the temperature is above
|
|
23°C, and the weather forecast temperature is above 25°C. The automation checks
|
|
every 5 minutes and respects time constraints.
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /5
|
|
condition:
|
|
- condition: template
|
|
value_template: "{% set current_time = now() %} {% set is_weekend = current_time.weekday()\
|
|
\ >= 5 %} {% set start_time = '08:30' if is_weekend else '07:30' %} {% set end_time\
|
|
\ = '23:00' if is_weekend else '22:00' %} {{\n current_time.strftime('%H:%M')\
|
|
\ >= start_time\n and current_time.strftime('%H:%M') < end_time\n and states('sensor.qingping_livingroom_temperature')\
|
|
\ | float > 23\n and states('sensor.weather_forecast_temperature_forecast')\
|
|
\ | float > 25\n and states('sensor.hisense_ac_livingroom_lock_status') !=\
|
|
\ 'locked'\n and states('sensor.hisense_ac_livingroom_automation_block_status')\
|
|
\ == 'allowed'\n}}\n"
|
|
actions:
|
|
- action: script.cool_livingroom
|
|
data:
|
|
reason: hot day and livingroom temperature to high
|
|
- alias: Climate Livingroom Manual Control
|
|
id: climate_livingroom_manual_control
|
|
description: Handle manual AC button presses and override automation
|
|
mode: restart
|
|
triggers:
|
|
- platform: state
|
|
entity_id: climate.livingroom
|
|
to: 'on'
|
|
id: manual_on
|
|
- platform: state
|
|
entity_id: climate.livingroom
|
|
to: 'off'
|
|
id: manual_off
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{\n trigger.from_state is not none and\n trigger.from_state.state\
|
|
\ in ['on', 'off'] and\n trigger.to_state.state in ['on', 'off'] and\n trigger.from_state.state\
|
|
\ != trigger.to_state.state\n}}\n"
|
|
- condition: template
|
|
value_template: "{% set context_id = trigger.to_state.context.id %} {% set user_id\
|
|
\ = trigger.to_state.context.user_id %} {% set parent_id = trigger.to_state.context.parent_id\
|
|
\ %}\n{# Manual UI/App control - user_id is present #} {% if user_id is not\
|
|
\ none %}\n true\n{# Physical button or external control - context.id is None\
|
|
\ #} {% elif context_id is none %}\n true\n{# Exclude our own automation contexts\
|
|
\ #} {% elif 'climate_livingroom_auto_off_on_window_open' in (context_id or\
|
|
\ '') %}\n false\n{% elif 'climate_livingroom_auto_off_on_target_temp' in (context_id\
|
|
\ or '') %}\n false\n{% elif 'climate_livingroom_auto_on' in (context_id or\
|
|
\ '') %}\n false\n{% elif 'cool_livingroom' in (context_id or '') %}\n false\n\
|
|
{# Allow other automations to be treated as manual (e.g., other cooling scripts)\
|
|
\ #} {% else %}\n true\n{% endif %}\n"
|
|
actions:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Manual control detected - Context ID: {{ trigger.to_state.context.id
|
|
}}, User ID: {{ trigger.to_state.context.user_id }}, Parent ID: {{ trigger.to_state.context.parent_id
|
|
}}, New state: {{ trigger.to_state.state }}, Old state: {{ trigger.from_state.state
|
|
}}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.climate_livingroom_manual_control
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_on
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 60m
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Livingroom cooling manual started by user
|
|
logger: homeassistant.components.automation.climate_livingroom_manual_control
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_off
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: hisense_ac_livingroom
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 60m
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Livingroom cooling manual stoped by user
|
|
logger: homeassistant.components.automation.climate_livingroom_manual_control
|
|
- alias: Climate Livingroom Track Start Time
|
|
id: climate_livingroom_track_start_time
|
|
description: 'Updates the climate_livingroom_start_time whenever the Livingroom
|
|
AC changes from off to any active mode
|
|
|
|
'
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: climate.livingroom
|
|
from: 'off'
|
|
condition:
|
|
- condition: template
|
|
value_template: "{{\n trigger.to_state.state != 'off' and\n trigger.to_state.state\
|
|
\ != 'unknown' and\n trigger.to_state.state != 'unavailable'\n}}\n"
|
|
action:
|
|
- service: input_datetime.set_datetime
|
|
target:
|
|
entity_id: input_datetime.climate_livingroom_start_time
|
|
data:
|
|
datetime: '{{ now() }}'
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Updated Livingroom AC start time: mode changed from off to {{ trigger.to_state.state
|
|
}}'
|
|
logger: homeassistant.components.automation.track_ac_livingroom_start_time
|
|
- alias: Domiroom Ceiling Light motion automation
|
|
id: domiroom_ceiling_light
|
|
description: Turn on the ceiling light when motion is detected in the room
|
|
mode: single
|
|
trigger:
|
|
- platform: state
|
|
entity_id: group.motion_domiroom
|
|
to: 'on'
|
|
condition:
|
|
- condition: time
|
|
after: 09:00:00
|
|
before: '20:00:00'
|
|
- condition: numeric_state
|
|
entity_id: sensor.aqara_wall_outlet_dominikroom_power
|
|
below: 50
|
|
actions:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.led_ceiling_light_domiroom
|
|
- alias: Domiroom Nanoleaf automation
|
|
id: domiroom_nanoleaf
|
|
description: Turn on the nanoleaf shape when computer is on
|
|
mode: single
|
|
triggers:
|
|
- trigger: numeric_state
|
|
entity_id:
|
|
- sensor.aqara_wall_outlet_dominikroom_power
|
|
above: 100
|
|
- trigger: numeric_state
|
|
entity_id:
|
|
- sensor.aqara_wall_outlet_dominikroom_power
|
|
for:
|
|
seconds: 10
|
|
below: 100
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: numeric_state
|
|
entity_id: sensor.aqara_wall_outlet_dominikroom_power
|
|
above: 100
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.shapes_a6dc
|
|
- conditions:
|
|
- condition: numeric_state
|
|
entity_id: sensor.aqara_wall_outlet_dominikroom_power
|
|
below: 100
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.shapes_a6dc
|
|
- alias: Auto-lock front door when closed
|
|
id: entrance_nuki_autolock
|
|
mode: single
|
|
description: Automatically locks Nuki when door has been closed for 30 seconds
|
|
triggers:
|
|
- platform: state
|
|
entity_id: binary_sensor.aqara_contact_door_entrance_contact
|
|
to: 'off'
|
|
for:
|
|
seconds: 30
|
|
- platform: state
|
|
entity_id: lock.nuki
|
|
to: unlocked
|
|
for:
|
|
minutes: 2
|
|
conditions:
|
|
- condition: state
|
|
entity_id: lock.nuki
|
|
state: unlocked
|
|
- condition: state
|
|
entity_id: binary_sensor.aqara_contact_door_entrance_contact
|
|
state: 'off'
|
|
actions:
|
|
- service: lock.lock
|
|
target:
|
|
entity_id: lock.nuki
|
|
- alias: frontdoor_camera_motion_snapshots
|
|
id: frontdoor_camera_motion_snapshots
|
|
description: Take snapshots when front door motion is detected
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.front_door_motion
|
|
to: 'on'
|
|
actions:
|
|
- repeat:
|
|
sequence:
|
|
- action: button.press
|
|
data:
|
|
entity_id: button.front_door_take_snapshot
|
|
- delay: 3
|
|
- action: homeassistant.update_entity
|
|
data:
|
|
entity_id:
|
|
- camera.front_door_snapshot
|
|
- action: camera.snapshot
|
|
data:
|
|
filename: /data/ring-snapshots/{{ now().strftime("%Y-%m-%d_%H-%M-%S") }}_{{repeat.index}}.jpg
|
|
target:
|
|
entity_id: camera.front_door_snapshot
|
|
- delay: 15
|
|
while:
|
|
- condition: state
|
|
entity_id: binary_sensor.front_door_motion
|
|
state: 'on'
|
|
- alias: Garden Herb Irrigation
|
|
id: garden_herb_irrigation
|
|
description: Water herbs after sunrise and during hot days, with lock tracking
|
|
mode: single
|
|
triggers:
|
|
- platform: sun
|
|
event: sunrise
|
|
offset: +01:00:00
|
|
id: morning_watering
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: morning_watering
|
|
- condition: template
|
|
value_template: '{{ not (states(''sensor.openmeteo_precipitation'') | float(0)
|
|
> 0) }}'
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden_automation_block_status'')
|
|
== ''allowed'' }}'
|
|
sequence:
|
|
- service: script.start_herb_watering
|
|
data:
|
|
reason: Morning watering after sunrise
|
|
- alias: Garden Herb Irrigation Auto Off
|
|
id: garden_herb_irrigation_auto_off
|
|
description: Turn off garden irrigation system when lock has been expired or in
|
|
malfunction state
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /1
|
|
condition:
|
|
- condition: state
|
|
entity_id: switch.woox_irrigation_garden
|
|
state: 'on'
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden_lock_status'') != ''locked''
|
|
}}
|
|
|
|
'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden_lock_status'')
|
|
== ''unlocked'' }}
|
|
|
|
'
|
|
sequence:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.woox_irrigation_garden
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Irrigation cleanup: Garden valve turned off after normal lock
|
|
expiration'
|
|
logger: homeassistant.components.automation.garden_herb_irrigation_auto_off
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{% set lock_status = states.sensor.woox_irrigation_garden_lock_status.state\
|
|
\ %} {% set last_changed = states.sensor.woox_irrigation_garden_lock_status.last_changed\
|
|
\ %} {{ lock_status not in ['locked', 'unlocked'] and\n last_changed\
|
|
\ is not none and\n (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ > 180 }}\n"
|
|
sequence:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.woox_irrigation_garden
|
|
- service: system_log.write
|
|
data:
|
|
level: warning
|
|
message: 'Irrigation emergency shutdown: Garden lock service in unknown
|
|
state ({{ states(''sensor.woox_irrigation_garden_lock_status'') }}) for
|
|
3+ minutes'
|
|
logger: homeassistant.components.automation.garden_herb_irrigation_auto_off
|
|
- alias: Garden Herb Irrigation Manual Control
|
|
id: garden_herb_irrigation_manual_control
|
|
description: Handle manual irrigation button presses and override automation
|
|
mode: restart
|
|
triggers:
|
|
- platform: state
|
|
entity_id: switch.woox_irrigation_garden
|
|
to: 'on'
|
|
id: manual_on
|
|
- platform: state
|
|
entity_id: switch.woox_irrigation_garden
|
|
to: 'off'
|
|
id: manual_off
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{ trigger.from_state is not none and\n trigger.from_state.state\
|
|
\ in ['on', 'off'] and\n trigger.to_state.state in ['on', 'off'] and\n \
|
|
\ trigger.from_state.state != trigger.to_state.state }}\n"
|
|
- condition: template
|
|
value_template: "{% set context_id = trigger.to_state.context.id %} {% set user_id\
|
|
\ = trigger.to_state.context.user_id %} {% set parent_id = trigger.to_state.context.parent_id\
|
|
\ %}\n{# Manual UI/App control - user_id is present #} {% if user_id is not\
|
|
\ none %}\n true\n{# Physical button or external control - context.id is None\
|
|
\ #} {% elif context_id is none %}\n true\n{# Exclude our own automation contexts\
|
|
\ #} {% elif 'garden_herb_irrigation_auto_off' in (context_id or '') %}\n false\n\
|
|
{% elif 'garden_herb_irrigation' in (context_id or '') %}\n false\n{% elif\
|
|
\ 'start_herb_watering' in (context_id or '') %}\n false\n{# Allow other automations\
|
|
\ to be treated as manual (e.g., other irrigation scripts) #} {% else %}\n \
|
|
\ true\n{% endif %}\n"
|
|
actions:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Switch state change detected - Context ID: {{ trigger.to_state.context.id
|
|
}}, User ID: {{ trigger.to_state.context.user_id }}, Parent ID: {{ trigger.to_state.context.parent_id
|
|
}}, New state: {{ trigger.to_state.state }}, Old state: {{ trigger.from_state.state
|
|
}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.garden_herb_irrigation_manual_control
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_on
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: woox_irrigation_garden
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: woox_irrigation_garden
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 15m
|
|
- service: counter.increment
|
|
target:
|
|
entity_id: counter.daily_herb_watering_count
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Manual irrigation started by user
|
|
logger: homeassistant.components.automation.garden_herb_irrigation_manual_control
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_off
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: woox_irrigation_garden
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: woox_irrigation_garden
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 1h
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Manual irrigation stopped by user - automation blocked for 1 hour
|
|
logger: homeassistant.components.automation.garden_herb_irrigation_manual_control
|
|
- alias: Garden Tomato Irrigation
|
|
id: garden_tomato_irrigation
|
|
description: Water tomatoes after sunrise and during hot days, with lock tracking
|
|
mode: single
|
|
triggers:
|
|
- platform: sun
|
|
event: sunrise
|
|
offset: +00:30:00
|
|
id: morning_watering
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: morning_watering
|
|
- condition: template
|
|
value_template: '{{ not (states(''sensor.openmeteo_precipitation'') | float(0)
|
|
> 0) }}'
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden2_automation_block_status'')
|
|
== ''allowed'' }}'
|
|
sequence:
|
|
- service: script.start_tomato_watering
|
|
data:
|
|
reason: Morning watering after sunrise
|
|
- alias: Garden Tomato Irrigation Auto Off
|
|
id: garden_tomato_irrigation_auto_off
|
|
description: Turn off garden irrigation system when lock has been expired or in
|
|
malfunction state
|
|
mode: single
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: /1
|
|
condition:
|
|
- condition: state
|
|
entity_id: switch.woox_irrigation_garden2
|
|
state: 'on'
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden2_lock_status'') !=
|
|
''locked'' }}
|
|
|
|
'
|
|
action:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: '{{ states(''sensor.woox_irrigation_garden2_lock_status'')
|
|
== ''unlocked'' }}
|
|
|
|
'
|
|
sequence:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.woox_irrigation_garden2
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Irrigation cleanup: Garden valve turned off after normal lock
|
|
expiration'
|
|
logger: homeassistant.components.automation.garden_tomato_irrigation_auto_off
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{% set lock_status = states.sensor.woox_irrigation_garden2_lock_status.state\
|
|
\ %} {% set last_changed = states.sensor.woox_irrigation_garden2_lock_status.last_changed\
|
|
\ %} {{ lock_status not in ['locked', 'unlocked'] and\n last_changed\
|
|
\ is not none and\n (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ > 180 }}\n"
|
|
sequence:
|
|
- service: switch.turn_off
|
|
target:
|
|
entity_id: switch.woox_irrigation_garden2
|
|
- service: system_log.write
|
|
data:
|
|
level: warning
|
|
message: 'Irrigation emergency shutdown: Garden lock service in unknown
|
|
state ({{ states(''sensor.woox_irrigation_garden2_lock_status'') }}) for
|
|
3+ minutes'
|
|
logger: homeassistant.components.automation.garden_tomato_irrigation_auto_off
|
|
- alias: Garden Tomato Irrigation Manual Control
|
|
id: garden_tomato_irrigation_manual_control
|
|
description: Handle manual irrigation button presses and override automation
|
|
mode: restart
|
|
triggers:
|
|
- platform: state
|
|
entity_id: switch.woox_irrigation_garden2
|
|
to: 'on'
|
|
id: manual_on
|
|
- platform: state
|
|
entity_id: switch.woox_irrigation_garden2
|
|
to: 'off'
|
|
id: manual_off
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{ trigger.from_state is not none and\n trigger.from_state.state\
|
|
\ in ['on', 'off'] and\n trigger.to_state.state in ['on', 'off'] and\n \
|
|
\ trigger.from_state.state != trigger.to_state.state }}\n"
|
|
- condition: template
|
|
value_template: "{% set context_id = trigger.to_state.context.id %} {% set user_id\
|
|
\ = trigger.to_state.context.user_id %} {% set parent_id = trigger.to_state.context.parent_id\
|
|
\ %}\n{# Manual UI/App control - user_id is present #} {% if user_id is not\
|
|
\ none %}\n true\n{# Physical button or external control - context.id is None\
|
|
\ #} {% elif context_id is none %}\n true\n{# Exclude our own automation contexts\
|
|
\ #} {% elif 'garden_tomato_irrigation_auto_off' in (context_id or '') %}\n\
|
|
\ false\n{% elif 'garden_tomato_irrigation' in (context_id or '') %}\n false\n\
|
|
{% elif 'start_tomato_watering' in (context_id or '') %}\n false\n{# Allow\
|
|
\ other automations to be treated as manual (e.g., other irrigation scripts)\
|
|
\ #} {% else %}\n true\n{% endif %}\n"
|
|
actions:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Switch state change detected - Context ID: {{ trigger.to_state.context.id
|
|
}}, User ID: {{ trigger.to_state.context.user_id }}, Parent ID: {{ trigger.to_state.context.parent_id
|
|
}}, New state: {{ trigger.to_state.state }}, Old state: {{ trigger.from_state.state
|
|
}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.garden_manual_irrigation_control
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_on
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: woox_irrigation_garden2
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: woox_irrigation_garden2
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 30m
|
|
- service: counter.increment
|
|
target:
|
|
entity_id: counter.daily_tomato_watering_count
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Manual irrigation started by user
|
|
logger: homeassistant.components.automation.garden_manual_irrigation_control
|
|
- conditions:
|
|
- condition: trigger
|
|
id: manual_off
|
|
sequence:
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: woox_irrigation_garden2
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: woox_irrigation_garden2
|
|
owner: homeassistant-{{ trigger.to_state.context.user_id }}
|
|
duration: 1h
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Manual irrigation stopped by user - automation blocked for 1 hour
|
|
logger: homeassistant.components.automation.garden_manual_irrigation_control
|
|
- alias: kitchen_nanoleaf
|
|
id: kitchen_nanoleaf
|
|
description: Kitchen Nanoleaf Skylight motion automation
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.mijia_motion_kitchen_occupancy
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.mijia_motion_kitchen_occupancy
|
|
to: 'off'
|
|
for:
|
|
minutes: 5
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_downstairs
|
|
to: 'off'
|
|
for:
|
|
minutes: 20
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.mijia_motion_kitchen_occupancy
|
|
state: 'on'
|
|
- condition: time
|
|
after: 07:00:00
|
|
before: 00:00:00
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.skylight_8a30
|
|
state: 'off'
|
|
- condition: numeric_state
|
|
entity_id: light.skylight_8a30
|
|
attribute: brightness
|
|
below: 255
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_8a30
|
|
data:
|
|
brightness: 255
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a30 turned on (brightness=255)
|
|
logger: homeassistant.components.automation.kitchen_nanoleaf
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.mijia_motion_kitchen_occupancy
|
|
state: 'on'
|
|
- condition: time
|
|
after: 00:00:00
|
|
before: 07:00:00
|
|
- condition: or
|
|
conditions:
|
|
- condition: state
|
|
entity_id: light.skylight_8a30
|
|
state: 'off'
|
|
- condition: numeric_state
|
|
entity_id: light.skylight_8a30
|
|
attribute: brightness
|
|
above: 51
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_8a30
|
|
data:
|
|
brightness: 51
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a30 turned on (brightness=51)
|
|
logger: homeassistant.components.automation.kitchen_nanoleaf
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.mijia_motion_kitchen_occupancy
|
|
state: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 5
|
|
seconds: 0
|
|
- condition: state
|
|
entity_id: light.skylight_8a30
|
|
state: 'on'
|
|
- condition: numeric_state
|
|
entity_id: light.skylight_8a30
|
|
attribute: brightness
|
|
above: 51
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: light.skylight_8a30
|
|
data:
|
|
brightness: 51
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a30 turned on (brightness=51)
|
|
logger: homeassistant.components.automation.kitchen_nanoleaf
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_downstairs
|
|
state: 'off'
|
|
for:
|
|
minutes: 15
|
|
- condition: state
|
|
entity_id: light.skylight_8a30
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.skylight_8a30
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.skylight_8a30 turned off
|
|
logger: homeassistant.components.automation.kitchen_nanoleaf
|
|
- alias: laundryroom_light
|
|
id: laundryroom_light
|
|
description: Laundryroom light motion automation
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.mijia_motion_laundryroom_occupancy
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- binary_sensor.mijia_motion_laundryroom_occupancy
|
|
to: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 5
|
|
seconds: 0
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.mijia_motion_laundryroom_occupancy
|
|
state: 'on'
|
|
- condition: state
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
state: 'off'
|
|
sequence:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light laundryroom turned on
|
|
logger: homeassistant.components.automation.laundryroom_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: binary_sensor.mijia_motion_laundryroom_occupancy
|
|
state: 'off'
|
|
for:
|
|
hours: 0
|
|
minutes: 5
|
|
seconds: 0
|
|
- condition: state
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
state: 'on'
|
|
sequence:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light laundryroom turned off
|
|
logger: homeassistant.components.automation.laundryroom_light
|
|
- mode: single
|
|
alias: Laundryroom Light Switch
|
|
id: laundryroom_light_switch
|
|
description: Handle actions from the Senic Wall Switch in the laundryroom
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_laundryroom_action
|
|
from: null
|
|
to: press_1
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_laundryroom_action
|
|
from: null
|
|
to: press_2
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.senic_wall_switch_laundryroom_action
|
|
from: null
|
|
to: press_3
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.sensor.senic_wall_switch_laundryroom_action.state\
|
|
\ == 'press_1'\n and states.switch.shelly_1gen4_light_laundryroom.state\
|
|
\ == 'off'\n}}"
|
|
sequence:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Light turned ON by Senic Wall Switch
|
|
logger: homeassistant.components.automation.laundryroom_light_switch
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.sensor.senic_wall_switch_laundryroom_action.state\
|
|
\ == 'press_2'\n and states.switch.shelly_1gen4_light_laundryroom.state\
|
|
\ == 'on'\n}}"
|
|
sequence:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.shelly_1gen4_light_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Light turned OFF by Senic Wall Switch
|
|
logger: homeassistant.components.automation.laundryroom_light_switch
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.sensor.senic_wall_switch_laundryroom_action.state\
|
|
\ == 'press_3'\n and states.switch.shelly_1gen4_ventilation_laundryroom.state\
|
|
\ == 'off'\n}}"
|
|
sequence:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.shelly_1gen4_ventilation_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Ventilation turned ON by Senic Wall Switch
|
|
logger: homeassistant.components.automation.laundryroom_light_switch
|
|
- alias: Livingroom Nanoleaf Elements
|
|
id: livingroom_nanoleaf_elements
|
|
description: 'Turn on the nanoleaf when motion downstairs is detected, turn off
|
|
when no motion is detected for 15 minutes.
|
|
|
|
'
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_downstairs
|
|
from: 'off'
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_downstairs
|
|
to: 'off'
|
|
for:
|
|
minutes: 15
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states('light.elements_d689') == 'off'\n and states('group.motion_downstairs')\
|
|
\ == 'on'\n}}\n"
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.elements_d689
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.elements_d689 turned on
|
|
logger: homeassistant.components.automation.livingroom_nanoleaf_elements
|
|
- conditions:
|
|
- condition: template
|
|
value_template: "{{\n states('light.elements_d689') == 'on'\n and states('group.motion_downstairs')\
|
|
\ == 'off'\n and as_timestamp(now()) - as_timestamp(states.group.motion_downstairs.last_changed)\
|
|
\ >= 900\n}}\n"
|
|
sequence:
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.lines_5c30
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.elements_d689 turned off
|
|
logger: homeassistant.components.automation.livingroom_nanoleaf_elements
|
|
- alias: office_light
|
|
id: office_light
|
|
description: Turn on the office light when motion is detected
|
|
mode: single
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_office
|
|
to: 'on'
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_office
|
|
to: 'off'
|
|
for:
|
|
minutes: 10
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_office
|
|
to: 'off'
|
|
for:
|
|
minutes: 15
|
|
- trigger: state
|
|
entity_id:
|
|
- group.motion_office
|
|
to: 'off'
|
|
for:
|
|
minutes: 20
|
|
- trigger: time
|
|
at: 06:00:01
|
|
- trigger: time
|
|
at: 08:00:01
|
|
- trigger: time
|
|
at: '12:00:01'
|
|
- trigger: time
|
|
at: '14:00:01'
|
|
- trigger: time
|
|
at: '21:00:01'
|
|
- trigger: time
|
|
at: '23:00:01'
|
|
- trigger: time
|
|
at: 00:00:01
|
|
conditions: []
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: time
|
|
after: '23:00:00'
|
|
before: 06:00:00
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.office_light_automation_block_status')\
|
|
\ == 'allowed'\n and states('group.motion_office') == 'on'\n and (\n \
|
|
\ states('light.office') == 'off'\n or state_attr('light.office', 'brightness')\
|
|
\ != 45\n )\n}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_night
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_night turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: time
|
|
after: 06:00:00
|
|
before: 08:00:00
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.office_light_automation_block_status')\
|
|
\ == 'allowed'\n and states('group.motion_office') == 'on'\n and (\n \
|
|
\ states('light.office') == 'off'\n or state_attr('light.office', 'brightness')\
|
|
\ != 220\n )\n}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_reading
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_reading turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: time
|
|
after: 08:00:00
|
|
before: '12:00:00'
|
|
- condition: time
|
|
after: '14:00:00'
|
|
before: '21:00:00'
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.office_light_automation_block_status')\
|
|
\ == 'allowed'\n and states('group.motion_office') == 'on'\n and (\n \
|
|
\ states('light.office') == 'off'\n or state_attr('light.office', 'brightness')\
|
|
\ != 235\n )\n}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_working
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_working turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: time
|
|
after: '12:00:00'
|
|
before: '14:00:00'
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.office_light_automation_block_status')\
|
|
\ == 'allowed'\n and states('group.motion_office') == 'on'\n and (\n \
|
|
\ states('light.office') == 'off'\n or state_attr('light.office', 'brightness')\
|
|
\ != 255\n )\n}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_concentration
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_concentration turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: time
|
|
after: '21:00:00'
|
|
before: '23:00:00'
|
|
- condition: template
|
|
value_template: "{{\n states('sensor.office_light_automation_block_status')\
|
|
\ == 'allowed'\n and states('group.motion_office') == 'on'\n and (\n \
|
|
\ states('light.office') == 'off'\n or state_attr('light.office', 'brightness')\
|
|
\ != 170\n )\n}}"
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_evening
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_evening turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_office
|
|
state: 'off'
|
|
for:
|
|
minutes: 10
|
|
- condition: time
|
|
after: 00:00:00
|
|
before: 08:00:00
|
|
- condition: state
|
|
entity_id: light.office
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.office
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.office turned off
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_office
|
|
state: 'off'
|
|
for:
|
|
minutes: 15
|
|
- condition: time
|
|
after: 08:00:00
|
|
before: 00:00:00
|
|
- condition: state
|
|
entity_id: light.office
|
|
state: 'on'
|
|
sequence:
|
|
- action: scene.turn_on
|
|
data: {}
|
|
target:
|
|
entity_id: scene.office_relax
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: scene.office_relax turned on
|
|
logger: homeassistant.components.automation.office_light
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: group.motion_office
|
|
state: 'off'
|
|
for:
|
|
minutes: 20
|
|
- condition: time
|
|
after: 08:00:00
|
|
before: 00:00:00
|
|
- condition: state
|
|
entity_id: light.office
|
|
state: 'on'
|
|
sequence:
|
|
- action: light.turn_off
|
|
target:
|
|
entity_id: light.office
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: light.office turned off
|
|
logger: homeassistant.components.automation.office_light
|
|
- alias: Office Light Manual Control
|
|
id: office_light_manual_control
|
|
description: Handle manual scene changes and override automation for 1 hour
|
|
mode: restart
|
|
triggers:
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_reading
|
|
id: scene_change
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_working
|
|
id: scene_change
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_concentration
|
|
id: scene_change
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_evening
|
|
id: scene_change
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_night
|
|
id: scene_change
|
|
- trigger: event
|
|
event_type: call_service
|
|
event_data:
|
|
domain: scene
|
|
service: turn_on
|
|
service_data:
|
|
entity_id: scene.office_relax
|
|
id: scene_change
|
|
- trigger: state
|
|
entity_id: light.office
|
|
to: 'on'
|
|
id: light_on
|
|
- trigger: state
|
|
entity_id: light.office
|
|
to: 'off'
|
|
id: light_off
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{% macro is_manual_control(context_id, user_id) %}\n {# Manual\
|
|
\ UI/App control - user_id is present #}\n {% if user_id is not none %}\n \
|
|
\ true\n {# Physical button or external control - context.id is None #}\n\
|
|
\ {% elif context_id is none %}\n true\n {# Skip if our own automation\
|
|
\ triggered it #}\n {% elif context_id and 'office_light' in context_id %}\n\
|
|
\ false\n {% else %}\n true\n {% endif %}\n{% endmacro %}\n{% if trigger.id\
|
|
\ == 'scene_change' %}\n {# Event trigger - use trigger.event.context #}\n\
|
|
\ {% set context_id = trigger.event.context.id %}\n {% set user_id = trigger.event.context.user_id\
|
|
\ %}\n {{ is_manual_control(context_id, user_id) }}\n{% elif trigger.id in\
|
|
\ ['light_on', 'light_off'] %}\n {# State trigger - use trigger.to_state.context\
|
|
\ #}\n {% set context_id = trigger.to_state.context.id %}\n {% set user_id\
|
|
\ = trigger.to_state.context.user_id %}\n {% set from_state = trigger.from_state.state\
|
|
\ %}\n {% set to_state = trigger.to_state.state %}\n\n {# Block startup/reconnection\
|
|
\ transitions #}\n {% if from_state in ['unknown', 'unavailable'] %}\n false\n\
|
|
\ {% else %}\n {{ is_manual_control(context_id, user_id) }}\n {% endif\
|
|
\ %}\n{% else %}\n false\n{% endif %}\n"
|
|
actions:
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id: scene_change
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Office scene change detected - Context ID: {{ trigger.event.context.id
|
|
}}, User ID: {{ trigger.event.context.user_id }}, Scene: {{ trigger.event.data.service_data.entity_id
|
|
}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.office_light_manual_control
|
|
- conditions:
|
|
- condition: or
|
|
conditions:
|
|
- condition: trigger
|
|
id: light_on
|
|
- condition: trigger
|
|
id: light_off
|
|
sequence:
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: 'Office light state change detected - Context ID: {{ trigger.to_state.context.id
|
|
}}, User ID: {{ trigger.to_state.context.user_id }}, Entity: {{ trigger.entity_id
|
|
}}, New state: {{ trigger.to_state.state }}, Old state: {{ trigger.from_state.state
|
|
}}
|
|
|
|
'
|
|
logger: homeassistant.components.automation.office_light_manual_control
|
|
- service: rest_command.release_lock
|
|
data:
|
|
name: office_light
|
|
- service: rest_command.create_lock
|
|
data:
|
|
name: office_light
|
|
owner: "{% if trigger.id == 'scene_change' %}\n homeassistant-{{ trigger.event.context.user_id\
|
|
\ }}\n{% else %}\n homeassistant-{{ trigger.to_state.context.user_id }}\n\
|
|
{% endif %}\n"
|
|
duration: 1h
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Manual office light/scene control detected - automation blocked for
|
|
1 hour
|
|
logger: homeassistant.components.automation.office_light_manual_control
|
|
- alias: Reset Daily Herb Watering Counter
|
|
id: reset_daily_herb_watering_counter
|
|
description: Reset the daily herb watering counter at midnight
|
|
mode: single
|
|
triggers:
|
|
- platform: time
|
|
at: 00:00:00
|
|
actions:
|
|
- service: counter.reset
|
|
target:
|
|
entity_id: counter.daily_herb_watering_count
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Reset daily herb watering counter
|
|
logger: homeassistant.components.automation.reset_daily_herb_watering_counter
|
|
- alias: Reset Daily Tomato Watering Counter
|
|
id: reset_daily_tomato_watering_counter
|
|
description: Reset the daily tomato watering counter at midnight
|
|
mode: single
|
|
triggers:
|
|
- platform: time
|
|
at: 00:00:00
|
|
actions:
|
|
- service: counter.reset
|
|
target:
|
|
entity_id: counter.daily_tomato_watering_count
|
|
- service: system_log.write
|
|
data:
|
|
level: info
|
|
message: Reset daily tomato watering counter
|
|
logger: homeassistant.components.automation.reset_daily_tomato_watering_counter
|
|
- alias: Update Configuration on Gitlab Push Event
|
|
mode: single
|
|
id: update_config_gitlab_push_event
|
|
trigger:
|
|
- platform: webhook
|
|
webhook_id: secret webhook_id
|
|
allowed_methods:
|
|
- POST
|
|
- PUT
|
|
local_only: true
|
|
action:
|
|
- service: shell_command.update_config
|
|
- alias: Ventilation Baathroom Auto Off
|
|
id: ventilation_bathroom_auto_off
|
|
description: 'Automatically turns off bathroom ventilation when humidity drops to
|
|
58% or below, but only after the ventilation has been running for at least 15
|
|
minutes.
|
|
|
|
'
|
|
mode: single
|
|
triggers:
|
|
- trigger: numeric_state
|
|
entity_id: sensor.aqara_climate_bathroom_humidity
|
|
below: 58
|
|
- trigger: time_pattern
|
|
minutes: /5
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{% set last_changed = states.switch.shelly_1gen4_ventilation_bathroom.last_changed\
|
|
\ %} {{\n states.switch.shelly_1gen4_ventilation_bathroom.state == 'on'\n \
|
|
\ and states.sensor.aqara_climate_bathroom_humidity.state | float <= 58\n and\
|
|
\ last_changed is not none\n and (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ >= 900\n}}\n"
|
|
actions:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.shelly_1gen4_ventilation_bathroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Ventilation turned OFF - humidity normalized
|
|
logger: homeassistant.components.automation.ventilation_bathroom_auto_off
|
|
- alias: Ventilation Bathroom Auto On
|
|
id: ventilation_bathroom_auto_on
|
|
description: 'Automatically turns on bathroom ventilation when humidity exceeds
|
|
58%.
|
|
|
|
'
|
|
mode: single
|
|
triggers:
|
|
- trigger: time_pattern
|
|
minutes: /5
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.switch.shelly_1gen4_ventilation_bathroom.state !=\
|
|
\ 'on'\n and states.sensor.aqara_climate_bathroom_humidity.state | float >\
|
|
\ 58\n}}\n"
|
|
actions:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.shelly_1gen4_ventilation_bathroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Ventilation turned ON - humidity over threshold
|
|
logger: homeassistant.components.automation.ventilation_bathroom_auto_on
|
|
- alias: Ventilation Laundryroom Auto Off
|
|
id: ventilation_laundryroom_auto_off
|
|
description: 'Automatically turns off laundryroom ventilation when humidity drops
|
|
to 58% or below, but only after the ventilation has been running for at least
|
|
15 minutes.
|
|
|
|
'
|
|
mode: single
|
|
triggers:
|
|
- trigger: numeric_state
|
|
entity_id: sensor.aqara_climate_laundryroom_humidity
|
|
below: 58
|
|
- trigger: time_pattern
|
|
minutes: /5
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{% set last_changed = states.switch.shelly_1gen4_ventilation_laundryroom.last_changed\
|
|
\ %} {{\n states.switch.shelly_1gen4_ventilation_laundryroom.state == 'on'\n\
|
|
\ and states.sensor.aqara_climate_laundryroom_humidity.state | float <= 58\n\
|
|
\ and last_changed is not none\n and (as_timestamp(now()) - as_timestamp(last_changed))\
|
|
\ >= 900\n}}\n"
|
|
actions:
|
|
- action: switch.turn_off
|
|
target:
|
|
entity_id: switch.shelly_1gen4_ventilation_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Ventilation turned OFF - humidity normalized
|
|
logger: homeassistant.components.automation.ventilation_laundryroom_auto_off
|
|
- alias: Ventilation Laundryroom Auto On
|
|
id: ventilation_laundryroom_auto_on
|
|
description: 'Automatically turns on laundryroom ventilation when humidity exceeds
|
|
58%.
|
|
|
|
'
|
|
mode: single
|
|
triggers:
|
|
- trigger: time_pattern
|
|
minutes: /5
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{{\n states.switch.shelly_1gen4_ventilation_laundryroom.state\
|
|
\ != 'on'\n and states.sensor.aqara_climate_laundryroom_humidity.state | float\
|
|
\ > 58\n}}\n"
|
|
actions:
|
|
- action: switch.turn_on
|
|
target:
|
|
entity_id: switch.shelly_1gen4_ventilation_laundryroom
|
|
- action: system_log.write
|
|
data:
|
|
level: info
|
|
message: Ventilation turned ON - humidity over threshold
|
|
logger: homeassistant.components.automation.ventilation_laundryroom_auto_on
|