But this is not cached then? Or is I missing what you mean with cached Item
in your description.
The main problem is that we need to set an update interval instead of leaving the socket open, and that it closes as soon as it changes status. When you have several of the hue motion sensors it DOES slow down the whole system a lot, when you pull it faster than 2000ms, and 2s is to slow for bathroom, but OK for hallway, garages etc…
I maybe should read the statement more carefully. It tells us, that the present status is reported every 5 minutes AND when the sensor value changes. Which leads to the conclusion that we can detect a possible presence with smaller polling frequency. The difference is that the Hue binding does not poll a single sensor like we now have if we follow my tutorial. it polls all sensors at the same time with one request which minimizes resources.
Well, if you depend on the polling - probably yes. But if you use it in combination with the native zigbee binding of @chris, the HUE motion sensors work quite well:
Presence is reported immediately.
I know, abandon the HUE bridge and switch to the native zigbee binding suits not everyones use case or requirements. But if it does, it’s worth a try
Some drawbacks though: Temperature reporting is quite inaccurate (probably the same in @cweitkamp’s solution?) and battery level is not working. AND: the LED is flashing red when movement is detected. This is different to the behaviour when paired with a HUE bridge IIRC.
After updating to milestone M5 i get this error every 6-8 hours.
2018-11-04 02:08:31.716 [ERROR] [org.openhab.io.net.http.HttpUtil ] - Fatal transport error: java.net.SocketException: Too many open files
2018-11-04 02:08:31.717 [ERROR] [ab.binding.http.internal.HttpBinding] - No response received from 'http://192.168.1.118/api/***/s$2Fmp/sensors/11'
2018-11-04 02:08:32.224 [hingStatusInfoChangedEvent] - 'hue:bridge:0017****' changed from ONLINE to OFFLINE: Verbindung zur Hue Bridge unterbrochen.
I have wrote a new topic for this, but now i see that sensor11 is a motion sensor which works with your code. The refresh intervall ist 750. Before updating to M5 all runs okay. Now the system makes a restart. And the cpu load increases up to 6% in the middle from 2% before.
I am pretty sure a lot of stuff has changed since OH2.3 but I cannot imagine something which is related to the HTTP binding. I do not poll my sensors with such a high frequency. And the HttpUtil uses a default timeout of 5 seconds. Maybe you have to look deeper into that to solve your issue.
I saw in github that you are taking over to implement motion sensor support into the hue binding itself. Is the plan to only support motion sensor or is the dimmer switch also in the todo list? One other thing that I saw was the internal scenes of hue api. See this thread. Would a scene selector also be something to implement in the binding?
P.S. Looking forward for your work and to test the new features of the binding
Yes, that is true. I already put some code together to make it stable and usable for others. I would love to provide a test version for everyone who is interested. The current solution will support the Hue Motion Sensor - splitted up into three different things (motion sensor, temperature sensor and illumination sensor) - and the Dimmer Switch as well.
I agree with you that scene support will be a great feature too. But first I will focus on the sensor support.