Niomak
April 22, 2025, 6:50pm
1
Hello,
Is it possible in scenes, when defining wait action, to set time as random value? Specifically, I’m looking for option to set random value between two integers (for instance wait for random number of minutes between 5 to 10).
The motivation is to set vacation mode on lightning to give impression that someone is in the house, hence randomization.
Hi @Niomak ! It’s not currently possible natively in scene.
I don’t know if you have a bit of technical knowledge, but you could do it with the MQTT integration + Node-RED, or just with a simple script
If you want some help to setup that, I’d be happy to help
Niomak
April 26, 2025, 11:07am
3
Sorry for late response, I didn’t notice e-mail that there was response.
I have some programming knowledge so script option would be more natural for me.
However I did not see any option to write custom scripts in Gladys.
Could you provide some hints how to do this?
Thank you in advance.
For your use case, you can create a fake MQTT device (e.g. “Light On”).
Then, using Node-RED or a custom script, you can publish messages to an MQTT topic at random times to toggle this virtual light on or off.
In Gladys, you can create a scene that listens for state changes on this fake device and use it to control all your real lights.
Helpful resources:
MQTT integration guide:
Node-RED integration guide:
Feel free to ask if you need any help setting it up
Hi @Niomak ,
I’ve been working on this feature so you can use this natively in Gladys!
I’ve modified the “Wait” action in scene to support computed values.
This action will support the random
function to generate random values here:
The PR is here, it’ll probably go live in the next version of Gladys
master
← add-wait-with-evaluated-value
opened 01:41PM - 08 May 25 UTC
### Pull Request check-list
To ensure your Pull Request can be accepted as fa… st as possible, make sure to review and check all of these items:
- [x] If your changes affects code, did your write the tests?
- [x] Are tests passing? (`npm test` on both front/server)
- [x] Is the linter passing? (`npm run eslint` on both front/server)
- [x] Did you run prettier? (`npm run prettier` on both front/server)
- [x] If you are adding a new features/services, did you run integration comparator? (`npm run compare-translations` on front)
- [x] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community ([french forum](https://community.gladysassistant.com/)/[english forum](https://en-community.gladysassistant.com/)) for testing before merging.
### Description of change
https://community.gladysassistant.com/t/pouvoir-injecter-une-variable-dans-l-action-attendre/8363
Thanks for your feedback
Amazing. Thank you. This will be extremely helpful.
1 Like