Hello everybody,
I have automation,which torn on / of switch when some device change status from / to home. Automation is working well, but I feel like it can be written in some mor sophisticated way. Somethong shorter with IF / ELSE maybe… What would be best syntax?
alias: PowerOnNotebook
description: ''
trigger:
- entity_id: device_tracker.notebook
from: not_home
platform: state
to: home
condition: []
action:
- data:
entity_id:
- switch.63743864dc4f22d434c2
service: switch.turn_on
- id: '1572906181158'
alias: PowerOffNotebook
description: ''
trigger:
- entity_id: device_tracker.notebook
from: home
platform: state
to: not_home
condition: []
action:
- data:
entity_id:
- switch.63743864dc4f22d434c2
service: switch.turn_off
It’s ok in this case… but for my learning. How to remake it in this “sophisticated” way to work only when changing from home to not_home and vice versa? Condition with IF ELSE ?