Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!

Moderators: leecollings, remb0

Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
mikedavies1953
Posts: 14
Joined: Thursday 09 January 2020 19:24
Target OS: Windows
Domoticz version:
Contact:

Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by mikedavies1953 »

Philips Hue V2 – Dusk Sensor switches changing to OFF shortly after Domoticz restart

Domoticz version: 2026.4.18387
Operating system: Windows 10
Hardware: Three separate Philips Hue V2 bridges, serving three properties (identified below as 12, 38 and 46).

I am experiencing an issue in which the Domoticz Dusk Sensor devices associated with Hue motion sensors change to OFF shortly after Domoticz starts, despite the corresponding light-level readings indicating darkness.

What happens

Immediately following a Domoticz restart, all the Dusk Sensor switches initially show the correct state (ON).

However, approximately 10–11 minutes after startup, they change to OFF. The associated Hue light-level devices continue to report readings, often 0 lux, and the motion and temperature devices also appear to continue updating normally.

This affects all three Hue V2 bridges, and therefore does not appear to be isolated to one bridge or one sensor.

Reproducing the behaviour

I monitored the devices following a restart on 16 November 2026.

Domoticz restart completed at 17:10:21. All Dusk Sensor switches initially showed ON.

The subsequent OFF transitions were recorded as follows:

Property / sensor Time changed to OFF
38 – Study 17:20:27
38 – Cloakroom 17:21:05
38 – Passageway 17:21:05
38 – Patio 17:21:05
46 – Conservatory 17:21:18
12 – Bedroom 17:21:18
12 – Dining Room 17:21:18
12 – Conservatory 17:21:18

The Study sensor’s earlier transition may have been influenced by movement while I was working in that room. The other seven transitions occurred within approximately 13 seconds of one another.

The light-level readings continued to update, and the sensors were reporting very low or zero lux. Nevertheless, the Dusk Sensor switches remained OFF.

Further information

* There are three independent Hue V2 bridges, at properties 12, 38 and 46.
* The affected sensors include a mixture of Hue hardware types SML001, SML002 and SML003.
* All three Hue hardware entries use the same default polling interval (10 seconds).
* The issue appears to have started around 11 November 2026.
* A number of Hue motion sensors were also recreated with new Domoticz device IDs following a restart. This occurred across the bridges, but I do not know whether it is related.
* Other Hue sensor functions, including motion, temperature and light-level reporting, appear to be working.
* The Dusk Sensor devices are the switch functions associated with the Hue motion sensors, not separately created virtual switches.

The relevant Domoticz log entries show the Dusk Sensor and light-level devices being updated at the times above. There are no obvious errors in the excerpt I have examined. The log lines confirm the updates, but do not themselves show the resulting ON/OFF values; these were observed in the Domoticz device list.

Questions

1. Is the Dusk Sensor function supported and updated correctly when using the Philips Hue V2 integration?
2. Does Domoticz obtain the dusk/daylight state from a separate Hue API attribute, or is it derived from the reported light level?
3. Could a periodic V2 resynchronisation or event-stream update be causing the Dusk Sensor switches to be reset to OFF, even though the light-level readings continue to indicate darkness?
4. Is this a known issue in 2026.4, or is there any additional logging I could enable to identify what is changing the switch state?

I have not made any changes to the Hue bridges, sensors or existing Domoticz automations, as I would prefer to establish the cause before altering a working installation.

Any advice or suggestions would be appreciated.
Attachments
Event System Event Log 2026-11-16.txt
(9.46 KiB) Downloaded 8 times
mikedavies1953
Posts: 14
Joined: Thursday 09 January 2020 19:24
Target OS: Windows
Domoticz version:
Contact:

Re: Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by mikedavies1953 »

## Update: Investigation of Hue V2 Dusk Sensor behaviour — Domoticz 2026.4

Following my original report, I have investigated the Philips Hue V2 API directly and examined the Domoticz 2026.4 source code (release commit `cc668a1`).

I believe I have identified a likely explanation for the Dusk Sensor switches changing to OFF approximately ten minutes after a Domoticz restart.

### 1. What the Hue V2 API actually returns

I queried the property 12 Hue V2 bridge directly using its authenticated API:

`GET /clip/v2/resource/light_level`

The response for each of the three motion sensors included:

- `light_level`
- `light_level_valid`
- `light_level_report`

However, none of the responses contained a `dark` property.

The Conservatory sensor, for example, returned a valid light-level resource with `light_level_valid: true`, but no `dark` field.

The corresponding device resources identify all three as Hue SML003 motion sensors.

### 2. What the Domoticz source code does

I examined the following files at the 2026.4 release commit:

**PhilipsHueV2Sensors.h**

The `HueV2LightLevel` structure initialises:

`bool dark = false;`

**PhilipsHueV2Sensors.cpp**

In `parseLightLevelJson()`, Domoticz reads the `dark` field only if it exists:

`if (light.isMember("dark"))`
` ll.dark = light["dark"].asBool();`

If the Hue response does not contain that field, `dark` therefore remains false.

**PhilipsHue.cpp**

In `GetV2Sensors()`, Domoticz then uses that value directly:

`InsertUpdateSwitch(nodeID, 1, STYPE_Dusk, ll.dark, darkName, llBattery);`

