As I am quite new to OH3 I am looking for some support or suggestion on how to setup my system properly.
Let me explain my setup first:
- OpenHab 3 is running on an raspberry pi 3 (with native rasbian-os)
- MQTT broker is running on the same rpi3
- I have one ESP32 with two 5V-LED strips attached (~270LEDs on the one + 170LEDs on the other) due to the load I power the ESP and the 2 LED stripes with one 130W-PowerSupply (230V->5V)
- As the 130W Power supply consumes ~7Watts in standby if now device is attached to 5V I want to be able to switch the power supply off if I am not using the LEDs, therefore I am using a IKEA Tradfri Switch
- OH3 and the ESP32 comunicate via MQTT (and MQTT binding)
- The IKEA switch communicates via the tradfri binding (and a IKEA hub)
- If I want to switch on the lights I now need to power on the switch
- Wait for some time (~2-3sec) until the ESP32 is up and connected to my WiFi (+MQTT)
- Then activate the LEDs by selecting a color
- I want to perform this as a kind of a ruleset and hide the “power switch” from the user experience
- Currently I defined a rule which allows me to activate the power on a color change, but then the selected color is send by openhab at the same time when the ESP32 is not yet online and therefore the information is lost and the user needs to change the color once more before the LEDs turn on.
So my question is, can I delay the send of the MQTT request?
Or can I resend the MQTT request after some time?
Or my I implement a script in OH3 for this? (Don’t have any experiance with skripts in OH yet)
Also feel free to comment if you have a more elegant way to solve my problem.
Thanks for any hint or guidance how I can solve my problem.