Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "trace": {
- "last_step": "action/0/default/3/parallel/1/sequence/10",
- "run_id": "2301e62fe47c728d5ce8b1d57c0fc5a2",
- "state": "stopped",
- "script_execution": "finished",
- "timestamp": {
- "start": "2024-04-14T16:47:09.847830+00:00",
- "finish": "2024-04-14T16:49:23.994219+00:00"
- },
- "domain": "automation",
- "item_id": "1696792357064",
- "trigger": "state of binary_sensor.hue_motion_sensor_1_motion",
- "trace": {
- "trigger/0": [
- {
- "path": "trigger/0",
- "timestamp": "2024-04-14T16:47:09.854598+00:00",
- "changed_variables": {
- "this": {
- "entity_id": "automation.sensor_light_staircase_ff",
- "state": "on",
- "attributes": {
- "id": "1696792357064",
- "last_triggered": "2024-04-14T15:39:54.674777+00:00",
- "mode": "restart",
- "current": 0,
- "friendly_name": "Sensor Light Staircase FF"
- },
- "last_changed": "2024-04-14T16:37:23.129053+00:00",
- "last_reported": "2024-04-14T16:37:23.129075+00:00",
- "last_updated": "2024-04-14T16:37:23.129053+00:00",
- "context": {
- "id": "01HVEQGXHSZ68NT2G19QY7P5NV",
- "parent_id": null,
- "user_id": null
- }
- },
- "trigger": {
- "id": "t0",
- "idx": "0",
- "alias": null,
- "platform": "state",
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "from_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "off",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:37:13.204454+00:00",
- "last_reported": "2024-04-14T16:37:13.204454+00:00",
- "last_updated": "2024-04-14T16:37:13.204454+00:00",
- "context": {
- "id": "01HVEQGKVMCAP111CCMQ3QFHCS",
- "parent_id": null,
- "user_id": null
- }
- },
- "to_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "on",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:09.847237+00:00",
- "last_reported": "2024-04-14T16:47:09.847237+00:00",
- "last_updated": "2024-04-14T16:47:09.847237+00:00",
- "context": {
- "id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "parent_id": null,
- "user_id": null
- }
- },
- "for": null,
- "attribute": null,
- "description": "state of binary_sensor.hue_motion_sensor_1_motion"
- },
- "motion_trigger": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "light_switch": {
- "entity_id": "scene.scene_staircase_ff_day"
- },
- "boolean_scenes_scripts": [],
- "end_scenes": [
- "scene.scene_staircase_ff_off"
- ],
- "time_delay": 2,
- "include_light_control": [
- "use_brightness",
- "use_transition"
- ],
- "light_brightness": 80,
- "brightness_value": 80,
- "light_colour_temperature": 5000,
- "temperature_value": [],
- "light_transition_on": 5,
- "light_transition_off": 10,
- "transition_on_value": 5,
- "transition_off_value": 10,
- "include_dynamic_lighting": [],
- "dynamic_lighting_lux_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "dynamic_lighting_max_lux": 400,
- "dynamic_lighting_min_lux": 40,
- "dynamic_lighting_max_brightness": 100,
- "dynamic_lighting_min_brightness": 0,
- "dynamic_lighting_max_colour_temp": 5000,
- "dynamic_lighting_min_colour_temp": 3000,
- "dynamic_lighting_sun_elevation_start_rising": -1.5,
- "dynamic_lighting_sun_elevation_end_rising": 15,
- "dynamic_lighting_sun_elevation_start_falling": 15,
- "dynamic_lighting_sun_elevation_end_falling": -4,
- "dynamic_lighting_heartbeat": 1,
- "dynamic_lighting_step_value": 4,
- "dynamic_lighting_dead_zone": 7,
- "include_bypass": [],
- "motion_bypass_lights_on": [],
- "motion_bypass_lights_off": [],
- "motion_bypass_lights_stop": [],
- "bypass_time_delay": 0,
- "include_bypass_auto_off": [],
- "bypass_auto_off_delay": 60,
- "include_sun": "sun_disabled",
- "sun_elevation": -1.5,
- "sun_elevation_rising": -4,
- "include_ambient": "ambient_disabled",
- "ambient_light_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "ambient_light_options": "ambient_light_option_enabled",
- "ambient_light_value": 50,
- "ambient_light_high_value": 80,
- "include_time": "time_disabled",
- "after_time": "00:00:00",
- "before_time": "00:00:00",
- "weekday_options": [
- "mon",
- "tue",
- "wed",
- "thu",
- "fri",
- "sat",
- "sun"
- ],
- "include_device_tracker": "device_tracker_disabled",
- "zone": "zone.home",
- "people": [
- "person.chris_home"
- ],
- "include_night_lights": "night_lights_enabled",
- "night_lights": {
- "entity_id": "scene.scene_staircase_ff_night"
- },
- "night_boolean_scenes_scripts": [],
- "night_time_delay": 1,
- "include_night_light_control": [
- "use_transition",
- "use_brightness",
- "if_lights_are_on_adjust_when_crossing_over"
- ],
- "night_light_brightness": 1,
- "night_brightness_value": 1,
- "night_light_colour_temperature": 5000,
- "night_temperature_value": [],
- "night_light_transition_on": 5,
- "night_light_transition_off": 10,
- "night_transition_on_value": 5,
- "night_transition_off_value": 10,
- "night_lights_conditions": [
- "sun_enabled",
- "time_enabled"
- ],
- "night_lights_entity_state": [],
- "night_lights_after_time": "21:30:00",
- "night_lights_before_time": "07:00:00",
- "night_lights_sun_elevation": -1.5,
- "night_lights_sun_elevation_rising": -4,
- "light_entities_off": [],
- "switch_entities_off": [],
- "light_entities": [],
- "switch_entities": [],
- "scene_entities": [
- "scene.scene_staircase_ff_day"
- ],
- "script_entities": [],
- "boolean_scenes_scripts_helper": [],
- "end_scene_entities": [
- "scene.scene_staircase_ff_off"
- ],
- "end_script_entities": [],
- "night_light_entities_off": [],
- "night_switch_entities_off": [],
- "night_light_entities": [],
- "night_switch_entities": [],
- "night_scene_entities": [
- "scene.scene_staircase_ff_night"
- ],
- "night_script_entities": [],
- "night_boolean_scenes_scripts_helper": [],
- "crossover_lights_light": [],
- "crossover_lights_switch": [],
- "crossover_night_lights_light_on": [],
- "crossover_night_lights_light": [],
- "crossover_night_lights_switch": [],
- "crossover_lights_light_on": []
- }
- }
- ],
- "condition/0": [
- {
- "path": "condition/0",
- "timestamp": "2024-04-14T16:47:09.854688+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/0/conditions/0": [
- {
- "path": "condition/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.854766+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/0/conditions/0/conditions/0": [
- {
- "path": "condition/0/conditions/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.854829+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/0/conditions/0/conditions/0/entity_id/0": [
- {
- "path": "condition/0/conditions/0/conditions/0/entity_id/0",
- "timestamp": "2024-04-14T16:47:09.854895+00:00",
- "result": {
- "result": true,
- "state": "on",
- "wanted_state": "on"
- }
- }
- ],
- "condition/0/conditions/0/conditions/1": [
- {
- "path": "condition/0/conditions/0/conditions/1",
- "timestamp": "2024-04-14T16:47:09.855005+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/1": [
- {
- "path": "condition/1",
- "timestamp": "2024-04-14T16:47:09.855104+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/1/conditions/0": [
- {
- "path": "condition/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.855163+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "condition/2": [
- {
- "path": "condition/2",
- "timestamp": "2024-04-14T16:47:09.855563+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/2/conditions/0": [
- {
- "path": "condition/2/conditions/0",
- "timestamp": "2024-04-14T16:47:09.855629+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "condition/3": [
- {
- "path": "condition/3",
- "timestamp": "2024-04-14T16:47:09.855940+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/3/conditions/0": [
- {
- "path": "condition/3/conditions/0",
- "timestamp": "2024-04-14T16:47:09.856007+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "condition/4": [
- {
- "path": "condition/4",
- "timestamp": "2024-04-14T16:47:09.856299+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/4/conditions/0": [
- {
- "path": "condition/4/conditions/0",
- "timestamp": "2024-04-14T16:47:09.856363+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "condition/5": [
- {
- "path": "condition/5",
- "timestamp": "2024-04-14T16:47:09.856644+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "condition/5/conditions/0": [
- {
- "path": "condition/5/conditions/0",
- "timestamp": "2024-04-14T16:47:09.856706+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0": [
- {
- "path": "action/0",
- "timestamp": "2024-04-14T16:47:09.857513+00:00",
- "changed_variables": {
- "context": {
- "id": "01HVER2TGQBE0S018FQH70ZMDX",
- "parent_id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "user_id": null
- }
- },
- "result": {
- "choice": "default"
- }
- }
- ],
- "action/0/choose/0": [
- {
- "path": "action/0/choose/0",
- "timestamp": "2024-04-14T16:47:09.869227+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/choose/0/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.869351+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.869426+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/0/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.869490+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/1": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/1",
- "timestamp": "2024-04-14T16:47:09.870688+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/1/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.870772+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2",
- "timestamp": "2024-04-14T16:47:09.871114+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2/conditions/0",
- "timestamp": "2024-04-14T16:47:09.871187+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2/conditions/1": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2/conditions/1",
- "timestamp": "2024-04-14T16:47:09.871534+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2/conditions/2": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2/conditions/2",
- "timestamp": "2024-04-14T16:47:09.871829+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2/conditions/2/conditions/0": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2/conditions/2/conditions/0",
- "timestamp": "2024-04-14T16:47:09.871899+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/choose/0/conditions/0/conditions/2/conditions/2/conditions/1": [
- {
- "path": "action/0/choose/0/conditions/0/conditions/2/conditions/2/conditions/1",
- "timestamp": "2024-04-14T16:47:09.872183+00:00",
- "result": {
- "after": {
- "__type": "<class 'datetime.time'>",
- "isoformat": "21:30:00"
- },
- "now_time": {
- "__type": "<class 'datetime.time'>",
- "isoformat": "18:47:09.872245"
- },
- "before": {
- "__type": "<class 'datetime.time'>",
- "isoformat": "07:00:00"
- },
- "result": false
- }
- }
- ],
- "action/0/default/0": [
- {
- "path": "action/0/default/0",
- "timestamp": "2024-04-14T16:47:09.880165+00:00"
- }
- ],
- "action/0/default/0/choose/0": [
- {
- "path": "action/0/default/0/choose/0",
- "timestamp": "2024-04-14T16:47:09.880770+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/0/choose/0/conditions/0": [
- {
- "path": "action/0/default/0/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.880836+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/0/choose/1": [
- {
- "path": "action/0/default/0/choose/1",
- "timestamp": "2024-04-14T16:47:09.880931+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/0/choose/1/conditions/0": [
- {
- "path": "action/0/default/0/choose/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.880982+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/1": [
- {
- "path": "action/0/default/1",
- "timestamp": "2024-04-14T16:47:09.881114+00:00"
- }
- ],
- "action/0/default/1/choose/0": [
- {
- "path": "action/0/default/1/choose/0",
- "timestamp": "2024-04-14T16:47:09.882573+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/1/choose/0/conditions/0": [
- {
- "path": "action/0/default/1/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.882632+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/1/choose/1": [
- {
- "path": "action/0/default/1/choose/1",
- "timestamp": "2024-04-14T16:47:09.882715+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/1/choose/1/conditions/0": [
- {
- "path": "action/0/default/1/choose/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.882780+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2": [
- {
- "path": "action/0/default/2",
- "timestamp": "2024-04-14T16:47:09.882902+00:00"
- }
- ],
- "action/0/default/2/choose/0": [
- {
- "path": "action/0/default/2/choose/0",
- "timestamp": "2024-04-14T16:47:09.883965+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2/choose/0/conditions/0": [
- {
- "path": "action/0/default/2/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.884010+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2/choose/1": [
- {
- "path": "action/0/default/2/choose/1",
- "timestamp": "2024-04-14T16:47:09.884072+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2/choose/1/conditions/0": [
- {
- "path": "action/0/default/2/choose/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.884113+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2/choose/2": [
- {
- "path": "action/0/default/2/choose/2",
- "timestamp": "2024-04-14T16:47:09.884167+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/2/choose/2/conditions/0": [
- {
- "path": "action/0/default/2/choose/2/conditions/0",
- "timestamp": "2024-04-14T16:47:09.884201+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3": [
- {
- "path": "action/0/default/3",
- "timestamp": "2024-04-14T16:47:09.884291+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/0",
- "timestamp": "2024-04-14T16:47:09.885956+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.886087+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/1": [
- {
- "path": "action/0/default/3/parallel/0/sequence/1",
- "timestamp": "2024-04-14T16:47:09.886381+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/1/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/1/choose/0",
- "timestamp": "2024-04-14T16:47:09.886622+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/1/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/1/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.886666+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/2": [
- {
- "path": "action/0/default/3/parallel/0/sequence/2",
- "timestamp": "2024-04-14T16:47:09.886904+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/2/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/2/choose/0",
- "timestamp": "2024-04-14T16:47:09.887134+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/2/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/2/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.887175+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/3": [
- {
- "path": "action/0/default/3/parallel/0/sequence/3",
- "timestamp": "2024-04-14T16:47:09.887403+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/3/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/3/choose/0",
- "timestamp": "2024-04-14T16:47:09.887833+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/3/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/3/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.887877+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/4": [
- {
- "path": "action/0/default/3/parallel/0/sequence/4",
- "timestamp": "2024-04-14T16:47:09.888113+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/4/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/4/choose/0",
- "timestamp": "2024-04-14T16:47:09.888340+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/4/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/4/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.888381+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/5": [
- {
- "path": "action/0/default/3/parallel/0/sequence/5",
- "timestamp": "2024-04-14T16:47:09.888586+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/5/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/5/choose/0",
- "timestamp": "2024-04-14T16:47:09.888732+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/5/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/5/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.888765+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/6": [
- {
- "path": "action/0/default/3/parallel/0/sequence/6",
- "timestamp": "2024-04-14T16:47:09.888949+00:00"
- }
- ],
- "action/0/default/3/parallel/0/sequence/6/choose/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/6/choose/0",
- "timestamp": "2024-04-14T16:47:09.889095+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/6/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/0/sequence/6/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.889130+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/0/sequence/7": [
- {
- "path": "action/0/default/3/parallel/0/sequence/7",
- "timestamp": "2024-04-14T16:47:09.889311+00:00",
- "result": {
- "stop": "Stop the automation",
- "error": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0",
- "timestamp": "2024-04-14T16:47:09.889917+00:00"
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/0",
- "timestamp": "2024-04-14T16:47:09.890550+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.890593+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/1": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/1",
- "timestamp": "2024-04-14T16:47:09.890777+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/1/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.890814+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/2": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/2",
- "timestamp": "2024-04-14T16:47:09.890974+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/2/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/2/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891008+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/3": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/3",
- "timestamp": "2024-04-14T16:47:09.891158+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/3/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/3/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891193+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/4": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/4",
- "timestamp": "2024-04-14T16:47:09.891340+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/4/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/4/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891373+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/5": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/5",
- "timestamp": "2024-04-14T16:47:09.891530+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/5/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/5/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891563+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/6": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/6",
- "timestamp": "2024-04-14T16:47:09.891704+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/6/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/6/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891738+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/7": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/7",
- "timestamp": "2024-04-14T16:47:09.891876+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/0/choose/7/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/0/choose/7/conditions/0",
- "timestamp": "2024-04-14T16:47:09.891908+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1",
- "timestamp": "2024-04-14T16:47:09.892080+00:00",
- "result": {
- "choice": 1
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/0",
- "timestamp": "2024-04-14T16:47:09.892264+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.892299+00:00",
- "result": {
- "result": false,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/1": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/1",
- "timestamp": "2024-04-14T16:47:09.892475+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/1/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/1/conditions/0",
- "timestamp": "2024-04-14T16:47:09.892507+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/1/sequence/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/1/sequence/0",
- "timestamp": "2024-04-14T16:47:09.892751+00:00",
- "result": {
- "params": {
- "domain": "scene",
- "service": "turn_on",
- "service_data": {
- "transition": 5,
- "entity_id": [
- "scene.scene_staircase_ff_day"
- ]
- },
- "target": {
- "entity_id": [
- "scene.scene_staircase_ff_day"
- ]
- }
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/1/choose/1/sequence/1": [
- {
- "path": "action/0/default/3/parallel/1/sequence/1/choose/1/sequence/1",
- "timestamp": "2024-04-14T16:47:09.898527+00:00",
- "result": {
- "params": {
- "domain": "input_boolean",
- "service": "turn_on",
- "service_data": {
- "entity_id": []
- },
- "target": {}
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/2": [
- {
- "path": "action/0/default/3/parallel/1/sequence/2",
- "timestamp": "2024-04-14T16:47:09.898964+00:00",
- "result": {
- "params": {
- "domain": "switch",
- "service": "turn_on",
- "service_data": {},
- "target": {
- "entity_id": []
- }
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/3": [
- {
- "path": "action/0/default/3/parallel/1/sequence/3",
- "timestamp": "2024-04-14T16:47:09.899279+00:00",
- "result": {
- "params": {
- "domain": "script",
- "service": "turn_on",
- "service_data": {},
- "target": {
- "entity_id": []
- }
- },
- "running_script": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/4": [
- {
- "path": "action/0/default/3/parallel/1/sequence/4",
- "timestamp": "2024-04-14T16:47:09.899587+00:00"
- }
- ],
- "action/0/default/3/parallel/1/sequence/4/choose/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/4/choose/0",
- "timestamp": "2024-04-14T16:47:09.899724+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/4/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/4/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.899750+00:00",
- "result": {
- "result": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/5": [
- {
- "path": "action/0/default/3/parallel/1/sequence/5",
- "timestamp": "2024-04-14T16:47:09.899810+00:00",
- "changed_variables": {
- "wait": {
- "remaining": null,
- "trigger": {
- "id": "0",
- "idx": "0",
- "alias": null,
- "platform": "state",
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "from_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "on",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:09.847237+00:00",
- "last_reported": "2024-04-14T16:47:09.847237+00:00",
- "last_updated": "2024-04-14T16:47:09.847237+00:00",
- "context": {
- "id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "parent_id": null,
- "user_id": null
- }
- },
- "to_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "off",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:23.973513+00:00",
- "last_reported": "2024-04-14T16:47:23.973513+00:00",
- "last_updated": "2024-04-14T16:47:23.973513+00:00",
- "context": {
- "id": "01HVER38A50E551HW4M0A6Y3CP",
- "parent_id": null,
- "user_id": null
- }
- },
- "for": null,
- "attribute": null,
- "description": "state of binary_sensor.hue_motion_sensor_1_motion"
- }
- }
- },
- "result": {
- "choice": 0
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/5/choose/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/5/choose/0",
- "timestamp": "2024-04-14T16:47:09.899888+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/5/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/5/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:47:09.899913+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/5/choose/0/conditions/0/entity_id/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/5/choose/0/conditions/0/entity_id/0",
- "timestamp": "2024-04-14T16:47:09.899934+00:00",
- "result": {
- "result": true,
- "state": "on",
- "wanted_state": "on"
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/5/choose/0/sequence/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/5/choose/0/sequence/0",
- "timestamp": "2024-04-14T16:47:09.900065+00:00",
- "changed_variables": {
- "wait": {
- "remaining": null,
- "trigger": {
- "id": "0",
- "idx": "0",
- "alias": null,
- "platform": "state",
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "from_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "on",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:09.847237+00:00",
- "last_reported": "2024-04-14T16:47:09.847237+00:00",
- "last_updated": "2024-04-14T16:47:09.847237+00:00",
- "context": {
- "id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "parent_id": null,
- "user_id": null
- }
- },
- "to_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "off",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:23.973513+00:00",
- "last_reported": "2024-04-14T16:47:23.973513+00:00",
- "last_updated": "2024-04-14T16:47:23.973513+00:00",
- "context": {
- "id": "01HVER38A50E551HW4M0A6Y3CP",
- "parent_id": null,
- "user_id": null
- }
- },
- "for": null,
- "attribute": null,
- "description": "state of binary_sensor.hue_motion_sensor_1_motion"
- }
- }
- },
- "result": {
- "wait": {
- "remaining": null,
- "trigger": {
- "id": "0",
- "idx": "0",
- "alias": null,
- "platform": "state",
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "from_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "on",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:09.847237+00:00",
- "last_reported": "2024-04-14T16:47:09.847237+00:00",
- "last_updated": "2024-04-14T16:47:09.847237+00:00",
- "context": {
- "id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "parent_id": null,
- "user_id": null
- }
- },
- "to_state": {
- "entity_id": "binary_sensor.hue_motion_sensor_1_motion",
- "state": "off",
- "attributes": {
- "device_class": "motion",
- "friendly_name": "Hue motion sensor 1 Motion"
- },
- "last_changed": "2024-04-14T16:47:23.973513+00:00",
- "last_reported": "2024-04-14T16:47:23.973513+00:00",
- "last_updated": "2024-04-14T16:47:23.973513+00:00",
- "context": {
- "id": "01HVER38A50E551HW4M0A6Y3CP",
- "parent_id": null,
- "user_id": null
- }
- },
- "for": null,
- "attribute": null,
- "description": "state of binary_sensor.hue_motion_sensor_1_motion"
- }
- }
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/6": [
- {
- "path": "action/0/default/3/parallel/1/sequence/6",
- "timestamp": "2024-04-14T16:47:23.975167+00:00",
- "result": {
- "delay": 120,
- "done": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/7": [
- {
- "path": "action/0/default/3/parallel/1/sequence/7",
- "timestamp": "2024-04-14T16:49:23.976864+00:00",
- "result": {
- "choice": 0
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/7/choose/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/7/choose/0",
- "timestamp": "2024-04-14T16:49:23.977240+00:00",
- "result": {
- "result": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/7/choose/0/conditions/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/7/choose/0/conditions/0",
- "timestamp": "2024-04-14T16:49:23.977331+00:00",
- "result": {
- "result": true,
- "entities": []
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/7/choose/0/sequence/0": [
- {
- "path": "action/0/default/3/parallel/1/sequence/7/choose/0/sequence/0",
- "timestamp": "2024-04-14T16:49:23.978018+00:00",
- "result": {
- "params": {
- "domain": "light",
- "service": "turn_off",
- "service_data": {
- "transition": 10,
- "entity_id": []
- },
- "target": {
- "entity_id": []
- }
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/7/choose/0/sequence/1": [
- {
- "path": "action/0/default/3/parallel/1/sequence/7/choose/0/sequence/1",
- "timestamp": "2024-04-14T16:49:23.979458+00:00",
- "result": {
- "params": {
- "domain": "scene",
- "service": "turn_on",
- "service_data": {
- "entity_id": [
- "scene.scene_staircase_ff_off"
- ],
- "transition": 10
- },
- "target": {}
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/8": [
- {
- "path": "action/0/default/3/parallel/1/sequence/8",
- "timestamp": "2024-04-14T16:49:23.988861+00:00",
- "result": {
- "params": {
- "domain": "switch",
- "service": "turn_off",
- "service_data": {},
- "target": {
- "entity_id": []
- }
- },
- "running_script": false
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/9": [
- {
- "path": "action/0/default/3/parallel/1/sequence/9",
- "timestamp": "2024-04-14T16:49:23.989920+00:00",
- "result": {
- "params": {
- "domain": "script",
- "service": "turn_on",
- "service_data": {
- "entity_id": []
- },
- "target": {}
- },
- "running_script": true
- }
- }
- ],
- "action/0/default/3/parallel/1/sequence/10": [
- {
- "path": "action/0/default/3/parallel/1/sequence/10",
- "timestamp": "2024-04-14T16:49:23.990779+00:00",
- "result": {
- "params": {
- "domain": "input_boolean",
- "service": "turn_off",
- "service_data": {
- "entity_id": []
- },
- "target": {}
- },
- "running_script": false
- }
- }
- ]
- },
- "config": {
- "mode": "restart",
- "max_exceeded": "silent",
- "variables": {
- "motion_trigger": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "light_switch": {
- "entity_id": "scene.scene_staircase_ff_day"
- },
- "boolean_scenes_scripts": [],
- "end_scenes": [
- "scene.scene_staircase_ff_off"
- ],
- "time_delay": 2,
- "include_light_control": [
- "use_brightness",
- "use_transition"
- ],
- "light_brightness": 80,
- "brightness_value": "{{ iif ('use_brightness' in include_light_control , light_brightness, ) }}",
- "light_colour_temperature": 5000,
- "temperature_value": "{{ iif ('use_colour_temperature' in include_light_control , light_colour_temperature, [] ) }}",
- "light_transition_on": 5,
- "light_transition_off": 10,
- "transition_on_value": "{{ iif ('use_transition' in include_light_control, light_transition_on, ) }}",
- "transition_off_value": "{{ iif ('use_transition' in include_light_control, light_transition_off, ) }}",
- "include_dynamic_lighting": [],
- "dynamic_lighting_lux_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "dynamic_lighting_max_lux": 400,
- "dynamic_lighting_min_lux": 40,
- "dynamic_lighting_max_brightness": 100,
- "dynamic_lighting_min_brightness": 0,
- "dynamic_lighting_max_colour_temp": 5000,
- "dynamic_lighting_min_colour_temp": 3000,
- "dynamic_lighting_sun_elevation_start_rising": -1.5,
- "dynamic_lighting_sun_elevation_end_rising": 15,
- "dynamic_lighting_sun_elevation_start_falling": 15,
- "dynamic_lighting_sun_elevation_end_falling": -4,
- "dynamic_lighting_heartbeat": 1,
- "dynamic_lighting_step_value": 4,
- "dynamic_lighting_dead_zone": 7,
- "include_bypass": [],
- "motion_bypass_lights_on": [],
- "motion_bypass_lights_off": [],
- "motion_bypass_lights_stop": [],
- "bypass_time_delay": 0,
- "include_bypass_auto_off": [],
- "bypass_auto_off_delay": 60,
- "include_sun": "sun_disabled",
- "sun_elevation": -1.5,
- "sun_elevation_rising": -4,
- "include_ambient": "ambient_disabled",
- "ambient_light_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "ambient_light_options": "ambient_light_option_enabled",
- "ambient_light_value": 50,
- "ambient_light_high_value": 80,
- "include_time": "time_disabled",
- "after_time": "00:00:00",
- "before_time": "00:00:00",
- "weekday_options": [
- "mon",
- "tue",
- "wed",
- "thu",
- "fri",
- "sat",
- "sun"
- ],
- "include_device_tracker": "device_tracker_disabled",
- "zone": "zone.home",
- "people": [
- "person.chris_home"
- ],
- "include_night_lights": "night_lights_enabled",
- "night_lights": {
- "entity_id": "scene.scene_staircase_ff_night"
- },
- "night_boolean_scenes_scripts": [],
- "night_time_delay": 1,
- "include_night_light_control": [
- "use_transition",
- "use_brightness",
- "if_lights_are_on_adjust_when_crossing_over"
- ],
- "night_light_brightness": 1,
- "night_brightness_value": "{{ iif ('use_brightness' in include_night_light_control , night_light_brightness, ) }}",
- "night_light_colour_temperature": 5000,
- "night_temperature_value": "{{ iif ('use_colour_temperature' in include_night_light_control , night_light_colour_temperature, [] ) }}",
- "night_light_transition_on": 5,
- "night_light_transition_off": 10,
- "night_transition_on_value": "{{ iif ('use_transition' in include_night_light_control, night_light_transition_on, ) }}",
- "night_transition_off_value": "{{ iif ('use_transition' in include_night_light_control, night_light_transition_off, ) }}",
- "night_lights_conditions": [
- "sun_enabled",
- "time_enabled"
- ],
- "night_lights_entity_state": [],
- "night_lights_after_time": "21:30:00",
- "night_lights_before_time": "07:00:00",
- "night_lights_sun_elevation": -1.5,
- "night_lights_sun_elevation_rising": -4,
- "light_entities_off": "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}",
- "switch_entities_off": "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'switch') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}",
- "light_entities": "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}",
- "switch_entities": "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}",
- "scene_entities": "{% set a = light_switch.entity_id %} {% if boolean_scenes_scripts == [] %}\n {{ expand(a) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}\n{% elif is_state(boolean_scenes_scripts, 'off') %}\n {{ expand(a) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "script_entities": "{% set a = light_switch.entity_id %} {% if boolean_scenes_scripts == [] %}\n {{ expand(a) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}\n{% elif is_state(boolean_scenes_scripts, 'off') %}\n {{ expand(a) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "boolean_scenes_scripts_helper": "{% if boolean_scenes_scripts | length > 0 and states(boolean_scenes_scripts) == 'off' %}\n {{ boolean_scenes_scripts }}\n{% else %}\n []\n{% endif %}",
- "end_scene_entities": "{{ end_scenes | select('match', '^scene\\..*') | list }}",
- "end_script_entities": "{{ end_scenes | select('match', '^script\\..*') | list }}",
- "night_light_entities_off": "{% set b = night_lights and night_lights.entity_id %} {% if b %}\n {{ expand(b) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_switch_entities_off": "{% set b = night_lights and night_lights.entity_id %} {% if b %}\n {{ expand(b) | selectattr('domain', 'eq', 'switch') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_light_entities": "{% set b = night_lights and night_lights.entity_id %} {% if b %}\n {{ expand(b) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_switch_entities": "{% set b = night_lights and night_lights.entity_id %} {% if b %}\n {{ expand(b) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_scene_entities": "{% set b = night_lights and night_lights.entity_id %} {% if night_boolean_scenes_scripts == [] %}\n {{ expand(b) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}\n{% elif is_state(night_boolean_scenes_scripts, 'off') %}\n {{ expand(b) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_script_entities": "{% set b = night_lights and night_lights.entity_id %} {% if night_boolean_scenes_scripts == [] %}\n {{ expand(b) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}\n{% elif is_state(night_boolean_scenes_scripts, 'off') %}\n {{ expand(b) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "night_boolean_scenes_scripts_helper": "{% if night_boolean_scenes_scripts | length > 0 and states(night_boolean_scenes_scripts) == 'off' %}\n {{ night_boolean_scenes_scripts }}\n{% else %}\n []\n{% endif %}",
- "crossover_lights_light": "{% set a = light_switch.entity_id %} {% set b = night_lights and night_lights.entity_id %} {% if a and b %}\n {{ expand(a) | reject('in', expand(b)) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "crossover_lights_switch": "{% set a = light_switch.entity_id %} {% set b = night_lights and night_lights.entity_id %} {% if a and b %}\n {{ expand(a) | reject('in', expand(b)) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "crossover_night_lights_light_on": "{% set b = night_lights and night_lights.entity_id %} {% if b %}\n {{ expand(b) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "crossover_night_lights_light": "{% set a = light_switch.entity_id %} {% set b = night_lights and night_lights.entity_id %} {% if a and b %}\n {{ expand(b) | reject('in', expand(a)) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "crossover_night_lights_switch": "{% set a = light_switch.entity_id %} {% set b = night_lights and night_lights.entity_id %} {% if a and b %}\n {{ expand(b) | reject('in', expand(a)) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}",
- "crossover_lights_light_on": "{% set a = light_switch.entity_id %} {% if a %}\n {{ expand(a) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}\n{% else %}\n []\n{% endif %}"
- },
- "trigger": [
- {
- "platform": "state",
- "id": "t0",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "from": "off",
- "to": "on"
- },
- {
- "platform": "numeric_state",
- "id": "t1",
- "entity_id": "sun.sun",
- "attribute": "elevation",
- "below": -1.5
- },
- {
- "platform": "numeric_state",
- "id": "t2",
- "entity_id": "sensor.hue_motion_sensor_1_illuminance",
- "below": 50
- },
- {
- "platform": "time",
- "id": "t3",
- "at": "00:00:00"
- },
- {
- "platform": "state",
- "id": "t4",
- "entity_id": [],
- "from": "off",
- "to": "on"
- },
- {
- "platform": "time",
- "id": "t5",
- "at": "21:30:00"
- },
- {
- "platform": "numeric_state",
- "id": "t6",
- "entity_id": "sun.sun",
- "attribute": "elevation",
- "below": -1.5
- },
- {
- "platform": "state",
- "id": "t7_on",
- "entity_id": [],
- "from": "off",
- "to": "on"
- },
- {
- "platform": "state",
- "id": "t7_off",
- "entity_id": [],
- "from": "off",
- "to": "on"
- },
- {
- "platform": "state",
- "id": "t7_stop",
- "entity_id": [],
- "from": "off",
- "to": "on"
- },
- {
- "platform": "state",
- "id": "t8_on",
- "entity_id": [],
- "from": "on",
- "to": "off"
- },
- {
- "platform": "state",
- "id": "t8_off",
- "entity_id": [],
- "from": "on",
- "to": "off"
- },
- {
- "platform": "state",
- "id": "t8_stop",
- "entity_id": [],
- "from": "on",
- "to": "off"
- },
- {
- "platform": "numeric_state",
- "id": "t9",
- "entity_id": "sun.sun",
- "attribute": "elevation",
- "above": -4
- },
- {
- "platform": "numeric_state",
- "id": "t10",
- "entity_id": "sensor.hue_motion_sensor_1_illuminance",
- "above": 80
- },
- {
- "platform": "time",
- "id": "t11",
- "at": "00:00:00"
- },
- {
- "platform": "state",
- "id": "t12",
- "entity_id": [],
- "from": "on",
- "to": "off"
- },
- {
- "platform": "time",
- "id": "t13",
- "at": "07:00:00"
- },
- {
- "platform": "numeric_state",
- "id": "t14",
- "entity_id": "sun.sun",
- "attribute": "elevation",
- "above": -4
- },
- {
- "platform": "homeassistant",
- "id": "t15",
- "event": "start"
- }
- ],
- "condition": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "trigger",
- "id": "t0"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "state": "on",
- "match": "any"
- },
- "{{ include_sun == 'sun_enabled' }}",
- {
- "condition": "trigger",
- "id": "t1"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "state": "on",
- "match": "any"
- },
- "{{ include_ambient == 'ambient_enabled' }}",
- {
- "condition": "trigger",
- "id": "t2"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "state": "on",
- "match": "any"
- },
- "{{ include_time == 'time_enabled' }}",
- {
- "condition": "trigger",
- "id": "t3"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t4"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'entity_state_enabled' in night_lights_conditions }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t5"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'time_enabled' in night_lights_conditions }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t6"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'sun_enabled' in night_lights_conditions }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_on"
- },
- "{{ 'bypass_enabled_turn_on' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_off"
- },
- "{{ 'bypass_enabled_turn_off' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_stop"
- },
- "{{ 'bypass_enabled_stop' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t8_on"
- },
- "{{ 'bypass_enabled_turn_on' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t8_off"
- },
- "{{ 'bypass_enabled_turn_off' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t8_stop"
- },
- "{{ 'bypass_enabled_stop' in include_bypass }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t9"
- },
- "{{ include_sun == 'sun_enabled' }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t10"
- },
- "{{ include_ambient == 'ambient_enabled' }}",
- "{{ ambient_light_options == 'ambient_light_option_disabled' }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t11"
- },
- "{{ include_time == 'time_enabled' }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t12"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'entity_state_enabled' in night_lights_conditions }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t13"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'time_enabled' in night_lights_conditions }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t14"
- },
- "{{ include_night_lights == 'night_lights_enabled' }}",
- "{{ 'sun_enabled' in night_lights_conditions }}",
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{{ 'manage_scripts_crossing_over' in include_night_light_control }}"
- },
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t15"
- },
- {
- "condition": "or",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- },
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "trigger",
- "id": "t15"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}",
- {
- "condition": "trigger",
- "id": "t15"
- },
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ include_bypass == [] }}",
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "trigger",
- "id": [
- "t7_on",
- "t7_off",
- "t7_stop",
- "t8_on",
- "t8_off",
- "t8_stop",
- "t15"
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ include_sun == 'sun_disabled' }}",
- "{{ include_sun == 'sun_enabled_night_lights' }}",
- "{{ (include_sun == 'sun_enabled') and (is_state_attr('sun.sun', 'rising', false)) and (state_attr('sun.sun','elevation') <= sun_elevation | float(90)) }}",
- "{{ (include_sun == 'sun_enabled') and (is_state_attr('sun.sun', 'rising', true)) and (state_attr('sun.sun','elevation') <= sun_elevation_rising | float(90)) }}",
- {
- "condition": "trigger",
- "id": [
- "t7_on",
- "t7_off",
- "t7_stop",
- "t8_on",
- "t8_off",
- "t8_stop",
- "t9"
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ include_ambient == 'ambient_disabled' }}",
- "{{ ambient_light_sensor == [] }}",
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_value | int) }}",
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) and ((include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and ((include_night_lights == 'night_lights_enabled') and (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}",
- {
- "condition": "and",
- "conditions": [
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) }}",
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ (include_ambient == 'ambient_enabled') and ( ambient_light_options == 'ambient_light_option_enabled' ) }}",
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts != [] %}\n {{ is_state(boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ (include_ambient == 'ambient_enabled') and ( ambient_light_options == 'ambient_light_option_enabled' ) }}",
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts != [] %}\n {{ is_state(night_boolean_scenes_scripts, 'on') }}\n{% endif %}"
- }
- ]
- },
- {
- "condition": "trigger",
- "id": [
- "t7_on",
- "t7_off",
- "t7_stop",
- "t8_on",
- "t8_off",
- "t8_stop",
- "t10"
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ include_time == 'time_disabled' }}",
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "time",
- "after": "00:00:00",
- "before": "00:00:00",
- "weekday": [
- "mon",
- "tue",
- "wed",
- "thu",
- "fri",
- "sat",
- "sun"
- ]
- },
- "{{ include_time == 'time_enabled' }}"
- ]
- },
- {
- "condition": "trigger",
- "id": [
- "t7_on",
- "t7_off",
- "t7_stop",
- "t8_on",
- "t8_off",
- "t8_stop",
- "t11"
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ include_device_tracker == 'device_tracker_disabled' }}",
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "numeric_state",
- "entity_id": "zone.home",
- "above": 0
- },
- "{{ include_device_tracker == 'zone_enabled' }}"
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ (state_attr(zone, 'persons') + people) | count != dict.fromkeys(state_attr(zone, 'persons') + people) | count }}",
- "{{ include_device_tracker == 'zone_people_enabled' }}"
- ]
- },
- {
- "condition": "trigger",
- "id": [
- "t7_on",
- "t7_off",
- "t7_stop",
- "t8_on",
- "t8_off",
- "t8_stop"
- ]
- }
- ]
- }
- ],
- "action": [
- {
- "choose": [
- {
- "alias": "Check if the night lights are enabled and within the night lights conditions",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- {
- "alias": "Check if night lights is enabled",
- "condition": "or",
- "conditions": [
- "{{ 'night_lights_enabled' in include_night_lights }}"
- ]
- },
- {
- "alias": "Check if night lights entity state is enabled",
- "condition": "or",
- "conditions": [
- "{{ ('time_enabled' in night_lights_conditions) and not ('entity_state_enabled' in night_lights_conditions) }}",
- "{{ ('sun_enabled' in night_lights_conditions) and not ('entity_state_enabled' in night_lights_conditions) }}",
- {
- "condition": "and",
- "conditions": [
- "{{ 'entity_state_enabled' in night_lights_conditions }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "on",
- "match": "any"
- }
- ]
- }
- ]
- },
- {
- "alias": "Check if night lights time is enabled",
- "condition": "or",
- "conditions": [
- "{{ ('entity_state_enabled' in night_lights_conditions) and not ('time_enabled' in night_lights_conditions) }}",
- "{{ ('sun_enabled' in night_lights_conditions) and not ('time_enabled' in night_lights_conditions) }}",
- {
- "condition": "and",
- "conditions": [
- "{{ 'time_enabled' in night_lights_conditions }}",
- {
- "condition": "time",
- "after": "21:30:00",
- "before": "07:00:00"
- }
- ]
- }
- ]
- },
- {
- "alias": "Check if night lights sun is enabled",
- "condition": "or",
- "conditions": [
- "{{ ('entity_state_enabled' in night_lights_conditions) and not ('sun_enabled' in night_lights_conditions) }}",
- "{{ ('time_enabled' in night_lights_conditions) and not ('sun_enabled' in night_lights_conditions) }}",
- "{{ ('sun_enabled' in night_lights_conditions) and (((is_state_attr('sun.sun', 'rising', false)) and (state_attr('sun.sun','elevation') <= night_lights_sun_elevation | float(90))) or ((is_state_attr('sun.sun', 'rising', true)) and (state_attr('sun.sun','elevation') <= night_lights_sun_elevation_rising | float(90)))) }}"
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "By-pass is turned on & check by-pass option - turn lights off",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_off"
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ night_switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- },
- {
- "alias": "By-pass is turned on & check by-pass option - Keep the current lights state",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_stop"
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "By-pass is turned off & check if the motion trigger is off",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t8_on",
- "t8_off",
- "t8_stop"
- ]
- },
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "all",
- "state": "off"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ night_switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Motion trigger is off and check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "By-pass is turned off & check if the motion trigger is on",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t8_on",
- "t8_off",
- "t8_stop"
- ]
- },
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "any",
- "state": "on"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off and check conditions if enabled ",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ (include_sun == 'sun_enabled') and (state_attr('sun.sun','elevation') >= sun_elevation | float(90)) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_disabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) and (expand(night_lights.entity_id) | selectattr('state', '==', 'off') | list | count > 0) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) and (is_state(night_boolean_scenes_scripts, 'off')) }}",
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "time",
- "after": "00:00:00",
- "before": "00:00:00"
- },
- "{{ include_time == 'time_enabled' }}"
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ night_switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Motion trigger is on and check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Sun, Ambient Light Sensor & time above setting to turn off",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t9",
- "t10",
- "t11"
- ]
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ night_switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the input boolean night lights",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Turn off normal lights when trigger by start night lights conditions",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t4",
- "t5",
- "t6"
- ]
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "light - switch - scene - script is ON",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or (is_state(boolean_scenes_scripts, 'on')) }}"
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ crossover_lights_light }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ crossover_lights_light }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ crossover_lights_switch }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "choose": [
- {
- "alias": "If adjust light settings when crossing over if lights are ON is selected in night light control",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'if_lights_are_on_adjust_when_crossing_over' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the input boolean normal lights",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "choose": [
- {
- "alias": "Set the transition and brightness for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "brightness_pct": "{{ night_brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition, brightness and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "brightness_pct": "{{ night_brightness_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "brightness_pct": "{{ night_brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_night_lights_light_on }}"
- },
- "data": {
- "brightness_pct": "{{ night_brightness_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "light - switch - scene - script is ON",
- "conditions": [
- "{{ 'manage_scripts_crossing_over' in include_night_light_control }}",
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0) or (expand(night_lights.entity_id) | selectattr('state', '==', 'off') | list | count > 0) or (is_state(boolean_scenes_scripts, 'off')) }}"
- ],
- "sequence": [
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "Safe Guard when HA restarts",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t15"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off and check conditions if enabled ",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Small time delay required",
- "delay": {
- "seconds": 1
- }
- }
- ]
- },
- {
- "alias": "Check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass auto off is enabled and preform the correct",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Set the transition for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and brightness for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "brightness_pct": "{{ night_brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition, brightness and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}",
- "brightness_pct": "{{ night_brightness_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "brightness_pct": "{{ night_brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness and colour temperature for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' in include_night_light_control) and ('use_colour_temperature' in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- },
- "data": {
- "brightness_pct": "{{ night_brightness_value }}",
- "kelvin": "{{ night_temperature_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the default for the night lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_night_light_control) and ('use_brightness' not in include_night_light_control) and ('use_colour_temperature' not in include_night_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ night_light_entities_off }}"
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Check if normal lights scenes or scripts helper is on - This is for scenes only when crossing over",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{% if boolean_scenes_scripts == [] %}\n false\n{% elif is_state(boolean_scenes_scripts, 'on') %}\n true\n{% else %}\n false\n{% endif %}"
- }
- ],
- "sequence": null
- },
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn on the night scenes",
- "service": "scene.turn_on",
- "target": {
- "entity_id": "{{ night_scene_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_on_value }}"
- }
- },
- {
- "alias": "Turn on the boolean for scenes and scripts",
- "service": "input_boolean.turn_on",
- "data": {
- "entity_id": "{{ night_boolean_scenes_scripts_helper }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn on the night scenes",
- "service": "scene.turn_on",
- "target": {
- "entity_id": "{{ night_scene_entities }}"
- }
- },
- {
- "alias": "Turn on the boolean for scenes and scripts",
- "service": "input_boolean.turn_on",
- "data": {
- "entity_id": "{{ night_boolean_scenes_scripts_helper }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn on the night switches",
- "service": "switch.turn_on",
- "target": {
- "entity_id": "{{ night_switch_entities_off }}"
- }
- },
- {
- "alias": "Turn on the night scripts",
- "service": "script.turn_on",
- "target": {
- "entity_id": "{{ night_script_entities }}"
- }
- },
- {
- "choose": [
- {
- "alias": "By-pass is enabled & check by-pass option - turn lights on",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_on"
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Check if the trigger is on and wait for it to go off",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "state": "on",
- "match": "any"
- }
- ],
- "sequence": [
- {
- "alias": "Wait until motion sensor is off",
- "wait_for_trigger": {
- "platform": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "from": "on",
- "to": "off"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Wait the number of minutes set in the night lights time delay",
- "delay": {
- "minutes": 1
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ night_light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ night_switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- }
- ]
- }
- ],
- "default": [
- {
- "choose": [
- {
- "alias": "By-pass is turned on & check by-pass option - turn lights off",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_off"
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- },
- {
- "alias": "By-pass is turned on & check by-pass option - Keep the current lights state",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_stop"
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "By-pass is turned off & check if the motion trigger is off",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t8_on",
- "t8_off",
- "t8_stop"
- ]
- },
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "all",
- "state": "off"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Motion trigger is off and check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "By-pass is turned off & check if the motion trigger is on",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t8_on",
- "t8_off",
- "t8_stop"
- ]
- },
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "match": "any",
- "state": "on"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off and check conditions if enabled ",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- },
- {
- "condition": "or",
- "conditions": [
- "{{ (include_sun == 'sun_enabled') and (state_attr('sun.sun','elevation') >= sun_elevation | float(90)) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_disabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) and (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0) }}",
- "{{ (include_ambient == 'ambient_enabled') and (ambient_light_options == 'ambient_light_option_enabled') and (states[ambient_light_sensor].state | int > ambient_light_value | int) and (is_state(boolean_scenes_scripts, 'off')) }}",
- {
- "condition": "and",
- "conditions": [
- {
- "condition": "time",
- "after": "00:00:00",
- "before": "00:00:00"
- },
- "{{ include_time == 'time_enabled' }}"
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Wait the number of minutes set in the by-pass time delay",
- "delay": {
- "minutes": 0
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Motion trigger is on and check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Sun, Ambient Light Sensor & time above setting to turn off",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t9",
- "t10",
- "t11"
- ]
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the input boolean night lights",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "alias": "Turn off night lights when trigger by end night lights conditions",
- "conditions": [
- {
- "condition": "trigger",
- "id": [
- "t12",
- "t13",
- "t14"
- ]
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or (expand(night_lights.entity_id) | selectattr('state', '==', 'on') | list | count > 0) or (is_state(night_boolean_scenes_scripts, 'on')) }}"
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ crossover_night_lights_light }}"
- },
- "data": {
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ crossover_night_lights_light }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ crossover_night_lights_switch }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "choose": [
- {
- "alias": "If adjust light settings when crossing over if lights are ON is selected in night light control",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'if_lights_are_on_adjust_when_crossing_over' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ night_transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_night_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the input boolean night lights",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- },
- {
- "choose": [
- {
- "alias": "Set the transition and brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{{ brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition, brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "brightness_pct": "{{ brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('enable_lux_controled_brightness' not in include_dynamic_lighting) and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ crossover_lights_light_on }}"
- },
- "data": {
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "If transition is selected",
- "conditions": [
- "{{ 'manage_scripts_crossing_over' in include_night_light_control }}",
- "{{ (expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0) or (expand(night_lights.entity_id) | selectattr('state', '==', 'off') | list | count > 0) or (is_state(night_boolean_scenes_scripts, 'off')) }}"
- ],
- "sequence": [
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "Safe Guard when HA restarts",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t15"
- }
- ],
- "sequence": [
- {
- "choose": [
- {
- "alias": "Check all by-pass are off and check conditions if enabled ",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- },
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "state": "off"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Small time delay required",
- "delay": {
- "seconds": 1
- }
- }
- ]
- },
- {
- "alias": "Check if any by-passes are on",
- "conditions": [
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "or",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- },
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' in include_bypass) and ('bypass_enabled_stop' not in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- },
- {
- "condition": "and",
- "conditions": [
- "{{ ('bypass_enabled_turn_on' not in include_bypass) and ('bypass_enabled_turn_off' not in include_bypass) and ('bypass_enabled_stop' in include_bypass) }}",
- {
- "condition": "state",
- "entity_id": [],
- "match": "any",
- "state": "on"
- }
- ]
- }
- ]
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass auto off is enabled and preform the correct",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "alias": "Parallel Actions for dynamic lighting",
- "parallel": [
- {
- "sequence": [
- {
- "alias": "Check if the dynamic lighting is enabled",
- "condition": "and",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting != 'disable_dynamic_lighting' }}"
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Set the Dynamic Lux Controlled Brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_lux_controled_brightness'}}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition and dynamic lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the transition, dynamic lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Dynamic Lighting - Lux Controlled Brightness - Inverted for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_lux_controled_brightness_inv'}}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition and dynamic lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness_inv') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_min_lux - dynamic_lighting_max_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_min_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the transition, dynamic lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness_inv') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_min_lux - dynamic_lighting_max_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_min_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness_inv') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_min_lux - dynamic_lighting_max_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_min_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_lux_controled_brightness_inv') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_min_lux - dynamic_lighting_max_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_min_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Dynamic Lighting - Sun Elevation Lighting - Colour Temp for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_sun_elevation_colour' }}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the transition, lighting brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the lighting brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Set the Sun Elevation Lighting - Brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_sun_elevation_brightness' }}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition and dynamic sun elevation lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_brightness') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the transition, dynamic sun elevation lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_brightness') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic sun elevation lighting brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_brightness') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic sun elevation lighting brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_brightness') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n",
- "kelvin": "{{temperature_value}}"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Set the Sun Elevation Lighting - Colour Temp + Brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_sun_elevation_colour_brightness' }}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition, dynamic sun elevation lighting brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour_brightness') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic sun elevation lighting brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour_brightness') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_brightness %} {% set end_slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_brightness %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set brightness_value = dynamic_lighting_max_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n {% endif %}\n{% else %}\n {% set brightness_value = dynamic_lighting_min_brightness %}\n{% endif %} {{ brightness_value | round(0) }}\n",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Set the Sun Elevation Lighting - Colour Temp + LUX Controled Brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ include_dynamic_lighting == 'enable_sun_elevation_colour_lux_brightness' }}"
- }
- ],
- "sequence": [
- {
- "alias": "Dynamic Lighting Control",
- "repeat": {
- "until": "{{ expand(light_switch.entity_id) | selectattr('state', '==', 'off') | list | count > 0 }}",
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition, dynamic lighting lux brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour_lux_brightness') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- },
- {
- "alias": "Set the dynamic lighting lux brightness and dynamic sun elevation colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and (include_dynamic_lighting == 'enable_sun_elevation_colour_lux_brightness') }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "brightness_pct": "{% set lux = states(dynamic_lighting_lux_sensor) | float %} {% set slope = (dynamic_lighting_min_brightness - dynamic_lighting_max_brightness) / (dynamic_lighting_max_lux - dynamic_lighting_min_lux) %} {% set ak = (( slope * dynamic_lighting_min_lux) * -1) + dynamic_lighting_max_brightness %} {% set le = light_entities %} {% set lec = expand(le) | map(attribute='entity_id') | list | length %} {% set lp = expand(le) | map(attribute='attributes.brightness') | reject('equalto', None) | sum | float(default=255) / 255 * 100 / lec %} {% if lux <= dynamic_lighting_min_lux %}\n {% set bv = dynamic_lighting_max_brightness %}\n{% elif lux >= dynamic_lighting_max_lux %}\n {% set bv = dynamic_lighting_min_brightness %}\n{% else %}\n {% set bv = ((slope * lux) + ak) | round(1) %}\n{% endif %} {% if lp <= 0 %}\n {% set bv = bv %}\n{% elif (bv > lp) and (bv - lp) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif (lp > bv) and (lp - bv) <= dynamic_lighting_dead_zone %}\n {% set bv = lp %}\n{% elif bv > (lp + dynamic_lighting_step_value) %}\n {% set bv = lp + dynamic_lighting_step_value %}\n{% elif bv < (lp - dynamic_lighting_step_value) %}\n {% set bv = lp - dynamic_lighting_step_value %}\n{% endif %} {{ bv | round(0) }}\n",
- "kelvin": "{% set elevation = state_attr('sun.sun', 'elevation') | float %} {% set start_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_start_rising - dynamic_lighting_sun_elevation_end_rising) %} {% set start_ak = (( start_slope * dynamic_lighting_sun_elevation_end_rising) * -1) + dynamic_lighting_max_colour_temp %} {% set end_slope = (dynamic_lighting_min_colour_temp - dynamic_lighting_max_colour_temp) / (dynamic_lighting_sun_elevation_end_falling - dynamic_lighting_sun_elevation_start_falling) %} {% set end_ak = (( end_slope * dynamic_lighting_sun_elevation_end_falling) * -1) + dynamic_lighting_min_colour_temp %} {% if elevation >= -10 %}\n {% if elevation >= dynamic_lighting_sun_elevation_start_rising and elevation <= dynamic_lighting_sun_elevation_end_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = ((start_slope * elevation) + start_ak) | round(1) %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_falling and elevation >= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = ((end_slope * elevation) + end_ak) | round(1) %}\n {% elif elevation >= dynamic_lighting_sun_elevation_end_rising and elevation >= dynamic_lighting_sun_elevation_start_falling %}\n {% set colour_temp_value = dynamic_lighting_max_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_start_rising and is_state_attr('sun.sun', 'rising', true) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% elif elevation <= dynamic_lighting_sun_elevation_end_falling and is_state_attr('sun.sun', 'rising', false) %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n {% endif %}\n{% else %}\n {% set colour_temp_value = dynamic_lighting_min_colour_temp %}\n{% endif %} {{ colour_temp_value | round(0) }}\n"
- }
- },
- {
- "alias": "Dynamic lighting heartbeat",
- "delay": {
- "minutes": 1
- }
- }
- ]
- }
- ]
- }
- ]
- }
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "alias": "Set the transition for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{{ brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the transition, brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}",
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "brightness_pct": "{{ brightness_value }}"
- }
- }
- ]
- },
- {
- "alias": "Set the colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the brightness and colour temperature for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- },
- "data": {
- "brightness_pct": "{{ brightness_value }}",
- "kelvin": "{{temperature_value}}"
- }
- }
- ]
- },
- {
- "alias": "Set the default for the normal lights switch",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and (include_dynamic_lighting == 'disable_dynamic_lighting') and ('use_colour_temperature' not in include_light_control) }}"
- }
- ],
- "sequence": [
- {
- "service": "light.turn_on",
- "target": {
- "entity_id": "{{ light_entities_off }}"
- }
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Check if normal lights scenes or scripts helper is on - This is for scenes only when crossing over",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{% if night_boolean_scenes_scripts == [] %}\n false\n{% elif is_state(night_boolean_scenes_scripts, 'on') %}\n true\n{% else %}\n false\n{% endif %}"
- }
- ],
- "sequence": null
- },
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn on the scenes",
- "service": "scene.turn_on",
- "target": {
- "entity_id": "{{ scene_entities }}"
- },
- "data": {
- "transition": "{{ transition_on_value }}"
- }
- },
- {
- "alias": "Turn on the boolean for scenes and scripts",
- "service": "input_boolean.turn_on",
- "data": {
- "entity_id": "{{ boolean_scenes_scripts_helper }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn on the scenes",
- "service": "scene.turn_on",
- "target": {
- "entity_id": "{{ scene_entities }}"
- }
- },
- {
- "alias": "Turn on the boolean for scenes and scripts",
- "service": "input_boolean.turn_on",
- "data": {
- "entity_id": "{{ boolean_scenes_scripts_helper }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn on the switches",
- "service": "switch.turn_on",
- "target": {
- "entity_id": "{{ switch_entities_off }}"
- }
- },
- {
- "alias": "Turn on the scripts",
- "service": "script.turn_on",
- "target": {
- "entity_id": "{{ script_entities }}"
- }
- },
- {
- "choose": [
- {
- "alias": "By-pass is enabled & check by-pass option - turn lights on",
- "conditions": [
- {
- "condition": "trigger",
- "id": "t7_on"
- }
- ],
- "sequence": [
- {
- "alias": "Check by-pass settings and preform the correct action",
- "if": [
- {
- "alias": "Check if the by-pass auto off is enabled",
- "condition": "template",
- "value_template": "{{ ('bypass_auto_off_enabled_on' in include_bypass_auto_off) or ('bypass_auto_off_enabled_off' in include_bypass_auto_off) or ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "then": [
- {
- "alias": "Wait the number of minutes set in the by-pass auto off time delay",
- "delay": {
- "minutes": 60
- }
- },
- {
- "alias": "Parallel Actions for the by-pass auto off",
- "parallel": [
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_on' in include_bypass) and ('bypass_auto_off_enabled_on' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_turn_off' in include_bypass) and ('bypass_auto_off_enabled_off' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "sequence": [
- {
- "choose": [
- {
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ ('bypass_enabled_stop' in include_bypass) and ('bypass_auto_off_enabled_stop' in include_bypass_auto_off) }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the by-pass",
- "service": "homeassistant.turn_off",
- "entity_id": []
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "stop": "Stop the automation"
- }
- ],
- "else": [
- {
- "stop": "Stop the automation"
- }
- ]
- }
- ]
- }
- ]
- },
- {
- "choose": [
- {
- "alias": "Check if the trigger is on and wait for it to go off",
- "conditions": [
- {
- "condition": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "state": "on",
- "match": "any"
- }
- ],
- "sequence": [
- {
- "alias": "Wait until motion sensor is off",
- "wait_for_trigger": {
- "platform": "state",
- "entity_id": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "from": "on",
- "to": "off"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Wait the number of minutes set in the normal lights time delay",
- "delay": {
- "minutes": 2
- }
- },
- {
- "choose": [
- {
- "alias": "If transition is selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- },
- "data": {
- "transition": "{{ transition_off_value }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}",
- "transition": "{{ transition_off_value }}"
- }
- }
- ]
- },
- {
- "alias": "If transition is not selected",
- "conditions": [
- {
- "condition": "template",
- "value_template": "{{ 'use_transition' not in include_light_control }}"
- }
- ],
- "sequence": [
- {
- "alias": "Turn off the lights",
- "service": "light.turn_off",
- "target": {
- "entity_id": "{{ light_entities }}"
- }
- },
- {
- "alias": "Turn off the scenes",
- "service": "scene.turn_on",
- "data": {
- "entity_id": "{{ end_scene_entities }}"
- }
- }
- ]
- }
- ]
- },
- {
- "alias": "Turn off the switches",
- "service": "switch.turn_off",
- "target": {
- "entity_id": "{{ switch_entities }}"
- }
- },
- {
- "alias": "Turn off the script",
- "service": "script.turn_on",
- "data": {
- "entity_id": "{{ end_script_entities }}"
- }
- },
- {
- "alias": "Turn off the boolean for scenes and scripts",
- "service": "input_boolean.turn_off",
- "data": {
- "entity_id": []
- }
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- "id": "1696792357064",
- "alias": "Sensor Light Staircase FF",
- "description": ""
- },
- "blueprint_inputs": {
- "id": "1696792357064",
- "alias": "Sensor Light Staircase FF",
- "description": "",
- "use_blueprint": {
- "path": "Blackshome/sensor-light.yaml",
- "input": {
- "motion_trigger": [
- "binary_sensor.hue_motion_sensor_1_motion"
- ],
- "light_switch": {
- "entity_id": "scene.scene_staircase_ff_day"
- },
- "end_scenes": [
- "scene.scene_staircase_ff_off"
- ],
- "include_light_control": [
- "use_brightness",
- "use_transition"
- ],
- "light_transition_on": 5,
- "ambient_light_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "ambient_light_value": 50,
- "include_device_tracker": "device_tracker_disabled",
- "zone": "zone.home",
- "people": [
- "person.chris_home"
- ],
- "include_night_lights": "night_lights_enabled",
- "include_night_light_control": [
- "use_transition",
- "use_brightness",
- "if_lights_are_on_adjust_when_crossing_over"
- ],
- "night_time_delay": 1,
- "night_light_brightness": 1,
- "night_light_transition_on": 5,
- "night_light_transition_off": 10,
- "night_lights_conditions": [
- "sun_enabled",
- "time_enabled"
- ],
- "night_lights_after_time": "21:30:00",
- "night_lights_before_time": "07:00:00",
- "time_delay": 2,
- "night_lights": {
- "entity_id": "scene.scene_staircase_ff_night"
- },
- "light_brightness": 80,
- "light_transition_off": 10,
- "ambient_light_options": "ambient_light_option_enabled",
- "include_dynamic_lighting": [],
- "dynamic_lighting_lux_sensor": "sensor.hue_motion_sensor_1_illuminance",
- "dynamic_lighting_max_lux": 400,
- "dynamic_lighting_min_lux": 40
- }
- }
- },
- "context": {
- "id": "01HVER2TGQBE0S018FQH70ZMDX",
- "parent_id": "01HVER2TGQS44JVM0ZNME0WYB2",
- "user_id": null
- }
- },
- "logbookEntries": [
- {
- "name": "Sensor Light Staircase FF",
- "message": "triggered by state of binary_sensor.hue_motion_sensor_1_motion",
- "source": "state of binary_sensor.hue_motion_sensor_1_motion",
- "entity_id": "automation.sensor_light_staircase_ff",
- "context_id": "01HVER2TGQBE0S018FQH70ZMDX",
- "when": 1713113229.8571088,
- "domain": "automation"
- },
- {
- "when": 1713113229.893378,
- "state": "2024-04-14T16:47:09.893323+00:00",
- "entity_id": "scene.scene_staircase_ff_day",
- "icon": "mdi:stairs-box",
- "context_event_type": "automation_triggered",
- "context_domain": "automation",
- "context_name": "Sensor Light Staircase FF",
- "context_message": "triggered by state of binary_sensor.hue_motion_sensor_1_motion",
- "context_source": "state of binary_sensor.hue_motion_sensor_1_motion",
- "context_entity_id": "automation.sensor_light_staircase_ff"
- },
- {
- "when": 1713113230.068244,
- "state": "on",
- "entity_id": "light.light_staircase_ff",
- "context_event_type": "automation_triggered",
- "context_domain": "automation",
- "context_name": "Sensor Light Staircase FF",
- "context_message": "triggered by state of binary_sensor.hue_motion_sensor_1_motion",
- "context_source": "state of binary_sensor.hue_motion_sensor_1_motion",
- "context_entity_id": "automation.sensor_light_staircase_ff"
- },
- {
- "when": 1713113363.980548,
- "state": "2024-04-14T16:49:23.980429+00:00",
- "entity_id": "scene.scene_staircase_ff_off",
- "icon": "mdi:stairs-box",
- "context_event_type": "automation_triggered",
- "context_domain": "automation",
- "context_name": "Sensor Light Staircase FF",
- "context_message": "triggered by state of binary_sensor.hue_motion_sensor_1_motion",
- "context_source": "state of binary_sensor.hue_motion_sensor_1_motion",
- "context_entity_id": "automation.sensor_light_staircase_ff"
- },
- {
- "when": 1713113364.103519,
- "state": "off",
- "entity_id": "light.light_staircase_ff",
- "context_event_type": "automation_triggered",
- "context_domain": "automation",
- "context_name": "Sensor Light Staircase FF",
- "context_message": "triggered by state of binary_sensor.hue_motion_sensor_1_motion",
- "context_source": "state of binary_sensor.hue_motion_sensor_1_motion",
- "context_entity_id": "automation.sensor_light_staircase_ff"
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement