Pulsante e MQTT trigger - test motion light new

This commit is contained in:
2025-01-30 00:24:45 +01:00
parent c7260d8b64
commit 390b5c5972
6 changed files with 301 additions and 131 deletions

View File

@@ -1 +1 @@
2025.1.2 2025.1.4

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ themes/*
.storage/core.restore_state .storage/core.restore_state
.storage/repairs.issue_registry .storage/repairs.issue_registry
home-assistant.log* home-assistant.log*
zigbee2mqtt

View File

@@ -1,4 +1,4 @@
- id: '1729875991469' - id: "1729875991469"
alias: BagnoOvest-save-energy alias: BagnoOvest-save-energy
description: Thermostat will close upon window open description: Thermostat will close upon window open
use_blueprint: use_blueprint:
@@ -6,27 +6,27 @@
input: input:
window_sensor: binary_sensor.bagnoovest_finestra_contact window_sensor: binary_sensor.bagnoovest_finestra_contact
climate_target: climate.bagnoovest_termosifone climate_target: climate.bagnoovest_termosifone
- id: '1729887529602' - id: "1729887529602"
alias: BagnoPT-save-energy alias: BagnoPT-save-energy
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/heat_save.yaml path: homeassistant/heat_save.yaml
input: input:
window_sensor: binary_sensor.bagnopt_finestra_contact window_sensor: binary_sensor.bagnopt_finestra_contact
climate_target: climate.bagnopt_termosifone climate_target: climate.bagnopt_termosifone
ext_temp_limit: 17 ext_temp_limit: 17
- id: '1729887632269' - id: "1729887632269"
alias: SoggiornoPT-save-energy alias: SoggiornoPT-save-energy
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/heat_save.yaml path: homeassistant/heat_save.yaml
input: input:
window_sensor: binary_sensor.soggiornopt_finestrasud_contact window_sensor: binary_sensor.soggiornopt_finestrasud_contact
climate_target: climate.soggiornopt_termosifonesud climate_target: climate.soggiornopt_termosifonesud
ext_temp_limit: 17 ext_temp_limit: 17
- id: '1731410549094' - id: "1731410549094"
alias: EVcharge_front_charging alias: EVcharge_front_charging
description: '' description: ""
triggers: triggers:
- trigger: state - trigger: state
entity_id: entity_id:
@@ -52,9 +52,9 @@
entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31 entity_id: c1f2a5e1b3bc7807a8b291b6fd6dbb31
domain: switch domain: switch
mode: single mode: single
- id: '1731705145404' - id: "1731705145404"
alias: Luce Automatica Scala Mansarda alias: Luce Automatica Scala Mansarda
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/motion_light_dual_lux.yaml path: homeassistant/motion_light_dual_lux.yaml
input: input:
@@ -62,9 +62,10 @@
motion_entity_up: binary_sensor.presenza_alta_scala_mansarda_occupancy motion_entity_up: binary_sensor.presenza_alta_scala_mansarda_occupancy
light_target: light_target:
device_id: 702137a6f2c17b89fdb0598f7003743c device_id: 702137a6f2c17b89fdb0598f7003743c
- id: '1731705400752' no_motion_wait: 10
- id: "1731705400752"
alias: Luce Automatica Scala Taverna alias: Luce Automatica Scala Taverna
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/motion_light_dual_lux.yaml path: homeassistant/motion_light_dual_lux.yaml
input: input:
@@ -73,15 +74,15 @@
light_target: light_target:
device_id: 226779fb30bd68c5a2784ccd762d90e9 device_id: 226779fb30bd68c5a2784ccd762d90e9
sun_condition: false sun_condition: false
- id: '1731953745814' - id: "1731953745814"
alias: EVcharge-front-program alias: EVcharge-front-program
description: '' description: ""
triggers: triggers:
- trigger: state - trigger: state
entity_id: entity_id:
- input_boolean.evcharge_front_start - input_boolean.evcharge_front_start
from: 'off' from: "off"
to: 'on' to: "on"
conditions: conditions:
- condition: time - condition: time
after: input_datetime.evcharge_good_time_start after: input_datetime.evcharge_good_time_start
@@ -100,8 +101,9 @@
data: {} data: {}
target: target:
device_id: 62352ecf274ff68e3ddfbc979406d49d device_id: 62352ecf274ff68e3ddfbc979406d49d
- wait_template: '{{ states(''sensor.presa_smart_1_power'') < states(''input_number.evcharge_no_charge_threshold'') - wait_template:
}}' "{{ states('sensor.presa_smart_1_power') < states('input_number.evcharge_no_charge_threshold')
}}"
continue_on_timeout: true continue_on_timeout: true
timeout: 00:30:00 timeout: 00:30:00
- action: switch.turn_off - action: switch.turn_off
@@ -110,9 +112,9 @@
target: target:
device_id: 62352ecf274ff68e3ddfbc979406d49d device_id: 62352ecf274ff68e3ddfbc979406d49d
mode: single mode: single
- id: '1732739522749' - id: "1732739522749"
alias: Luce Automatica Taverna Garage alias: Luce Automatica Taverna Garage
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/motion_light_tris_lux.yaml path: homeassistant/motion_light_tris_lux.yaml
input: input:
@@ -122,13 +124,15 @@
light_target: light_target:
entity_id: light.taverna_garage entity_id: light.taverna_garage
sun_condition: false sun_condition: false
- id: '1733907515800' dont_disturb_condition: false
- id: "1733907515800"
alias: EVcharge-front-temp-automation alias: EVcharge-front-temp-automation
description: Temporary Automation of EVcharge front from 23:01 to 9:00 all days description:
Temporary Automation of EVcharge front from 23:01 to 9:00 all days
the same the same
triggers: triggers:
- trigger: time - trigger: time
at: '23:04:00' at: "23:04:00"
id: EVcharge-front-on id: EVcharge-front-on
- trigger: time - trigger: time
at: 09:00:00 at: 09:00:00
@@ -150,9 +154,9 @@
entity_id: 62f4895f11ca37d023aad1fddee7c0a0 entity_id: 62f4895f11ca37d023aad1fddee7c0a0
domain: switch domain: switch
mode: single mode: single
- id: '1735298237446' - id: "1735298237446"
alias: P1-confort-light alias: P1-confort-light
description: '' description: ""
triggers: triggers:
- trigger: time - trigger: time
at: input_datetime.dont_disturb_nighttime_to at: input_datetime.dont_disturb_nighttime_to
@@ -161,7 +165,7 @@
offset: 00:30:00 offset: 00:30:00
id: p1-confort-light-on id: p1-confort-light-on
- trigger: time - trigger: time
at: '23:00:00' at: "23:00:00"
id: p1-confort-light-off id: p1-confort-light-off
conditions: [] conditions: []
actions: actions:
@@ -181,11 +185,80 @@
entity_id: ef6706dbe425caf09693c084182ec228 entity_id: ef6706dbe425caf09693c084182ec228
domain: light domain: light
mode: single mode: single
- id: '1736805701473' - id: "1736805701473"
alias: P1confort-light alias: P1confort-light
description: '' description: ""
use_blueprint: use_blueprint:
path: homeassistant/confort_light.yaml path: homeassistant/confort_light.yaml
input: input:
light_target: light_target:
device_id: e0397b54f1c2d1514be403e2996ca368 device_id: e0397b54f1c2d1514be403e2996ca368
- id: "1737850967154"
alias: test-new-motion
description: ""
use_blueprint:
path: homeassistant/motion-light-new.yaml
input:
motion_entity1: binary_sensor.presenza_alta_scala_mansarda_occupancy
motion_entity2: binary_sensor.presenza_bassa_scala_mansarda_occupancy
light_target:
entity_id: light.test_lamp1
- id: "1738142303265"
alias: test-pulsante1
description: ""
triggers:
- trigger: mqtt
topic: "zigbee2mqtt/Pulsante-01"
payload: "single"
value_template: "{{ value_json['action'] }}"
id: Pulsante1-single
- trigger: mqtt
topic: "zigbee2mqtt/Pulsante-01"
payload: "double"
value_template: "{{ value_json['action'] }}"
id: Pulsante1-double
# - domain: mqtt
# # device_id: 0b221729867cef10dcb428820c082f79
# type: action
# subtype: single
# trigger: device
# id: Pulsante1-single
# - domain: mqtt
# device_id: 0b221729867cef10dcb428820c082f79
# type: action
# subtype: double
# trigger: device
# id: Pulsante1-double
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Pulsante1-single
sequence:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 255
- 0
- 0
brightness_pct: 100
transition: 10
target:
device_id: "{{ device_id('light.test_lamp1')}}"
# device_id: "9f46c5b7c07f1495e0f4bf8d6f72a525"
- conditions:
- condition: trigger
id:
- Pulsante1-double
sequence:
- action: light.turn_off
metadata: {}
data:
transition: 10
target:
device_id: "{{ device_id('light.test_lamp1')}}"
mode: queued

View File

@@ -0,0 +1,71 @@
blueprint:
name: Motion-activated Light NEW
description: Turn on a light when motion is detected NEW.
domain: automation
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/automation/blueprints/motion_light.yaml
author: Home Assistant
input:
motion_entity1:
name: Motion-sensor1
selector:
entity:
filter:
device_class: switch
domain: binary_sensor
motion_entity2:
name: Motion-sensor2
selector:
entity:
filter:
device_class: motion
domain: binary_sensor
light_target:
name: Light
selector:
target:
entity:
domain: light
no_motion_wait:
name: Wait time
description: Time to leave the light on after last motion is detected.
default: 20
selector:
number:
min: 0
max: 300
unit_of_measurement: seconds
# If motion is detected within the delay,
# we restart the script.
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input motion_entity1
from: "off"
to: "on"
- trigger: state
entity_id: !input motion_entity2
from: "off"
to: "on"
actions:
- alias: "Turn on the light"
action: light.turn_on
target: !input light_target
- alias: "Wait until there is no motion from device1"
wait_for_trigger:
- trigger: state
entity_id: !input motion_entity1
from: "on"
to: "off"
- trigger: state
entity_id: !input motion_entity2
from: "on"
to: "off"
- alias: "Wait the number of seconds that has been set"
delay: !input no_motion_wait
- alias: "Turn off the light"
action: light.turn_off
target: !input light_target

View File

@@ -33,6 +33,12 @@ blueprint:
default: on default: on
selector: selector:
boolean: boolean:
dont_disturb_condition:
name: dont_disturb_light_control
description: Controls if lamp brightness has to be reduced to not disturb
default: on
selector:
boolean:
no_motion_wait: no_motion_wait:
name: Wait time name: Wait time
description: Time to leave the light on after last motion is detected. description: Time to leave the light on after last motion is detected.
@@ -89,11 +95,21 @@ actions:
id: id:
- motion-detected - motion-detected
then: then:
- if:
- condition: template
value_template: "{{ dont_disturb_condition }}"
then:
- action: light.turn_on
target: !input light_target
data:
brightness_pct: states('dont_disturb_light_brightness')
color_temp_kelvin: 2500
else:
- action: light.turn_on - action: light.turn_on
target: !input light_target target: !input light_target
data: data:
brightness_pct: 100 brightness_pct: 100
color_temp_kelvin: 2700 color_temp_kelvin: 2500
else: else:
- action: light.turn_off - action: light.turn_off
metadata: {} metadata: {}
@@ -107,11 +123,21 @@ actions:
id: id:
- motion-detected - motion-detected
then: then:
- if:
- condition: template
value_template: "{{ dont_disturb_condition }}"
then:
- action: light.turn_on
target: !input light_target
data:
brightness_pct: states('dont_disturb_light_brightness')
color_temp_kelvin: 2500
else:
- action: light.turn_on - action: light.turn_on
target: !input light_target target: !input light_target
data: data:
brightness_pct: 100 brightness_pct: 100
color_temp_kelvin: 2700 color_temp_kelvin: 2500
else: else:
- action: light.turn_off - action: light.turn_off
metadata: {} metadata: {}

View File

@@ -111,8 +111,7 @@ actions:
then: then:
- if: - if:
- condition: template - condition: template
# value_template: "{{ use_dont_disturb }}" value_template: "{{ dont_disturb_condition }}"
value_template: "{{ dont_disturb_nighttime }}"
then: then:
- action: light.turn_on - action: light.turn_on
target: !input light_target target: !input light_target
@@ -142,7 +141,7 @@ actions:
then: then:
- if: - if:
- condition: template - condition: template
value_template: "{{ use_dont_disturb }}" value_template: "{{ dont_disturb_condition }}"
then: then:
- action: light.turn_on - action: light.turn_on
target: !input light_target target: !input light_target