AutomationDataset/JeffRocchio/description-ready.json

425 lines
25 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[
{
"id": "Ambient Light | Set Quantize Values",
"automation": "- alias: Ambient Light | Set Quantize Values\n description: 'This automation ''quantizes'' the raw lux values reported by the ambient\n sensor devices into text values of Bright, Dim, Dark, or Night. These quantized\n values are what I use to trigger ambient light related automations. <br> **04/25/2025**: Created\n this automation to update both of the ''real'' sensors.'\n triggers:\n - trigger: time_pattern\n minutes: /5\n conditions: []\n actions:\n - repeat:\n for_each:\n - sensor: sensor.ambient_light_sensor_s2_bh1750_lux\n quantized: input_text.ambient_s2_quantized\n night_lux: input_number.ambient_s2_quant_night_lux\n dark_lux: input_number.ambient_s2_quant_dark_lux\n dim_lux: input_number.ambient_s2_quant_dim_lux\n - sensor: sensor.adafruit_feather_sensors_bh1750_illuminance\n quantized: input_text.ambient_s1_quantized\n night_lux: input_number.ambient_s1_quant_night_lux\n dark_lux: input_number.ambient_s1_quant_dark_lux\n dim_lux: input_number.ambient_s1_quant_dim_lux\n sequence:\n - choose:\n - conditions:\n - condition: template\n value_template: '{% set lux = states(repeat.item.sensor) | float %} {%\n set n = states(repeat.item.night_lux) | float %} {% set d = states(repeat.item.dark_lux) |\n float %} {{ lux > n and lux < d }}\n\n '\n sequence:\n - target:\n entity_id: '{{ repeat.item.quantized }}'\n data:\n value: Dark\n action: input_text.set_value\n - conditions:\n - condition: template\n value_template: '{% set lux = states(repeat.item.sensor) | float %} {%\n set d = states(repeat.item.dark_lux) | float %} {% set di = states(repeat.item.dim_lux) |\n float %} {{ lux > d and lux < di }}\n\n '\n sequence:\n - target:\n entity_id: '{{ repeat.item.quantized }}'\n data:\n value: Dim\n action: input_text.set_value\n - conditions:\n - condition: template\n value_template: '{% set lux = states(repeat.item.sensor) | float %} {%\n set di = states(repeat.item.dim_lux) | float %} {{ lux > di }}\n\n '\n sequence:\n - target:\n entity_id: '{{ repeat.item.quantized }}'\n data:\n value: Bright\n action: input_text.set_value\n default:\n - target:\n entity_id: '{{ repeat.item.quantized }}'\n data:\n value: Night\n action: input_text.set_value\n mode: single",
"config": [
{
"name": "ambient light sensor s2 bh1750 lux",
"room": null,
"type": "sensor",
"id": {
"entity_id": "sensor.ambient_light_sensor_s2_bh1750_lux",
"device_id": null
}
},
{
"name": "ambient s2 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s2_quantized",
"device_id": null
}
},
{
"name": "ambient s2 quant night lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s2_quant_night_lux",
"device_id": null
}
},
{
"name": "ambient s2 quant dark lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s2_quant_dark_lux",
"device_id": null
}
},
{
"name": "ambient s2 quant dim lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s2_quant_dim_lux",
"device_id": null
}
},
{
"name": "adafruit feather sensors bh1750 illuminance",
"room": null,
"type": "sensor",
"id": {
"entity_id": "sensor.adafruit_feather_sensors_bh1750_illuminance",
"device_id": null
}
},
{
"name": "ambient s1 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s1_quantized",
"device_id": null
}
},
{
"name": "ambient s1 quant night lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s1_quant_night_lux",
"device_id": null
}
},
{
"name": "ambient s1 quant dark lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s1_quant_dark_lux",
"device_id": null
}
},
{
"name": "ambient s1 quant dim lux",
"room": null,
"type": "input_number",
"id": {
"entity_id": "input_number.ambient_s1_quant_dim_lux",
"device_id": null
}
},
{
"name": "ambient s1 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s1_quantized",
"device_id": null
}
},
{
"name": "ambient s2 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s2_quantized",
"device_id": null
}
}
]
},
{
"id": "Ambient Sensors | State Changed",
"automation": "- alias: Ambient Sensors | State Changed\n description: 'This is part of my handling of changes to ambient light and the day-dim\n application. This automation catches an ambient light level change for any of\n the lux sensors and to then calls the ''lightset_assess_conditions'' script. <br>\n **04/25/2025**: Implemented and is working.'\n triggers:\n - trigger: state\n entity_id:\n - input_text.ambient_s9_quantized\n - input_text.ambient_s1_quantized\n - input_text.ambient_s2_quantized\n from: null\n to: null\n conditions: []\n actions:\n - variables:\n trigger_map:\n input_text.ambient_s9_quantized: input_text.ambient_s9_lightset_label\n input_text.ambient_s1_quantized: input_text.ambient_s1_lightset_label\n input_text.ambient_s2_quantized: input_text.ambient_s2_lightset_label\n sensor_label_helper: '{{ trigger_map[trigger.entity_id] }}'\n lightset_label: '{{ states(sensor_label_helper) | default(''NoLightsetLabel'')\n }}'\n alias: Define Needed Variables\n - alias: Debug - Show Variables\n data:\n name: Lightset Debug\n message: 'VARIABLE: [sensor_label_helper: {{ sensor_label_helper }}] || VARIABLE:\n [lightset_label: {{lightset_label }}]\n\n '\n action: logbook.log\n - action: script.turn_on\n metadata: {}\n data:\n entity_id: script.lightset_assess_conditions\n variables:\n lightset_label: '{{ lightset_label }}'\n mode: parallel",
"config": [
{
"name": "ambient s2 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s2_quantized",
"device_id": null
}
},
{
"name": "ambient s1 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s1_quantized",
"device_id": null
}
},
{
"name": "ambient s9 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s9_quantized",
"device_id": null
}
},
{
"name": "ambient s1 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s1_quantized",
"device_id": null
}
},
{
"name": "ambient s2 quantized",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s2_quantized",
"device_id": null
}
},
{
"name": "ambient s9 lightset label",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s9_lightset_label",
"device_id": null
}
},
{
"name": "ambient s1 lightset label",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s1_lightset_label",
"device_id": null
}
},
{
"name": "ambient s2 lightset label",
"room": null,
"type": "input_text",
"id": {
"entity_id": "input_text.ambient_s2_lightset_label",
"device_id": null
}
},
{
"name": "lightset assess conditions script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_assess_conditions",
"device_id": null
}
}
]
},
{
"id": "Light Set - Lset App Test Light Set | Deactivate Requested",
"automation": "- alias: Light Set - Lset App Test Light Set | Deactivate Requested\n description: ''\n triggers:\n - trigger: state\n entity_id:\n - input_button.light_set_lset_app_test_light_set_deactivate\n - input_button.light_set_lset_app_test_light_set_disable\n from: null\n to: null\n conditions: []\n actions:\n - variables:\n button_map:\n input_button.light_set_lset_app_test_light_set_deactivate:\n target_lightset_label: Light Set - Lset App Test Light Set\n target_exit_state: Deactivated\n input_button.light_set_lset_app_test_light_set_disable:\n target_lightset_label: Light Set - Lset App Test Light Set\n target_exit_state: Disabled\n target_lightset_label: '{{ button_map[trigger.entity_id].target_lightset_label\n }}'\n target_exit_state: '{{ button_map[trigger.entity_id].target_exit_state }}'\n - action: script.turn_on\n metadata: {}\n data:\n variables:\n lightset_label: '{{ target_lightset_label }}'\n exit_state: '{{ target_exit_state }}'\n target:\n entity_id:\n - script.lightset_deactivate_disable\n mode: parallel",
"config": [
{
"name": "light set lset app test light set deactivate button",
"room": null,
"type": "input_button",
"id": {
"entity_id": "input_button.light_set_lset_app_test_light_set_deactivate",
"device_id": null
}
},
{
"name": "light set lset app test light set disable button",
"room": null,
"type": "input_button",
"id": {
"entity_id": "input_button.light_set_lset_app_test_light_set_disable",
"device_id": null
}
},
{
"name": "lightset deactivate disable script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_deactivate_disable",
"device_id": null
}
}
]
},
{
"id": "lightset | State Changed",
"automation": "- alias: lightset | State Changed\n description: '**Membership**: *Lightset Virtual Object* and an element of the Day-Dim\n App. <br> **Purpose**: React to light-set state changes and route actions to the\n appropriate action scripts that are part of the app. <br> **Note-1**: I am using\n the non-blocking form of calling the routed to scripts in the ''''choose'''' section\n so that this automation can be called again immediately (i.e., by a different\n light-set having been triggered). <br> **Note-2**: *mode: queued* is important\n as the call out to the LED set indicator script is recursive and will fail if\n mode is single. (Actually it should likely be mode: parallel if ever I use the\n feature to set a ''''start_state'''' in the scripts that turn the lights on and\n off). <br> **04/26/2025**: Fixed error in lightset strings in the trigger_map\n table. <br> **04/25/2025**: Fixed up for new naming of helpers. <br> **04/22/2025**:\n Added case for ''''Inactive'''' to set *<lightset> | Operational State* to ''''Activate''''\n <br> **Documentation** .../HomeAssistant/Documentation/doc_diagrams.odg\n\n '\n triggers:\n - trigger: state\n entity_id:\n - input_select.lightset_test_set_state\n - input_select.lightset_kitchen_state\n - input_select.lightset_living_area_state\n conditions: []\n actions:\n - variables:\n trigger_map:\n input_select.lightset_test_set_state:\n lightset: Light-Set - Day-Dim | Test Set\n operational_state_helper: input_select.lightset_test_set_operational_state\n input_select.lightset_kitchen_state:\n lightset: Light-Set - Day-Dim | Kitchen\n operational_state_helper: input_select.lightset_kitchen_operational_state\n input_select.lightset_living_area_state:\n lightset: Light-Set - Day-Dim | Living Area\n operational_state_helper: input_select.lightset_living_area_operational_state\n lightset: '{{ trigger_map[trigger.entity_id].lightset }}'\n ops_state_helper: '{{ trigger_map[trigger.entity_id].operational_state_helper\n }}'\n alias: Define Needed Variables\n - alias: Debug - Show Variables\n data:\n name: Lightset Debug\n message: 'VARIABLE: [lightset: {{ lightset }}] || VARIABLE: [ops_state_helper:\n {{ ops_state_helper }}] || VALUE: [trigger.entity_id: {{ trigger.entity_id\n }}] || VALUE: [trigger.to_state.state: {{ trigger.to_state.state }}] ||\n\n '\n action: logbook.log\n - action: script.lightset_set_state_indicators\n metadata: {}\n data:\n changed_helper: '{{ trigger.entity_id }}'\n new_state: '{{ trigger.to_state.state }}'\n alias: CALL Script to Set ESPHome LED Indicators for New State\n - alias: CASE Section | Route to Appropriate Handler Based on New State\n choose:\n - alias: CASE-0 State Changed to 'In Process - ON'\n conditions:\n - condition: template\n alias: IF State is In Process - On\n value_template: '{{ trigger.to_state.state == ''In Process - ON''}}'\n sequence:\n - alias: Turn on the Light Set\n action: script.turn_on\n data:\n entity_id: script.lightset_on_by_label\n variables:\n lightset_label: '{{ lightset }}'\n - alias: CASE-1 State Changed to 'Pending - OFF'\n conditions:\n - condition: template\n alias: IF State is Pending - OFF\n value_template: '{{ trigger.to_state.state == ''Pending - OFF''}}'\n sequence:\n - alias: Turn on Delay Timer for Light Set\n action: script.turn_on\n data:\n entity_id: script.lightset_goto_pending_off\n variables:\n lightset_label: '{{ lightset }}'\n - alias: CASE-2 State Changed to 'In Process - OFF'\n conditions:\n - condition: template\n alias: IF State is In Process - OFF\n value_template: '{{ trigger.to_state.state == ''In Process - OFF''}}'\n sequence:\n - alias: Turn off the Light Set\n action: script.turn_on\n data:\n entity_id: script.lightset_off_by_areas\n variables:\n lightset_label: '{{ lightset }}'\n - alias: CASE-3 State Changed to Cancel In Process\n conditions:\n - condition: template\n alias: IF State is Cancel In Process\n value_template: '{{ trigger.to_state.state == ''Cancel In Process''}}'\n sequence:\n - alias: Cancel any active light-set activity\n action: script.turn_on\n data:\n entity_id: script.lightset_cancel\n variables:\n lightset_label: '{{ lightset }}'\n - alias: CASE-4 State Changed to 'Inactive' from 'Cancel In Process'\n conditions:\n - condition: template\n alias: IF State went to 'Inactive' from 'Cancel In Process'\n value_template: '{{ trigger.to_state.state == ''Inactive'' and trigger.from_state.state\n == ''Cancel In Process''}}'\n sequence:\n - alias: Set Light-Set's Operational State to 'Activate.'\n action: input_select.select_option\n metadata: {}\n data:\n option: Activate\n target:\n entity_id: '{{ ops_state_helper }}'\n mode: queued",
"config": [
{
"name": "lightset test set state",
"room": null,
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_test_set_state",
"device_id": null
}
},
{
"name": "lightset kitchen state",
"room": "kitchen",
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_kitchen_state",
"device_id": null
}
},
{
"name": "lightset living area state",
"room": "living_area",
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_living_area_state",
"device_id": null
}
},
{
"name": "lightset test set operational state",
"room": null,
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_test_set_operational_state",
"device_id": null
}
},
{
"name": "lightset kitchen operational state",
"room": "kitchen",
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_kitchen_operational_state",
"device_id": null
}
},
{
"name": "lightset living area operational state",
"room": "living_area",
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_living_area_operational_state",
"device_id": null
}
},
{
"name": "lightset set state indicators script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_set_state_indicators",
"device_id": null
}
},
{
"name": "lightset on by label script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_on_by_label",
"device_id": null
}
},
{
"name": "lightset goto pending off script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_goto_pending_off",
"device_id": null
}
},
{
"name": "lightset off by areas script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_off_by_areas",
"device_id": null
}
},
{
"name": "lightset cancel script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_cancel",
"device_id": null
}
}
]
},
{
"id": "lightset | Transition Timer Expired",
"automation": "- alias: lightset | Transition Timer Expired\n description: '**Purpose**: Detect when a light-set''s transition delay timer has\n expired and take appropriate action. <br> **04/26/2025**: Fixed helper name errors.\n Added test for valid timer in loopup map. <br> **04/25/2025**: Fixed up for new\n naming of helpers and added in the two non-test light-sets. <br> **04/12/2025**:\n Initial Creation\n\n '\n triggers:\n - trigger: state\n entity_id:\n - timer.lightset_test_set_timer\n - timer.lightset_kitchen_timer\n - timer.lightset_living_area_timer\n from: null\n to: idle\n alias: When any Light-Set's timer has finished\n conditions: []\n actions:\n - variables:\n trigger_map:\n timer.lightset_test_set_timer:\n label: Light-Set - Day-Dim | Test Set\n state_helper: input_select.lightset_test_set_state\n timer.lightset_kitchen_timer:\n label: Light-Set - Day-Dim | Kitchen\n state_helper: input_select.lightset_test_set_state\n timer.lightset_living_area_timer:\n label: Light-Set - Day-Dim | Living Area\n state_helper: input_select.lightset_test_set_state\n NoMappedTimer:\n label: NoLightsetLabel\n state_helper: NoStateHelper\n timer_to_act_on: \"{% if trigger.entity_id in trigger_map %}\\n {{ trigger.entity_id\\\n \\ }}\\n{% else %}\\n NoMappedTimer\\n{% endif %}\\n\"\n target_lightset_label: '{{ trigger_map[timer_to_act_on].label }}'\n target_state_helper: '{{ trigger_map[timer_to_act_on].state_helper }}'\n - alias: Debug - Show Variables\n data:\n name: Lightset Debug\n message: 'VARIABLE: [timer_to_act_on: {{ timer_to_act_on }}] || VARIABLE: [target_lightset_label:\n {{ target_lightset_label }}] || VARIABLE: [target_state_helper: {{ target_state_helper\n }}] || VALUE: [trigger.entity_id: {{ trigger.entity_id }} ] || VALUE: [trigger.to_state.state:\n {{ trigger.to_state.state }} ] ||\n\n '\n action: logbook.log\n - alias: If we have valid timer call assess conditions script, else error\n choose:\n - alias: Call the Light-Set Assess Conditions Script.\n conditions:\n - condition: template\n value_template: '{{ timer_to_act_on != ''NoMappedTimer'' }}'\n sequence:\n - action: script.turn_on\n metadata: {}\n data:\n variables:\n lightset_label: '{{ target_lightset_label }}'\n target:\n entity_id:\n - script.lightset_assess_conditions\n default:\n - alias: No timer, report error\n sequence:\n - data:\n name: Automation | lightset Transition Timer Expired - ERROR\n message: Triggering timer - '{{ trigger.entity_id }}' - has no entry in\n trigger_map lookup table.\n action: logbook.log\n mode: parallel",
"config": [
{
"name": "lightset assess conditions script",
"room": null,
"type": "script",
"id": {
"entity_id": "script.lightset_assess_conditions",
"device_id": null
}
},
{
"name": "lightset test set state",
"room": null,
"type": "input_select",
"id": {
"entity_id": "input_select.lightset_test_set_state",
"device_id": null
}
},
{
"name": "lightset test set timer",
"room": null,
"type": "timer",
"id": {
"entity_id": "timer.lightset_test_set_timer",
"device_id": null
}
},
{
"name": "lightset kitchen timer",
"room": "kitchen",
"type": "timer",
"id": {
"entity_id": "timer.lightset_kitchen_timer",
"device_id": null
}
},
{
"name": "lightset living area timer",
"room": "living_area",
"type": "timer",
"id": {
"entity_id": "timer.lightset_living_area_timer",
"device_id": null
}
}
]
},
{
"id": "Away Random Lights by Label",
"automation": "- alias: Away Random Lights by Label\n description: 'When I''m away, randomly toggle any light tagged “Light Set Night\n Random” between night and bedtime.\n\n '\n trigger:\n - platform: time_pattern\n minutes: /5\n variables:\n lights: \"{{ states.light\\n | selectattr('attributes.label','eq','Light Set -\\\n \\ Night Random')\\n | map(attribute='entity_id')\\n | list }}\"\n condition:\n - condition: state\n entity_id: input_boolean.away_from_home\n state: 'on'\n - condition: template\n value_template: '{{ is_state(''sensor.daypart'',''nighttime'') }}\n\n '\n - condition: template\n value_template: '{{ now().strftime(''%H:%M'') < states(''input_datetime.bedtime_normal'')\n }}\n\n '\n - condition: template\n value_template: '{{ (range(0,5) | random) == 0 }}\n\n '\n action:\n - choose:\n - conditions: '{{ lights | length > 0 }}'\n sequence:\n - service: light.toggle\n target:\n entity_id: '{{ lights | random }}'\n mode: parallel",
"config": [
{
"name": "away from home",
"room": null,
"type": "input_boolean",
"id": {
"entity_id": "input_boolean.away_from_home",
"device_id": null
}
},
{
"name": "daypart sensor",
"room": null,
"type": "sensor",
"id": {
"entity_id": "sensor.daypart",
"device_id": null
}
},
{
"name": "bedtime normal",
"room": null,
"type": "input_datetime",
"id": {
"entity_id": "input_datetime.bedtime_normal",
"device_id": null
}
}
]
}
]