-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Hue bulb not updating brightness when controller with hue dimmer remote #2108
Comments
Looks like I did get an attReport after a while, brightness not updated though :(
|
Known issue (limitation of bulb)
See OP of #1064 |
That sucks, the other issue does mention the values can be querried somehow... but It didn;t mention how. A quick look through the docs doesn't seem to get me any further. How would one poll the bulb say every 3 minutes + after a state change? That would probably be sufficient for my workflow. |
|
I've stubbed out the a general plan on how I can work around this in node-red, but maybe this will work in zigbee2mqtt too?
We might not have to query the propery and maybe we can just use the value published byu thge bind? (do groups do that too?) And maybe query the actually bulb after some sort of timer that gets reset every update, to not cause too much traffic. Anyway, I know I can do this with node-red and it will probably take me a few weekends. But maybe it is easier in zigbee2mqtt? If so, where would one need to look to add something like this? There seems to be an extesions framework but is that sufficient? |
If we want to add this to zigbee2mqtt it should be done in the reporting extension (https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/extension/deviceReport.js). There we know all the binds. |
I'll give that a try first, I'm sure that would benefit other people... So for now the general plan is to start small and only do brightness for starting. So in deviceReport.js when endpoint.supportsInputCluster is false for genLevelCtrl to sort of go into a 'emulated' mode for it. Well first attempt would just to log if it is false to see if the hue bulbs correctly report that they do not support genLevelCtrl. If they lie, that idea is down the drain. If it does not lie, then I guess I need to create a endpoint.emulateReporting function and take it from therem but this will be my first time doing typescript so I imagine progress will be slow. |
Ouch, not off to a great start... I tried adding Does logger not work in an async block? |
After some more digging, it looks like the bulb already has I also tried power cycling the bulb, so that it resets and reannounces it self to the network, it then fires the shouldSetupReporting functions a few times with different messages, but So my plan to add an else block here that would check for genLevelCtrl (and a report_emulation device configuration property) to then setup some sort emulation as mentioned earlier won't work. I had a quick look around, but it looks like setupReporting will set the Is my basic approuch here wrong? Maybe I can do the check in the onZigbeeStartup and add a shouldSetupEmulatedReporting and setupEmulatedReporting functions/event callbacks instead? |
I think I have bitten of more than I can chew, I have been digging around in zigbee2mqtt, but also zigbee-herdman to try and figure out a workable plan... but I seem to be missing a lot of things :(
edit: bad draft code removed Then the idea is to modify onZigbeeEvent to loop the device's bind devices excluding the coordinator and check if the device has the report_emulate property, if so then call the updates for the required property. The do the same for all group members when a group gets an update. |
Going to call it a night for today, will have an hour or 4 to work on this tomorrow, so far I have: diff --git a/lib/extension/deviceReport.js b/lib/extension/deviceReport.js
index 6faa855..03699fd 100644
--- a/lib/extension/deviceReport.js
+++ b/lib/extension/deviceReport.js
@@ -2,6 +2,7 @@ const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
const logger = require('../util/logger');
const CC2530Router = zigbeeHerdsmanConverters.devices.find((d) => d.model === 'CC2530.ROUTER');
const utils = require('../util/utils');
+const settings = require('../util/settings');
const BaseExtension = require('./baseExtension');
const defaultConfiguration = {
@@ -64,6 +65,22 @@ class DeviceReport extends BaseExtension {
this.configuring.delete(device.ieeeAddr);
}
+ async setupReportingEmulation(deviceSettings, device) {
+ for (const emulate_cluster of deviceSettings.report_emulate) {
+ if (clusters.hasOwnProperty(emulate_cluster)) {
+ // XXX: somehow mark update 'device' as needing emulation for this cluster
+ // can we device.meta for this, and just reset this every startup?
+ logger.info(
+ `Succesfully setup reporting emulation for '${device.ieeeAddr}' - ${emulate_cluster}`
+ );
+ } else {
+ logger.error(
+ `Failed to setup reporting emluation for '${device.ieeeAddr}' - unknown cluster ${emulate_cluster}`
+ );
+ }
+ }
+ }
+
shouldSetupReporting(mappedDevice, device, messageType) {
if (!device) return false;
@@ -80,6 +97,12 @@ class DeviceReport extends BaseExtension {
return true;
}
+ shouldSetupReportingEmulation(deviceSettings, device) {
+ if (deviceSettings.hasOwnProperty("report_emulate") && Array.isArray(deviceSettings.report_emulate))
+ return true;
+ return false;
+ }
+
async onZigbeeStarted() {
this.coordinatorEndpoint = this.zigbee.getDevicesByType('Coordinator')[0].endpoints[0];
@@ -88,6 +111,10 @@ class DeviceReport extends BaseExtension {
if (this.shouldSetupReporting(mappedDevice, device, null)) {
this.setupReporting(device);
}
+ const deviceSettings = settings.getDevice(device.ieeeAddr);
+ if (this.shouldSetupReportingEmulation(deviceSettings, device)) {
+ this.setupReportingEmulation(deviceSettings, device);
+ }
}
} @Koenkk see my XXX comment
I need a place to store 'runtime' info on which clusters to emulate reporting for, we update this info every startup from configuration.yaml so they don't need to be stored in the database. Reading the settings from the configuration on every event seems to be a huge waste of resources, But I don't see a 'runtime' equivalent of device.meta. |
I got something working, I will open a PR. |
Bug Report
What happened
After I managed to bind my hue dimmer to my hue bulb, I noticed the bulb does not report the correct brightness after changing it with the dimmer.
What did you expect to happen
To get a update (via attReport) after a while with the new brightness, but it keeps being the old brightness. Toggling state will trigger a correct update... but brightness is still left untouched.
How to reproduce it (minimal and precise)
<no update>
<wait for a few minutes, no attReports are arriving>
Debug Info
zigbee2mqtt version: 1.6.0 (commit #ba92f73)
CC253X firmware version:
{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190425}}
The text was updated successfully, but these errors were encountered: