Im trying to get automation working and just using basic example from net but it is never triggered so can you guys help me.
- id: '1540229509690'
alias: kokeilu
trigger:
platform: sun
event: sunset
offset: 00:45:00
action:
service: switch.turn_on
entity_id: switch.tahtilamppu
when i press trigger button switch will work but never by self
switch is sonoff basic with latest tasmota
petro
(Petro)
November 9, 2018, 1:12pm
2
You need to format your code properly, use the blue link at the top of the post. Edit your original post. Do not copy from your original post and paste into a new post. The original formatting from your yaml will be lost if you do.
tom_l
November 9, 2018, 1:19pm
3
Should be
service: switch.turn_on # does what it says
or
service: switch.toggle # i.e. swap switch state from off to on, or on to off.
But it should work when sun is setting?
tom_l
November 9, 2018, 1:46pm
5
Not the way you currently have it indented (this is why pertro asked you to format it correctly). Also your offset time needs to be in quotes. Like this:
- id: '1540229509690'
alias: kokeilu
trigger:
platform: sun
event: sunset
offset: "+00:45:00"
action:
service: switch.turn_on
entity_id: switch.tahtilamppu
This will turn on the switch 45 minutes after sunset.
Doesn’t the time need a plus / minus in it to tell it which way to offset too?
tom_l
November 9, 2018, 2:09pm
7
I assumed + was implied by there not being a ‘-’. You could be right.
Bob_NL
(Bob Visser)
November 9, 2018, 2:09pm
8
Only with a negative offset.
EDIT:
Oops you’re right it does need a plus as well
tom_l
November 9, 2018, 2:18pm
9
Code updated. Thanks @anon43302295 .
@anon43302295 , @tom_l
I can tell you it does not need a plus sign for positive offsets. It doesn’t hurt to add it, but it’s not necessary.
1 Like
Thank you, now it works but dont know how to paste code quote as tom but hopefully i will learn that