hass-config/packages/computers.yaml

33 lines
718 B
YAML

binary_sensor:
- platform: mqtt
state_topic: "computer/arrakis/on"
name: Arrakis
automation:
- alias: Desk lamp follows computer
initial_state: True
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