54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
- alias: Wand first-three array values
|
|
description: ''
|
|
triggers:
|
|
- entity_id: sensor.wand_history
|
|
trigger: state
|
|
conditions:
|
|
- condition: template
|
|
value_template: "{%- set arr = states('sensor.wand_history')\n | default('[]')\n\
|
|
\ | from_json -%}\n{{ (arr | length) >= 3\n and (arr[0] | int)\
|
|
\ == 3\n and (arr[1] | int) == 4\n and (arr[2] | int) == 6\n and (arr[3]\
|
|
\ | int) == 5}}\n"
|
|
actions:
|
|
- data:
|
|
name: Wand monitor
|
|
message: "{%- set arr = states('sensor.wand_history')\n | default('[]')\n\
|
|
\ | from_json -%}\nLength = {{ arr | length }}, first = {{ arr[0]\
|
|
\ | int(default='NA') }}, second = {{ arr[1] | int(default='NA') }}\n"
|
|
action: logbook.log
|
|
- type: turn_on
|
|
device_id: 8eec696046bc8d1477ff5ad793b8bc2b
|
|
entity_id: c1039bbd0f68f51d14f8ea4353d44eeb
|
|
domain: switch
|
|
mode: single
|
|
- alias: wand off
|
|
description: ''
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.wand_light
|
|
from: '0'
|
|
to: '1'
|
|
conditions: []
|
|
actions:
|
|
- type: turn_off
|
|
device_id: e1e6308d9faf380c83a6898fbf836a8e
|
|
entity_id: cb54a644bf2619e64394c5f54ac32325
|
|
domain: switch
|
|
mode: single
|
|
- alias: Wand on
|
|
description: ''
|
|
triggers:
|
|
- trigger: state
|
|
entity_id:
|
|
- sensor.wand_light
|
|
from: '1'
|
|
to: '0'
|
|
conditions: []
|
|
actions:
|
|
- type: turn_on
|
|
device_id: e1e6308d9faf380c83a6898fbf836a8e
|
|
entity_id: cb54a644bf2619e64394c5f54ac32325
|
|
domain: switch
|
|
mode: single
|