Page 1 of 1

Update hue scene in dzvents script?

Posted: Thursday 23 December 2021 17:12
by Ries
Hi all,

Use case:
When a room (Huiskamer) becomes empty, all lights turn off
When a room is reentered, lights turn on

All room lights are controlled by the hue bridge hardware, connected to domoticz

Problem:
Simply Switch off the Group Huiskamer when empty and Switch On when occupied does not work when one of the lights is off. In that case it will turn on the last state when all lights were on.

Approach to solution.
My approach is to update a hue scene (“WoonkamerPrevious”) with a dzvents script, that is triggered whenever a light of that room changes and will save the current state of the lights to that hue scene. And switch On that scene when the room becomes occupied.

I am guessing a json or http call could do such an update.

Can anyone help me out and set my on the right track?

Re: Update hue scene in dzvents script?

Posted: Thursday 23 December 2021 17:43
by waltervl
I do not have Hue bridge integration. So what kind of device is the Hue scene (“WoonkamerPrevious”) in Domoticz? Is that also a Domoticz Scene device or just a regular switch? Or do you want to directly send an http command to the Hue bridge without using the Domoticz integration?

Re: Update hue scene in dzvents script?

Posted: Thursday 23 December 2021 19:08
by Ries
A hue scene is a switch device in domoticz
Updating a hue scene isnt a function in domoticz, so yes, im am guessing a http command

Re: Update hue scene in dzvents script?

Posted: Thursday 23 December 2021 20:04
by waltervl
I do not understand the updating of the Hue scene. You say that if one light of a group is switched off (not connected to 220V?) the Hue bridge will not switch the other lights too?

Instead of searching a http command to update the Hue bridge perhaps you can use the following:
If the motion detector of the room is also visible in Domoticz you can use this to switch the individual lights on/off as being a scene in Hue bridge. You can also put the individual lights in a Domoticzc group and switch them all together on/off. Domoticz does not care if one of the lights is not connected.

Re: Update hue scene in dzvents script?

Posted: Thursday 23 December 2021 20:50
by Ries
You are describing my previous solution, which has worked well for years. I had three scenes, and the appropriate scene was selected in a selector switch device. The selector switch determines what scene is activated when the room is occupated. I have a dzvents script that gets input from door and pir devices to determine the state of the room.

What I want tho, is not to activate a predetermined scene, but the exact situation before the room was switched off.

Re: Update hue scene in dzvents script?

Posted: Friday 24 December 2021 9:27
by waltervl
You can store the light settings in a variable and use those.
See the persistent data section in the dzVents documentation: https://www.domoticz.com/wiki/DzVents:_ ... stent_data

Re: Update hue scene in dzvents script?

Posted: Saturday 25 December 2021 11:37
by Ries
Thanks waltervl, I’ll give that a try.
If someone has a solution to update a hue scene, then that will relieve the burden on domoticz.