09-11-2023 02:04 PM
Hi,
Is there a way I can check the current state of a device?
The issue I have is I'm trying to create an automation that turns my light on 30min before sunset but only if my TV is switched on. It only works if I remove the condition so must be some issue with that section, I've tried using my soundbar instead of the TV but I get the same result.
I'd like to see if I can find the TV or Soundbar current state to see if it is not showing correctly.
The code in case anyone wants to check is as follows:
starters:
- type: time.schedule
at: sunset-30min
weekdays:
- MON
- TUE
- WED
- THU
- FRI
- SAT
- SUN
condition:
type: device.state.OnOff
state: on
is: true
device: Living Room TV - Living room
actions:
- type: device.command.OnOff
on: true
devices: Living room light - Living room
Thanks in advance.
09-12-2023 05:38 AM
Try to write "condition" & "action" with the same tabulation than "starters".
You have no error in the script editor ?
09-16-2023 09:54 AM
I didn't notice at the first reading, but your "time.schedule" syntax is wrong :
- type: time.schedule
before: sunrise
after: sunset+30min
There's an autotext in Automation normally. When you choose a "type", the fields to fill should appear automatically.