veonua / SmartThingsEdge-Xiaomi

SmartThings Edge drivers for XIaomi and Aqara devices
MIT License
67 stars 59 forks source link

SP-CEU01 outlet missing parameter, no voltage measurement ability #6

Closed pxFIN closed 2 years ago

pxFIN commented 2 years ago

lumi.plug.maeu01

Experimenting this sensor i could find the sensor, switch works, power measurement works.. energy consumption is expected to be kWh so its too high value .. i think it should be divided by 1000 ? This sensor version to my understanding doesnt have voltage measurement.. and temperature measurement is missing

Also is it possible to add link quality value ?

veonua commented 2 years ago

energy consumption is expected to be kWh so it's too high value .. I think it should be divided by 1000 ?

I would ask you to attach a log here because now it's hard to tell which cluster sends this info. there are 3 options.

This sensor version to my understanding doesnt have voltage measurement.. and temperature measurement is missing

there is no temperature sensor, only a temperature of the chip, which is not really useful for precise measures.

Also is it possible to add link quality value ? it's possible, but I would like to keep the views consistent between other devices. Also, the link quality values come quite slowly... don't see a use-case here.

pxFIN commented 2 years ago

My bad: (live logging)

13:26:56: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: 'read attr - raw: 34F9010702120000250C0000000000, dni: 34F9, endpoint: 01, cluster: 0702, size: 18, attrId: 0000, result: success, encoding: 25, value: 00000000000c' 13:30:23: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: 'read attr - raw: 34F9010702120000250D0000000000, dni: 34F9, endpoint: 01, cluster: 0702, size: 18, attrId: 0000, result: success, encoding: 25, value: 00000000000d'

13:29:07: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: 'read attr - raw: 34F9010B040A0B05298000, dni: 34F9, endpoint: 01, cluster: 0B04, size: 10, attrId: 050b, result: success, encoding: 29, value: 0080'

veonua commented 2 years ago

us this log from Groovy? Lua has slightly better output. Values are in decimal and cluster are printed in human readable format

On Fri, 26 Nov 2021 at 20:23, pxFIN @.***> wrote:

To be honest i dont know if this HW has certain parameters.. i only see what live logging shows

So

  • Temp
  • Power
  • Energy / 1000

For certain.. else ?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/veonua/SmartThingsEdge-Xiaomi/issues/6#issuecomment-980333061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYALQ4GW5WEDQKZEHX5P3UN7NCDANCNFSM5IZ6S6LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pxFIN commented 2 years ago

Logs are from groovy point being to see what kind of data is coming from sensor

pxFIN commented 2 years ago

Your EDGE driver doesnt bring any debug logs. Would be good to have in settings option to turn on debug/trace logs

pxFIN commented 2 years ago

energy consumption is expected to be kWh so it's too high value .. I think it should be divided by 1000 ?

I would ask you to attach a log here because now it's hard to tell which cluster sends this info. there are 3 options.

This sensor version to my understanding doesnt have voltage measurement.. and temperature measurement is missing

there is no temperature sensor, only a temperature of the chip, which is not really useful for precise measures.

Also is it possible to add link quality value ? it's possible, but I would like to keep the views consistent between other devices. Also, the link quality values come quite slowly... don't see a use-case here.

About temp yes i agree value is way off.. maybe offset or compensation value would be good in settings ?

veonua commented 2 years ago

I can see SimpleMetering values 0x0c and 0x0d and ElectricalMeasurement, ActivePower 0x0080 = 127

so the Simple Metering value needs to be divided by 1000?

veonua commented 2 years ago

new driver published with

device:set_field(constants.SIMPLE_METERING_DIVISOR_KEY, 1000, {persists= true})

this setting will be applied only to newly added devices.

pxFIN commented 2 years ago

so the Simple Metering value needs to be divided by 1000?

I did comparison with zigbee2mqtt so yes although i cant be sure to me it looks by dividing by 1000 is correct

pxFIN commented 2 years ago

