@sebk-666 wrote:
Hi,
I want to build an automation that turns on my laptop’s docking station when the laptop is on and off when the laptop is off / in standby.To spare me some repetition, I templated this like so:
alias: '[Power] Switch Thinkpad Dock with Thinkpad State' trigger: - platform: state entity_id: device_tracker.thinkpad action: service_template: > {%if is_state('device_tracker.thinkpad', 'home') %} switch.turn_on {%else%} switch.turn_off {%endif%} data: entity_id: switch.thinkpad
The problem is, that this triggers every 5s or so and not only when the device_tracker state changes.
Does anyone know why that is?I can split this into two automations for the
home
→not_home
andnot_home
→home
state transitions and it will work as expected, but I’d rather have a single piece of code to maintain.Sebastian
Posts: 6
Participants: 3