|
在这帖中见到wqqs大神的教学
binary_sensor:
- platform: ping
name: device_name
host: xx.xx.xx.xx
scan_interval: 15
count: 5
switch:
- platform: template
switches:
device_name:
value_template: "{{ is_state('binary_sensor.device_name', 'on') }}"
请问如何把收集了的装置状态整合到script?
tv_off_plex_off:
alias: Turn TV & Plex off
sequence:
- service: switch.turn_off
data:
entity_id: switch.tv_power
#如果装置状态为开,才执行以下部分
if "{{ is_state('binary_sensor.plex', 'on') }}"
run
- service: switch.turn_off
data:
entity_id: switch.plex_power
#如果装置状态为关,就不用按开关制
else
------------------------------------------------
求高人指点 !
|
|