-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add power outage count to LLKZMK11LM and SSM-U01 #3972
Add power outage count to LLKZMK11LM and SSM-U01 #3972
Conversation
lib/xiaomi.js
Outdated
@@ -160,7 +160,7 @@ const numericAttributes2Payload = (msg, meta, model, options, dataObject) => { | |||
payload.mode_switch = {4: 'anti_flicker_mode', 1: 'quick_mode'}[value]; | |||
break; | |||
case '5': | |||
if (['JT-BZ-01AQ/A', 'RTCZCGQ11LM'].includes(model.model)) { | |||
if (['JT-BZ-01AQ/A', 'LLKZMK11LM', 'RTCZCGQ11LM', 'SSM-U01'].includes(model.model)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure the major part (if not all) the devices of Xiaomi with a field 5 use it for power_outage_count. Maybe is better to simply remove the condition and let it for all waiting for some complains if any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I noticed, this parameter applies only to devices with stationary power supply, so if you remove the filter by models, then it seems to me that you need to add a filter by power source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly, only if the device publishes a "5" attribute. Do you know if some battery device publishes it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly, only if the device publishes a "5" attribute.
Of course, only if the device publishes a "5" attribute.
Do you know if some battery device publishes it?
So far I haven't come across any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if some battery device publishes it?
I'm sorry, but my previous answer is not correct, because I didn't understand the question correctly.
I have 3 battery-powered devices that publishes a "5" attribute, but at the same time it is clearly not the value of power_outage_count, but something else:
-
lumi.sensor_ht.agl02: unknown index 1 with value 3035 lumi.sensor_ht.agl02: unknown index 3 with value 22 lumi.sensor_ht.agl02: unknown index 4 with value 424 lumi.sensor_ht.agl02: unknown index 5 with value 36 lumi.sensor_ht.agl02: unknown index 6 with value 11 lumi.sensor_ht.agl02: unknown index 8 with value 284 lumi.sensor_ht.agl02: unknown index 10 with value 0 lumi.sensor_ht.agl02: unknown index 12 with value 1 lumi.sensor_ht.agl02: unknown index 100 with value 2270 lumi.sensor_ht.agl02: unknown index 101 with value 2098 lumi.sensor_ht.agl02: unknown index 102 with value 1001
-
lumi.motion.agl02: unknown index 1 with value 3060 lumi.motion.agl02: unknown index 3 with value 25 lumi.motion.agl02: unknown index 4 with value 424 lumi.motion.agl02: unknown index 5 with value 776 lumi.motion.agl02: unknown index 6 with value 19 lumi.motion.agl02: unknown index 8 with value 291 lumi.motion.agl02: unknown index 10 with value 0 lumi.motion.agl02: unknown index 12 with value 1 lumi.motion.agl02: unknown index 100 with value 0 lumi.motion.agl02: unknown index 101 with value 2 lumi.motion.agl02: unknown index 102 with value 3 lumi.motion.agl02: unknown index 103 with value 1 lumi.motion.agl02: unknown index 104 with value 168
-
lumi.motion.agl04: unknown index 1 with value 3112 lumi.motion.agl04: unknown index 3 with value 25 lumi.motion.agl04: unknown index 4 with value 424 lumi.motion.agl04: unknown index 5 with value 491 lumi.motion.agl04: unknown index 6 with value 15 lumi.motion.agl04: unknown index 8 with value 282 lumi.motion.agl04: unknown index 10 with value 0 lumi.motion.agl04: unknown index 12 with value 1 lumi.motion.agl04: unknown index 100 with value 0 lumi.motion.agl04: unknown index 101 with value 0 lumi.motion.agl04: unknown index 102 with value 3 lumi.motion.agl04: unknown index 103 with value 1 lumi.motion.agl04: unknown index 104 with value 168 lumi.motion.agl04: unknown index 105 with value 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Koenkk don't merge this. It seems is not working. Wait please to let me do more tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will wait, can you also add power_outage_count
expose to more devices?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, the correct one was if (meta.device.powerSource === 'DC Source')
.
I'm sorry but I don't have more devices with DC Source to test them. But it you or @Otnow can point me to some of them I will add it. My idea was to wait to reports of "state" with the value to add them in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect that the devices that use the aqara_opple converter will have it. But I can't confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Koenkk It seems some devices use the DC Source
like LLKZMK11LM and others the Mains (single phase)
like the SSM-U01. I have let both finally.
01e5b2e
to
42aff4a
Compare
devices/xiaomi.js
Outdated
.withDescription('Enabling prevents both relais being on at the same time')], | ||
.withDescription('Enabling prevents both relais being on at the same time'), | ||
exposes.numeric('power_outage_count', ea.STATE) | ||
.withDescription('Number of power outages (since last pairing)'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing I've observed is that the number of outages does not return to zero when pairing for LLKZMK11LM. It returns to zero for SSM-U01. So I think I will change this message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message changed.
@Koenkk maybe is better to add a new preset for this, like this:
zigbee-herdsman-converters/lib/exposes.js
Line 585 in bf49c91
power_outage_memory: () => new Binary('power_outage_memory', access.ALL, true, false).withDescription('Enable/disable the power outage memory, this recovers the on/off mode after power failure'), |
With a text that does not specify if it returns to zero or not when pairing or with a parameter that changes the text? There are a more devices that have this attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new commit with the preset.
42aff4a
to
57fbcb2
Compare
7f7999c
to
73ff146
Compare
73ff146
to
ca5a8fc
Compare
I think this is now ready to be merged, except if someone can point me some other devices that publish the |
thanks! |
Adds the power outage count field to the LLKZMK11LM and SSM-U01 devices.