- Platform information:
- Hardware: Raspberry Pi 5
- OS: Raspberry Pi OS 64 bit
- Java Runtime Environment: OpenJDK 17.0.12
- openHAB version: 4.2.1
I’ve been working on a network of lighting controllers that I have built, which will be ultimately controlled through OpenHAB. Each lighting panel group consists of a Switch, Dimmer and Colour Temperature (which uses a Dimmer item).
These Items are linked through Channels to a generic MQTT Thing which then sends out the MQTT commands to control the physical controllers.
Currently I have everything working under manual control, through both external buttons as well as through the web based UI.
The last thing I want to implement is an Auto mode. Each light group has an additional Switch called Auto mode, where the lights are controlled through automated means, ie motion sensors, scenes and time of day effects etc.
Generally, I would like the lights to function like this:
- When auto mode if OFF, ignore the automated commands for the switch and dimmers
- When the switch or dimmers are manually altered either through physical buttons or through the UI, then turn off auto mode.
I can achieve the 2nd point by creating a rule which turns off the auto mode switch when either the light switch or dimmers receive a Command. I was hoping that I could then use the “Update Item” control method to send values to the items through automated means without it turning off auto mode. Unfortunately Updating an item doesn’t send an associated channel link command, and so it doesn’t output any MQTT messages.
The next quick and dirty attempt consisted of sending an Auto mode ON command after any command sent by an automated means. However this only occasionally worked, as I think that there was no guarantee whether that ON command would be processed before or after the rule that turned the auto mode off.
I have a few other ideas which consist of using Items to store global variables. Or some way to distinguish different custom commands (ie, auto mode turns off if light switch receives an ON command but not an AUTO_ON, for example). I’m still unsure if these are possible, or how to go about it.
What would really be helpful is being able to pass arguments into scripts, but that still doesn’t seem to be possible either.
Any ideas?