dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 502 forks source link

Aqara Single Switch Module T1 (with Neutral) #3380

Closed spn91 closed 3 years ago

spn91 commented 4 years ago

Device

https://www.aqara.cn/en/single_switch_T1_with-neutral.html

Screenshots

image image image image

aqara-t1-single-switch-connecting-and-triggering.pcapng.zip

zigbee_pc_keys.txt

Smanar commented 4 years ago

Ha nice ^^ I have started a discussion yesterday with another user about this device, there is a problem ATM for this device, the cluster 0x0006 is invisible (but present).

Do you have a zigbee sniffer ?

Smanar commented 4 years ago

Ok so have a take a look on the sniff with original gateway

SwoopX commented 4 years ago

That's attribute 0x00f7

64 10 00        Boolean                     false
03 28 17        Signed 8-bit integer        23
98 39 00000000  Single precision            0
95 39 00000000  Single precision            0
96 39 90391145  Single precision            2323.59766
97 39 00000000  Single precision            0
05 21 0100      Unsigned 16-bit integer     1
9a 20 00        Unsigned 8-bit integer      0
0b 20 00        Unsigned 8-bit integer      0
08 21 1402      Unsigned 16-bit integer     532
09 21 0001      Unsigned 16-bit integer     256

https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Xiaomi-manufacturer-specific-clusters,-attributes-and-attribute-reporting#xiaomi-single-switch-module-t1-with-neutral-lumiswitchn0agl1

Smanar commented 4 years ago

Ha yes lol, the magic attribute ^^.

Smanar commented 4 years ago

Ok so bad luck, the device realy forget the cluster 0x0006

tmp

And it was totaly mute after the inclusion, I realy don't see a way to detect the cluster 0x0006. It was more active on normal gateway than on deconz.

I think need to use hack based on device type "on/off light" and manufacture number 0x115f ?

spn91 commented 4 years ago

Any news? Or can I be helpful with something else?

Mimiix commented 4 years ago

@spunti I've read about this in Discord. The devs had a internal discussion on this. Manup responded with the following: image

Smanar commented 4 years ago

Yep, for the moment we are waiting to know if manup want to make something clean in the core, or if I make an ugly hack in the api core ^^

spn91 commented 3 years ago

Any progress from manup with fixing this device? Would be nice to be finally able to control the device via HA :)

Smanar commented 3 years ago

No yet sorry, but still in the "todo list"

manup commented 3 years ago

Is there a sniffer log when the device sends on/off reports for endpoints other than the first (0x01)?

Ah if I read the description correctly the device should have only one on/off cluster for endpoint 0x01?

manup commented 3 years ago

08 21 1402 Unsigned 16-bit integer 532

By looking at the special attribute 0x08 uint16, I think this represents a model identifier. This might be the reason why the Xiaomi gateway doesn't query the Basic cluster.

Smanar commented 3 years ago

But the problem is to make the cluster 0x0006 "magically" appear in deconz, for the device can be usable in the API without hack. Its something possible on deconz side with respecting the "zigbee rules" ?

flopp999 commented 3 years ago

I can also maybe help with something, just ask me and we will see what I can do

Smanar commented 3 years ago

IDK if there is some improvement on deconz side or if we can do something ? (With using new descriptor engine ?)

labaland commented 3 years ago

Any progress with fixing this device? Would be nice to control the device via HA

flopp999 commented 3 years ago

I have never used deConz GUI before, but today I had a look and I can see the WATT for this device. I attached two pictures I don't know if that can help you. image image

Smanar commented 3 years ago

I can see to the cluster 0006. It was missing on @spunti capture, It s repared ?

The device works for you ?

flopp999 commented 3 years ago

I do get new values in 0x050B if I turn off/on the T1. But I do not see any device in API. This is as a Light, but my other Aqara Plug(different device) is as a sensor and then I get Consumption and Power

Aqara T1 build-in "box"

"manufacturername":"LUMI",
"modelid":"lumi.switch.n0agl1",
"type":"On/Off light"

Aqara Plug outlet

"manufacturername":"LUMI",
"modelid":"lumi.plug.maeu01",
"type":"Smart plug",
"manufacturername":"LUMI",
"modelid":"lumi.plug.maeu01",
"type":"ZHAConsumption"
"manufacturername":"LUMI",
"modelid":"lumi.plug.maeu01",
"type":"ZHAPower",
Smanar commented 3 years ago

But I do not see any device in API.

Ha ? but it s a light, the support is native, nothing in light section ?

flopp999 commented 3 years ago

The outlet plug is also under Lights

"manufacturername":"LUMI",
"modelid":"lumi.plug.maeu01",
"type":"Smart plug",

so what I am missing for T1 is to add it as a sensor, like Plug

flopp999 commented 3 years ago

Ha ? but it s a light, the support is native, nothing in light section ?

Yes T1 is in Light Section

Light section: T1 On/Off Plug On/Off

Sensor section: Plug as Consumption Plug as Power

Smanar commented 3 years ago

So https://github.com/dresden-elektronik/deconz-rest-plugin#install-deconz-development-package-optional-linux-only

git clone --branch Xiaomi https://github.com/Smanar/deconz-rest-plugin.git
cd deconz-rest-plugin
qmake && make -j2
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins

It s just a start, just make a test and tell me what is working or not, I will correct later. I m looking the device cluster, I think you will have at least 4/5 sensors.

flopp999 commented 3 years ago

