From 863c0d18c09417d41766bb5d5d877df236ff896a Mon Sep 17 00:00:00 2001 From: ttrabatt Date: Fri, 15 Nov 2024 02:11:24 +0100 Subject: [PATCH] WIP motion light with luminescence --- automations.yaml | 74 +++++++----- .../homeassistant/motion_light_dual_lux.yaml | 114 ++++++++++++++++++ 2 files changed, 156 insertions(+), 32 deletions(-) create mode 100644 blueprints/automation/homeassistant/motion_light_dual_lux.yaml diff --git a/automations.yaml b/automations.yaml index 6e1690c..97b6527 100644 --- a/automations.yaml +++ b/automations.yaml @@ -1,4 +1,4 @@ -- id: "1729875991469" +- id: '1729875991469' alias: BagnoOvest-save-energy description: Thermostat will close upon window open use_blueprint: @@ -6,27 +6,27 @@ input: window_sensor: binary_sensor.bagnoovest_finestra_contact climate_target: climate.bagnoovest_termosifone -- id: "1729887529602" +- id: '1729887529602' alias: BagnoPT-save-energy - description: "" + description: '' use_blueprint: path: homeassistant/heat_save.yaml input: window_sensor: binary_sensor.bagnopt_finestra_contact climate_target: climate.bagnopt_termosifone ext_temp_limit: 17 -- id: "1729887632269" +- id: '1729887632269' alias: SoggiornoPT-save-energy - description: "" + description: '' use_blueprint: path: homeassistant/heat_save.yaml input: window_sensor: binary_sensor.soggiornopt_finestrasud_contact climate_target: climate.soggiornopt_termosifonesud ext_temp_limit: 17 -- id: "1730726143088" +- id: '1730726143088' alias: Luce Automatica Scala Taverna - description: "" + description: '' use_blueprint: path: homeassistant/motion_light_dual_no_sun.yaml input: @@ -35,9 +35,9 @@ light_target: device_id: 226779fb30bd68c5a2784ccd762d90e9 no_motion_wait: 20 -- id: "1730726243854" +- id: '1730726243854' alias: Luce Automatica Scala Mansarda - description: "" + description: '' use_blueprint: path: homeassistant/motion_light_dual.yaml input: @@ -46,31 +46,41 @@ light_target: device_id: 702137a6f2c17b89fdb0598f7003743c no_motion_wait: 20 -- id: "1731410549094" +- id: '1731410549094' alias: EVcharge_front_charging - description: "" + description: '' triggers: - - trigger: state - entity_id: - - input_boolean.evcharge_front_start - for: - hours: 0 - minutes: 0 - seconds: 10 + - trigger: state + entity_id: + - input_boolean.evcharge_front_start + for: + hours: 0 + minutes: 0 + seconds: 10 conditions: [] actions: - - wait_for_trigger: - - trigger: time - at: input_datetime.evcharge_good_time_start - - type: turn_on - device_id: 62352ecf274ff68e3ddfbc979406d49d - entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31 - domain: switch - - wait_for_trigger: - - trigger: time - at: input_datetime.evcharge_good_time_end - - type: turn_off - device_id: 62352ecf274ff68e3ddfbc979406d49d - entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31 - domain: switch + - wait_for_trigger: + - trigger: time + at: input_datetime.evcharge_good_time_start + - type: turn_on + device_id: 62352ecf274ff68e3ddfbc979406d49d + entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31 + domain: switch + - wait_for_trigger: + - trigger: time + at: input_datetime.evcharge_good_time_end + - type: turn_off + device_id: 62352ecf274ff68e3ddfbc979406d49d + entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31 + domain: switch mode: single +- id: '1731631866160' + alias: test1 + description: '' + use_blueprint: + path: homeassistant/motion_light_dual_lux.yaml + input: + motion_entity_down: binary_sensor.presenza_bassa_scala_mansarda_occupancy + motion_entity_up: binary_sensor.presenza_alta_scala_mansarda_occupancy + light_target: + device_id: 702137a6f2c17b89fdb0598f7003743c diff --git a/blueprints/automation/homeassistant/motion_light_dual_lux.yaml b/blueprints/automation/homeassistant/motion_light_dual_lux.yaml new file mode 100644 index 0000000..ee8708a --- /dev/null +++ b/blueprints/automation/homeassistant/motion_light_dual_lux.yaml @@ -0,0 +1,114 @@ +blueprint: + name: Dual Sensor Sunset and Luminescence Motion-activated Light + description: Turn on a light when motion is detected. + domain: automation + # source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml + author: Home Assistant Rewised by Tiziano Trabattoni + input: + motion_entity_down: + name: Motion Sensor (Sensore Basso) + description: Sensore parte bassa della scala + selector: + entity: + filter: + device_class: motion + domain: binary_sensor + motion_entity_up: + name: Motion Sensor (Sensore Alto) + description: Sensore parte alta della scala + selector: + entity: + filter: + device_class: motion + domain: binary_sensor + light_target: + name: Light + selector: + target: + entity: + domain: light + sun_condition: + name: Sun_driven + description: Controlled by sunrise and sunset + default: on + selector: + boolean: + no_motion_wait: + name: Wait time + description: Time to leave the light on after last motion is detected. + default: 30 + selector: + number: + min: 10 + max: 120 + unit_of_measurement: seconds + +trigger_variables: + use_sun: !input sun_condition + +triggers: + - trigger: state + entity_id: + - !input motion_entity_up + - !input motion_entity_down + to: "on" + id: motion-detected + - trigger: state + entity_id: + - !input motion_entity_up + - !input motion_entity_down + to: "off" + for: + hours: 0 + minutes: 0 + seconds: !input no_motion_wait + +conditions: [] + +actions: + - choose: + - conditions: + - condition: template + value_template: "{{ use_sun }}" + sequence: + - if: + - or: + - condition: template + value_template: "{{ ( sensor.esterno_luminosita_illuminance_lux | int ) < input_number.daylight_luminescence }}" + - condition: sun + after: sunset + after_offset: "-01:00:00" + before: sunrise + before_offset: "+01:00:00" + then: + - if: + - condition: trigger + id: + - motion-detected + then: + - action: light.turn_on + target: !input light_target + data: {} + else: + - action: light.turn_off + metadata: {} + data: + transition: 10 + target: !input light_target + default: + - if: + - condition: trigger + id: + - motion-detected + then: + - action: light.turn_on + target: !input light_target + data: {} + else: + - action: light.turn_off + metadata: {} + data: + transition: 10 + target: !input light_target + +mode: single