-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poll battery percentage remaining for sensors. #1171
Conversation
- Apply `config.offset` when updating `state.temperature` or `state.humidity`, see #1154; - Also update etag and save to database when only `config.reachable`, `config.battery`, and/or `state.lastupdated` are updated; - Issue event when `state.lastupdated` is updated to fire rules based on `state.lastupdated`.
For icasa keypads, see #1124
I think this is tricky to decide in the idle timer. Many devices sleep for a longer time, for example the Ikea switches mac polls only every 5 minutes. Sending a zcl read attributes makes mostly sense when we can be sure the device is likely awake, otherwise the command gets lost within the next 7 seconds (mac transaction expired). I would suggest two things:
|
The way I understand the code (and what I observe), the While
My question is really about what logic to apply on setting the flag. It checks the timestamp of the cached ZCL value, so it will not be set if an attribute report was received recently. |
To double-check, I changed the timing in |
Additional _Level Control_ attributes from ZCL spec. Only my OSRAM Gardenspot seems to support these.
You can now PUT a light state with a body of e.g. `{"on": true, "ontime": ` _t_ }` to set a light on for _t_/10 seconds. This generates the _On With Timed Off_ command. Similar to `state.transitiontime`, `state.ontime` is write-only and not returned when GETting the light state.
Unchanged config attributes sometimes included in websocket notification when `webSocketNotifyAll` is false.
Battery polling seems stable in production - I only see read attribute requests for the (non-Xiaomi) sensors that report battery at intervals > 30 minutes. No timeouts - they're issued only when the device is awake. While the mechanism works, I'm still not happy setting the battery attribute reporting interval for the Hue motion sensor to 2 hrs to conserve battery, but then start polling every 30 minutes. Also, the default reporting interval for battery is 45 minutes. I would suggest to change the Hue motion sensor interval to 45 minutes as well (so deviating from the Hue bridge), and then setting the polling-when-awake interval to 1 hour. @manup, do you agree? The alternative would be to copy the sensor whitelist from bindings.cpp and set the polling-when-awake interval to match the reporting interval. While that seems functionally better, I really don't like the increased code complexity caused by yet another place where we whitelist models. Found a nasty bug in web socket notifications for sensor config - been breaking my head around that one for quite a while. |
I would prefer that devices which support reporting the battery 0x0021 attribute are excluded from polling. This can be checked in a generic way similar to https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/bindings.cpp#L1154 There is also Climax devices which have Power Configuration cluster but don't support the 0x0021 attribute and instead report only the Battery Alarm Mask attribute (0x0035). Some devices have Power Configuration cluster but might not respond to reading attributes after a button press (Trust, Paul Neuhaus, Osram?) this needs more testing with various devices to get a picture. I'm very concerned about requests to sleeping devices which might bring back queue issues of the past. I'd like to introduce this carefully and enable it only for the iCase devices for now, since it seems to work well for them.
I guess these intervals are very device specific; polling iCase switches shouldn't affect other devices. |
Yes, I share that concern. I don't oversee the full impact, and really appreciate your input.
Fair point. I'll whitelist the iCasa Pulse keypads and only query the battery status for these, making sure we don't impact any other devices. When/if we'll find we need to do this for other devices, we can add them to the whitelist. |
Agree, this should provide a smooth introduction, which can be extended over time. |
Should be good to go. |
Poll battery percentage remaining (0x0001/0x0021) for
/sensors
resources The change is for the iCasa Pulse keypads, which don't offer attribute reporting, see #1124.@manup, please review. This is working fine in my test network, but I worry about the potential performance implications, and battery usage implications for other devices, see #1124 (comment).