AutomationDataset/tyriis/description-ready.json

1243 lines
98 KiB
JSON

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