Created
June 30, 2021 07:34
-
-
Save WizBangCrash/362131cda912e385bbf80818f3acf08e to your computer and use it in GitHub Desktop.
Sets the Occupied to Unoccupied delay and sensitivity of the Philips SML001 Zigbee sensor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Configure SML001 Zigbee Attributes on startup | |
description: | | |
Sets the Occupied to Unoccupied delay and sensitivity of the Philips | |
SML001 Zigbee sensor | |
domain: automation | |
input: | |
# occupancy_entity_id: | |
# name: Occupancy Sensor | |
# description: "The occupancy sensor to use for this automation" | |
# selector: | |
# entity: | |
# domain: binary_sensor | |
# device_class: occupancy | |
ieee_id: | |
name: Occupancy Sensor Zigbee IEEE ID | |
description: "The zigbee network id of the sensor" | |
selector: | |
text: | |
o_to_u_delay: | |
name: Occupied to Unoccupied delay | |
description: | | |
Set the time we require the light(s) to stay on. | |
This delay is reset each time motion is detected. | |
NOTE: Restart Home Assistant on changing this value | |
default: "00:03:00" | |
selector: | |
time: | |
sensitivity: | |
name: Sensitivity of sensor | |
description: | | |
Set how sensitive we want the sensor to be: 0 = least sensitive | |
NOTE: Restart Home Assistant on changing this value | |
default: 2 | |
selector: | |
number: | |
min: 0 | |
max: 2 | |
# | |
# The automation | |
# | |
variables: | |
ieee_id: !input ieee_id | |
o_to_u_delay: !input o_to_u_delay | |
total_secs: >- | |
{% set hour, min, sec = o_to_u_delay.split(':') %} | |
{{ hour|int * 3600 + min|int * 60 + sec|int }} | |
# Trigger mode | |
mode: single | |
# Triggers | |
trigger: | |
# When HA starts | |
- platform: homeassistant | |
event: start | |
# Conditions | |
condition: [] | |
# Actions | |
# TODO: Figure out how to get ieee address of sensor from entity | |
action: | |
- delay: "00:01:00" | |
- alias: "Set the u_to_o delay" | |
service: zha.set_zigbee_cluster_attribute | |
data: | |
ieee: "{{ ieee_id }}" | |
endpoint_id: 2 | |
cluster_id: 0x0406 | |
cluster_type: in | |
attribute: 0x0010 | |
value: "{{ total_secs }}" | |
# Set device sensitivity | |
- alias: "Set the sensor sensitivity" | |
service: zha.set_zigbee_cluster_attribute | |
data: | |
ieee: "{{ ieee_id }}" | |
endpoint_id: 2 | |
cluster_id: 0x0406 | |
cluster_type: in | |
attribute: 0x0030 | |
value: !input sensitivity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment