I just sowed my first seeds for the garden and this year it’s Gladys that handles the lighting so everything will be ready to plant at the right time.
Since I started with Gladys, I’ve been trying to create scenes to turn my smart plugs on or off with different triggers.
For my LED tubes I put 2 triggers programmed in parallel followed by actions to turn my smart plug on and off.
My LED tubes do turn off at 10:00 PM, but they don’t turn back on the next day. Each time I’m forced to create two separate scenes, one to turn on and one to turn off.
Am I doing this wrong?
2 Likes
For the same scene :
- any trigger will launch the scene (it’s like an OR).
- all actions in the same block are executed at the same time.
For your case, the best practice is therefore to create 2 scenes. One to turn on, one to turn off.
Can’t wait to see your seedlings grow 
No way to have an « or » between actions like for triggers, too bad. Thanks for your reply.
As Cyril says, there is no OR per se to match 8 AM to « Turn on » and 10 PM to « Turn off », however I think you can adapt your scene so that it does what you ask in a single scene if that’s really what you want.
You need a scene that, each time it’s executed, toggles the state of your lamp; here’s an example:
Replace what I called « lampe murale » with your plug and you must remember to initialize your plug to the correct state manually the first time. Then at 6 AM and at 10 PM your plug will take the value opposite to the one it currently has.
Detailed explanations of the scene’s actions:
- Retrieving the state of your plug before executing the scene (important to do this first)
- Turn the plug on (if it’s 6 AM that’s what we want; if it’s 10 PM it’s not a problem — your plug will remain on for this action)
- Condition: continue only if the plug was on (>= 1) before the start of the scene (so if it was off we stop there because the plug was turned on by the previous action)
- Finally, if the previous condition was met, turn the plug off since it was on at the start of the scene
That should allow you to do what you want. In any case, good idea to use Gladys for this.
1 Like
Thank you for that example, I’ll test it with my seedlings. My first tomatoes have poked their heads out today.
This project is so cool, @elfedagger!
Would you mind if I share this with the community? It’s a great example
1 Like
Good evening,
Same issue for me, I have to duplicate the scenes to handle the « toggle », on \u003e off, off \u003e on.
But there is a PR for that:
Scene action toggle by rpochet · Pull Request #1645 · GladysAssistant/Gladys · GitHub
1 Like
Hi @Romuald_Pochet, regarding this PR, have you taken my feedback into account? 
Thanks @Romuald_Pochet for the feedback, it’s fine with me — I merged the PR! 
The new action « Invert lights » / « Invert outlets » will be available in the next version of Gladys
1 Like