44 lines
989 B
YAML
44 lines
989 B
YAML
homeassistant:
|
|
customize:
|
|
package.node_anchors:
|
|
common: &common
|
|
package: "computers"
|
|
binary_sensor.arrakis:
|
|
<<: *common
|
|
automation.desk_lamp_follows_computer:
|
|
<<: *common
|
|
|
|
# Switched off/on when computer enters/leaves screen sleep
|
|
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
|