Sorry I missed your comment :(

Tried it now, but I do not see any new devices in API. I have checked that I use the correct commit image

flopp999 commented 3 years ago

It is working now, I deleted the device and add it again, now I do get some new devices

Thank you :)

MiAutomations commented 3 years ago

It is working now, I deleted the device and add it again, now I do get some new devices

Thank you :)

I just deleted the mine and re-added using the last versions available, and I can't get the report of the electricity values.

Can you please share with me what is the version of your deconz and the fw version of your conbeeII

flopp999 commented 3 years ago

deconz GUI 2.07.01 phoszon GW 2.07.00 conbee FW 26660700

MiAutomations commented 3 years ago

Thank you for your reply

But I still have no report dada from the electricity... Do you install the deCONZ development package present in this post?

https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3380#issuecomment-742687126

flopp999 commented 3 years ago

Thank you for your reply

But I still have no report dada from the electricity... Do you install the deCONZ development package present in this post?

https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3380#issuecomment-742687126

Yes I have

MiAutomations commented 3 years ago

And if I'm using the hassio OS how can perform this installation ? I think I can't, once I don't have core linux available .... maybe somebody can help me in this point ...???

Smanar commented 3 years ago

Hassio is not a real OS. You need one to compile or install something.

MiAutomations commented 3 years ago

Hassio is not a real OS. You need one to compile or install something.

Ok thank you, and can you please let me know how to proceed with this, in order to get this to work?

Thank you

Smanar commented 3 years ago

@flopp999 Can you say me the sensor that are working and the one are not working ?

@MiAutomations depend of what you have as Unix machine (with complete OS). If you have one, just install deconz on it and after the dev stuff https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3380#issuecomment-742687126

flopp999 commented 3 years ago

@flopp999 Can you say me the sensor that are working and the one are not working ?

Aqara wall Plug is working

Aqara T1, that you change rest-plugin for, is not working. I had to comment-out to get it to update

Smanar commented 3 years ago

Ha ? ok so I thought it was working because of https://github.com/dresden-elektronik/deconz-rest-plugin/issues/3380#issuecomment-743234187

You had to comment out ? else you have error message ? wich one lines ?

SwoopX commented 3 years ago

I feel those devices have a comparable strange behaviour as the lumi.plug.mmeu01. Most of the time, they don't show the simple metering and electrical measurement clusters and then out of a sudden, they pop up simple descriptors due to whatever reason. This theory would be supported by the deviating screenshots here.

Never was able to find any pattern or reason for that...

spn91 commented 3 years ago

For me it would be ok, if the on/off operation is supported as first step :)

MiAutomations commented 3 years ago

@SwoopX Mimiix Can you please let me know if you still need more info about the device in order to get this to work ?

Thank you and best regards

spn91 commented 3 years ago

@MiAutomations I have checked your created issue about this switch. There you are writing, that on/off is already working? What have you done to get it working?

MiAutomations commented 3 years ago

here you are writing, that on/off is already working? W

Yes the relay on/off functions are working properly, I have a issue only in get the data from the electricity report for this device once this one support the power consuming report also, but is not available over the deconz/conbeII

spn91 commented 3 years ago

here you are writing, that on/off is already working? W

Yes the relay on/off functions are working properly, I have a issue only in get the data from the electricity report for this device once this one support the power consuming report also, but is not available over the deconz/conbeII

Please explain what you have done to get it working. Are you using the dev build from @Smanar?

spn91 commented 3 years ago

@MiAutomations could you please give information about your deconz version? And please let me know, how you have connected the t1 switch to deconz. For me the switch only appears in the software, not at the web interface.

Mimiix commented 3 years ago

@SwoopX @Smanar What do we need for measurement? Or is this simply a lie of the devices?

spn91 commented 3 years ago

As first step it would be cool to have the on/off operation working. It seems to work for one user, but not for me. The switch is not visible in Phoscon (I assume that it should appear under the light section). deCONZ Version: 2.07.1

Smanar commented 3 years ago

Yes, It need to appear in light section, but some user have the cluster 0x0006 visible and other not. Perhaps it s for that is work for some of them and not all.

You are in witch one situation ?

ebaauw commented 3 years ago

but some user have the cluster 0x0006 visible and other not.

I think deCONZ should show the cluster when it sees a message from it, even if it isn't returned on the Simple Descriptor. You probably need to turn the relay on through a wired in-wall swich before it sends an attribute report for the OnOff attribute.

What do we need for measurement? Or is this simply a lie of the devices?

That's probably reported through the Analog Input clusters. The second endpoint will be (current) power, the third (life-time) consumption, if they follow the logic of other Aqara wired devices. The Multistate Input on the fourth endpoint likely reports button actions of the wired switch. You might want to check if the switch input can be detached from the relay.

spn91 commented 3 years ago

but some user have the cluster 0x0006 visible and other not.

I think deCONZ should show the cluster when it sees a message from it, even if it isn't returned on the Simple Descriptor. You probably need to turn the relay on through a wired in-wall swich before it sends an attribute report for the OnOff attribute.

I'm turning it on and off multiples times every day. Or what do you mean exactly? For me the 0x0006 cluster is not visible (see screenshots from initial post).

Smanar commented 3 years ago

You are using a switch to turn it on or off ?

spn91 commented 3 years ago

You are using a switch to turn it on or off ?

Yes, it is connected to a switch.

Smanar commented 3 years ago

@ebaauw do you think if I use a hack (one more) to force the light entry be created according to the model id, the API code will work ?