us this log from Groovy? Lua has slightly better output. Values are in decimal and cluster are printed in human readable format On Fri, 26 Nov 2021 at 20:23, pxFIN @.***> wrote: To be honest i dont know if this HW has certain parameters.. i only see what live logging shows So - Temp - Power - Energy / 1000 For certain.. else ? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#6 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYALQ4GW5WEDQKZEHX5P3UN7NCDANCNFSM5IZ6S6LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Since I am new to the EDGE drivers, how can i see lua output/debug logs ?

veonua commented 2 years ago

https://github.com/SmartThingsCommunity/smartthings-cli

smartthings edge:drivers:logcat

veonua commented 2 years ago

@pxFIN any luck with logs?

pxFIN commented 2 years ago

@pxFIN any luck with logs?

Yes sure.. can you get anything from this


? Select a driver. 1 2021-12-15T18:35:02.384669491+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:35:05.279674491+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:35:05.330208491+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x00, dest_addr: 0x0000, dest_endpoint: 0x00, profile: 0x0000, cluster: 0x8001 >, lqi: 0xBC, rssi: -53, body_length: 0x000C, < ZDOMessageBody || < ZDOHeader || seqno: 0x2F >, GenericBody: 00 00 15 82 3C DF 8C CF 04 E8 B4 > > 2021-12-15T18:35:05.444629824+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:35:06.166606824+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:35:06.196565158+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC4, rssi: -51, body_length: 0x0007, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x29, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Boolean, OnOff: true > > > > 2021-12-15T18:35:06.243489824+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:35:06.262414824+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff 2021-12-15T18:35:06.279569491+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":"on"},"capability_id":"switch","component_id":"main","attribute_id":"switch"} 2021-12-15T18:35:06.326881491+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:35:32.394733142+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:35:58.200086821+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:35:58.224427487+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: ElectricalMeasurement >, lqi: 0xC8, rssi: -50, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x08, seqno: 0x32, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x050B, DataType: Int16, ActivePower: 93 > > > > 2021-12-15T18:35:58.242672154+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:35:58.257583154+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: ElectricalMeasurement, attribute: ActivePower 2021-12-15T18:35:58.271232821+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":93.0,"unit":"W"},"capability_id":"powerMeter","component_id":"main","attribute_id":"power"} 2021-12-15T18:35:58.301898821+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:36:02.378094489+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:36:15.285889496+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:36:15.372539829+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: ElectricalMeasurement >, lqi: 0xCC, rssi: -49, body_length: 0x0008, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x08, seqno: 0xA7, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x050B, DataType: Int16, ActivePower: 190 > > > > 2021-12-15T18:36:15.455724496+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:36:15.509574496+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: ElectricalMeasurement, attribute: ActivePower 2021-12-15T18:36:15.526344496+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":190.0,"unit":"W"},"capability_id":"powerMeter","component_id":"main","attribute_id":"power"} 2021-12-15T18:36:15.601356829+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:36:32.410263837+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:37:02.411667851+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:37:31.343491532+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:37:31.370385532+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: SimpleMetering >, lqi: 0xCC, rssi: -49, body_length: 0x000C, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0xFE, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Uint48, CurrentSummationDelivered: 0x00000000002E > > > > 2021-12-15T18:37:31.414130865+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:37:31.421896199+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: SimpleMetering, attribute: CurrentSummationDelivered 2021-12-15T18:37:31.454708865+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":0.046,"unit":"kWh"},"capability_id":"energyMeter","component_id":"main","attribute_id":"energy"} 2021-12-15T18:37:31.507664199+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:37:32.403580199+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:38:02.430115547+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:38:32.425471561+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:39:02.431593575+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:39:32.427983793+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:40:02.442878807+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:40:31.090349821+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:40:31.146331488+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: OnOff >, lqi: 0xC4, rssi: -51, body_length: 0x0007, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0x93, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Boolean, OnOff: true > > > > 2021-12-15T18:40:31.252020154+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:40:31.269528488+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: OnOff, attribute: OnOff 2021-12-15T18:40:31.296207821+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":"on"},"capability_id":"switch","component_id":"main","attribute_id":"switch"} 2021-12-15T18:40:31.420331154+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:40:32.433747821+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll 2021-12-15T18:40:49.306144496+00:00 TRACE Xiaomi Plug Received event with handler zigbee 2021-12-15T18:40:49.316244163+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> received Zigbee message: < ZigbeeMessageRx || type: 0x00, < AddressHeader || src_addr: 0xB4E8, src_endpoint: 0x01, dest_addr: 0x0000, dest_endpoint: 0x01, profile: 0x0104, cluster: SimpleMetering >, lqi: 0xC4, rssi: -51, body_length: 0x000C, < ZCLMessageBody || < ZCLHeader || frame_ctrl: 0x18, seqno: 0xDA, ZCLCommandId: 0x0A >, < ReportAttribute || < AttributeRecord || AttributeId: 0x0000, DataType: Uint48, CurrentSummationDelivered: 0x00000000002F > > > > 2021-12-15T18:40:49.353287830+00:00 TRACE Xiaomi Plug Found ZigbeeMessageDispatcher handler in plug 2021-12-15T18:40:49.358928496+00:00 INFO Xiaomi Plug Executing ZclClusterAttributeValueHandler: cluster: SimpleMetering, attribute: CurrentSummationDelivered 2021-12-15T18:40:49.373488496+00:00 INFO Xiaomi Plug <ZigbeeDevice: 7406b697-1d36-4557-9cda-928ddeebacd0 [0xB4E8] (Aqara Zigbee EU Smart Outlet)> emitting event: {"state":{"value":0.047,"unit":"kWh"},"capability_id":"energyMeter","component_id":"main","attribute_id":"energy"} 2021-12-15T18:40:49.411677496+00:00 DEBUG Xiaomi Plug Aqara Zigbee EU Smart Outlet device thread event handled 2021-12-15T18:41:02.463722169+00:00 TRACE Xiaomi Plug Received event with handler zigbee health poll listening for logs... done