The lux reading is converted and sent separately using `SendLuxSensor()`.

Consequently, a valid light-level reading can coexist with a Dusk Sensor switch being set to OFF.

### 3. The ten-minute resynchronisation

The `Do_Work()` function in `PhilipsHue.cpp` contains:

`if (m_use_v2_sensors && m_v2sensors && sec_counter % 600 == 0)`

This calls `GetV2Sensors()` every 600 seconds.

That is exactly ten minutes.

This appears to match my observations on 16 November:

- Following a Domoticz restart, the Dusk Sensor switches initially showed ON.
- Approximately ten minutes later, they changed to OFF.
- Seven of the eight sensors changed within a 13-second period.
- Lux readings continued to update.

The SSE real-time event handler, `HandleSSELightLevel()`, also initialises `dark` to false and only changes it if the incoming event contains a `dark` property. It then uses that value to update the Dusk Sensor switch.

### 4. Extent of the problem

The problem affects all eight Hue motion sensors across three independent V2 bridges (properties 12, 38 and 46).

The sensors continue to report light levels, including zero lux in darkness. Motion and temperature reporting also continue to work.

The Dusk Sensor switches nevertheless remain OFF.

I have temporarily changed my automations to use light-level readings instead.

### 5. Questions for the developers

Could someone familiar with the Philips Hue V2 implementation please clarify:

1. Is the `dark` property expected to be supplied by the Hue V2 `light_level` resource, or should Domoticz calculate darkness from the light-level reading?
2. If the property is optional or absent, should Domoticz really default it to false and set the Dusk Sensor switch OFF?
3. Is the ten-minute resynchronisation expected to overwrite the existing Dusk Sensor state in this way?
4. Why do the switches initially show ON after a Domoticz restart, before changing to OFF at the first ten-minute resynchronisation?

I appreciate that the initial ON state may involve a separate update path, which I have not yet fully traced.

**My suspicion is that Domoticz is creating and maintaining Dusk Sensor devices for Hue V2 light-level resources, but is not handling the absence of the `dark` property correctly.**

Relevant source files:

- `hardware/PhilipsHue/PhilipsHueV2Sensors.h`
- `hardware/PhilipsHue/PhilipsHueV2Sensors.cpp`
- `hardware/PhilipsHue/PhilipsHue.cpp`

All examined at release commit `cc668a1` (Domoticz 2026.4).
User avatar
gizmocuz
Posts: 3100
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by gizmocuz »

Thanks for the very thorough write-up, and especially for digging into both the Hue V2 API and the Domoticz source. Your analysis is correct, and yes, this is a real Domoticz issue. I can reproduce it here.

In the CLIP v2 API the light_level resource only reports:
  • light_level (the raw value)
  • light_level_valid
  • light_level_report (the changed timestamp)
There is no dark (or daylight) field in v2. Those existed only in the old v1 ZLLLightLevel sensor, where the bridge computed dark from the tholddark/tholdoffset config. Domoticz still reads light.dark when it builds the Dusk switch, and because that member is absent in v2 it falls back to false, so the Dusk Sensor is set to Off. The full resync that runs about every 10 minutes (600s) re-reads the light_level resources and pushes that Off again, which is exactly what you see: On right after a restart, then Off ~10-11 minutes later. Motion and temperature are unaffected because they carry their own state in the v2 payload.

So to answer your questions directly: the Dusk Sensor is being updated, but from a field the v2 API does not provide, so its state is effectively always Off. Domoticz does not currently derive dusk from the lux value for v2, and the 600s resync is what overwrites it. We did not change this part of the code recently, so the trigger was most likely a Hue bridge firmware change or the switch to the v2 API.

I have fixed this: for v2 devices Domoticz now derives the dusk state from the measured light level (dark below about 3 lux) instead of the missing dark field, and a resource that does not report a reading yet no longer flips the Dusk switch. It will be in the next beta, so please update once it is out and let me know if the Dusk Sensors follow darkness again. Your workaround of driving the automations from the Lux value remains perfectly valid.

As always, please keep running the latest beta.
Quality outlives Quantity!
mikedavies1953
Posts: 14
Joined: Thursday 09 January 2020 19:24
Target OS: Windows
Domoticz version:
Contact:

Re: Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by mikedavies1953 »

Thanks for investigating and fixing it.

I’m glad I was able to supply the relevant information. Your response is particularly helpful because it confirms that diagnosis and that the trigger was most likely a Hue bridge firmware change or the switch to the v2 API.

I will download the next beta, confirm the behaviour of the dusk switches and then mark this fixed.

Thanks again.
mikedavies1953
Posts: 14
Joined: Thursday 09 January 2020 19:24
Target OS: Windows
Domoticz version:
Contact:

Re: Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by mikedavies1953 »

Just one further question. I see that Windows beta 2026.4.18690 is dated 29 November. Can you confirm whether your Hue V2 Dusk Sensor correction is included in that build, or will it appear in a subsequent beta?
User avatar
waltervl
Posts: 7051
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: Philips Hue V2 – Dusk Sensor switches changing to OFF after restart

Post by waltervl »

Probably in that build already, see https://github.com/domoticz/domoticz/co ... f7784ec1a9
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply