I have two desk lamps in my study loaded with smartbulbs. I’ve grouped these two lights into a group so they can be controlled by a (hass dashboard and) lightswitch as one. Now near the right lamp is my 3d printer controlled by Octoprint. Octoprint uses two plugins, one to control a smartplug allowing octoprint to turn off and on the PSU of the printer and another (OctoLight Home Assistant) controls the desklamp so that while a print is going on, the right desk lamp will be on.
Now what I want is for the button in my room to switch the lights on and off, but if Octoprint has turned the light on that should take priority and the light should remain on (so my timelapses have lighting).
My thought is to use a “Toggle” Helper and make Octoprint control that instead of the light directly and then have some automation on the lightswitch and that toggle to do the boolean logic there, something along the line of:
|------------------|--------------------|-----------|------------|
| Octoprint Active | Lightswitch Active | Left Lamp | Right Lamp |
|------------------|--------------------|-----------|------------|
| No | No | Off | Off |
| No | Yes | On | On |
| Yes | No | Off | On |
| Yes | Yes | On | On |
|------------------|--------------------|-----------|------------|
Where both “OctoPrint Active” and “Lightswitch Active” would be toggle helpers probably.
Is this the right way to go about this, or is there maybe some proper way to do this which I have been unable to Google for accurately?
Also if in the future perhaps the OctoLight plugin controls other lighting parameters (color temperature or color) ideally I’d want if Octoprint is active to have it respect the settings made by the plugin while once it finished it either turns off (if the light switch is turned off) or changes to the configured temp/color set in the light group (if the light switch is turned on). And perhaps even add a light sensor to ignore the lamp if the room is already lit by other means (like the sun). Any guidance on how/if this is possible would be appreciated.