Desk lamp automation

This commit is contained in:
Thomas Lovén 2019-01-09 22:15:37 +01:00
parent aca29db464
commit daef10270e

31
packages/computers.yaml Normal file
View File

@ -0,0 +1,31 @@
binary_sensor:
- platform: mqtt
state_topic: "computer/arrakis/on"
name: Arrakis
automation:
- alias: Desk lamp follows computer
trigger:
- platform: state
entity_id: binary_sensor.arrakis
to: "on"
for:
hours: 0
minutes: 0
seconds: 1
- platform: state
entity_id: binary_sensor.arrakis
to: "off"
for:
hours: 0
minutes: 0
seconds: 1
action:
service_template: >-
{% if trigger.to_state.state == 'on' %}
light.turn_on
{% else %}
light.turn_off
{% endif %}
data:
entity_id: light.skrivbordslampa_1