Ambient Light Sensor: Force Update

Guidances to solve typical issues.
Anleitungen, um typische Fragestellungen zu lösen.
Post Reply
theflyinggiraffe
Posts: 3
Joined: Mon Dec 16, 2019 11:14 pm

Ambient Light Sensor: Force Update

Post by theflyinggiraffe » Mon Feb 01, 2021 11:31 am

I'm having trouble with the ambient light sensor, which only seems to update periodically (from what I've seen, it's every 5 minutes).

The scenario:
  • The kitchen lights turn on with a motion sensor when presence is detected AND it is dark
  • They go off 1 minute after presence is no longer detected
This works nicely, but consider these events:
  • It is dark. I walk into the kitchen. The sensor detects motion and turns on the lights
  • When the light sensor next takes a reading, it's sampling ambient + the rooms lights (which are on). This changes its status to 'not dark'
  • I leave the room, and a minute later the lights go off
  • I walk back into the room and the lights don't come on, as the light sensor hasn't taken another reading since the lights went off (and hence it thinks it is still 'not dark').
How do I force the light sensor to trigger a new reading?

User avatar
MarcusZ.
Posts: 151
Joined: Sun Jan 20, 2019 4:44 pm

Re: Ambient Light Sensor: Force Update

Post by MarcusZ. » Sun Feb 07, 2021 1:52 pm

Unfortunately you cannot really force it. This is the way the battery operated motion sensor hardware works, specified by its firmware, and not changeable: it only updates sensor values on motion, or every 5 minutes (when no motion).

That is also the reason why the original hue app creates a ton of rules for the motion sensor, and works like a state machine, to catch some points similar to the ones that you mentioned.

What you can do:
- Create a number based memory sensor in all4hue (name it like "MyAmbientKitchen")
- Add some rules to update its value when the original sensor changes, but limit it to the relevant events (like when none of the influencing lights is on, using a blocking condition from their group state)
- See if you can achieve your desired behaviour step by step
- If the logic gets more complicated it may be a good thing to use a dedicated memory sensor for the states of your motion rules, like 'armed' (0), 'motion' (1), 'dimmed' (2), 'temporary off' (-1), ...

I hope this information is helpful an can bring you closer to a solution.
Regards,
Marcus
2x Bridge V2 (+deCONZ/HA-Bridge)
Hue Go (+BT), Lightstrip (in/out), Play, Bloom; E14+E27 Bulb; Iris, Aura.
Motion sensor (in/out), Dimmer (old/new), Smart Button, Tap Dial.

P.S.: Ich bin *kein* Entwickler von all 4 hue, aber Hue Poweruser!

theflyinggiraffe
Posts: 3
Joined: Mon Dec 16, 2019 11:14 pm

Re: Ambient Light Sensor: Force Update

Post by theflyinggiraffe » Tue Feb 09, 2021 4:14 pm

Thanks for your reply Marcus.

I've ended up doing something pretty similar to that, where I have an intermediate flag that updates on light state update (but only changes from dark to light if none of the lights in that room are on).

I'd read that it updates every 5 minutes AND every time motion is detected. I guess the hub must find out about the motion (and hence process rules triggered from the change) BEFORE it finds out about the change in light. Otherwise my original plan would work.

Cheers,

Geoff

User avatar
MarcusZ.
Posts: 151
Joined: Sun Jan 20, 2019 4:44 pm

Re: Ambient Light Sensor: Force Update

Post by MarcusZ. » Tue Feb 09, 2021 9:48 pm

Hello Geoff,

Unfortunately there is no detailed documentation about the 'internals' of the sensor nor the (nevertheless amazing) rule engine on the bridge.

I'd guess it does update motion sensor and ambient (and maybe temperature) states at about the same time. Then the triggered rules will probably run virtually in parallel.

You could try to delay your motion triggered rules, which involve the virtual ambient flag as additional condition, by 500ms (you can start with more, and try to reduce if it works). There is an option to set a delay for the trigger rule (motion sensor status changed) by editing it and changing the mode by scrolling down to the bottom.

Maybe that could do the trick. ^^

Regards,
Marcus
2x Bridge V2 (+deCONZ/HA-Bridge)
Hue Go (+BT), Lightstrip (in/out), Play, Bloom; E14+E27 Bulb; Iris, Aura.
Motion sensor (in/out), Dimmer (old/new), Smart Button, Tap Dial.

P.S.: Ich bin *kein* Entwickler von all 4 hue, aber Hue Poweruser!

Post Reply