Btw by no voltage measurement i meant this device version doesnt have the ability .. or can i test it somehow .. in smartthings app for example still shows voltage which is always zero... if someone else can confirm that voltage measurement should be removed

Scenario above is i plugged the plug in socket.. turn it on.. and then put my phone charger with phone connected

So you need some other scenarios tested ?

PS. this is new to me using smartthings cli for logs.. thanks for the info!

veonua commented 2 years ago

so it says CurrentSummationDelivered == 47 (0x00000000002F) that value was transformed to 0.047 kWh

is this right?

pxFIN commented 2 years ago

In fact this can't be right

emitting event: {"state":{"value":190.0,"unit":"W"},"capability_id":"powerMeter","component_id":"main","attribute_id":"power"}

I connected 18W charger and verified using other equipment yes it is so the value should still be divided by 10

CurrentSummationDelivered i am not sure yet.. can you make new commit powermeter is divided by 10

veonua commented 2 years ago

try to re-add the device

pxFIN commented 2 years ago

powerMeter value is now OK (realistic).. checked from smartthings logs and android smartthings app

Energy consumption is way too high

Someone correct me if i am wrong

E(kWh) = P(W) × t(hr) / 1000

So consumption as an example = 18W * 1 hour / 1000 = 0.018 kWh

I wonder is smartthings expecting Wh value or kWh.. in my last experiment kWh were rising by 0,1kWh every 3-5 minutes which is not possible having 18-19W usage

I have to get back to this later... to really think it over

veonua commented 2 years ago

please open a new issue for consumption when you are ready

On Thu, 23 Dec 2021 at 17:08, pxFIN @.***> wrote:

powerMeter value is now OK (realistic).. checked from smartthings logs and android smartthings app

Energy consumption is way too high

Someone correct me if i am wrong

E(kWh) = P(W) × t(hr) / 1000

So consumption as an example = 18W * 1 hour / 1000 = 0.018 kWh

I wonder is smartthings expecting Wh value or kWh.. in my last experiment kWh were rising by 0,1kWh every 3-5 minutes which is not possible having 18-19W usage

I have to get back to this later... to really think it over

— Reply to this email directly, view it on GitHub https://github.com/veonua/SmartThingsEdge-Xiaomi/issues/6#issuecomment-1000398676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALYALVT5HROVOKYUGZUDGDUSNCODANCNFSM5IZ6S6LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>