JJPro / CTP-R01-converter

Zigbee2MQTT converter for Aqara Magic Cube T1 Pro. Model #CTP-R01
GNU General Public License v3.0
9 stars 2 forks source link

Cube is binding itself to every zigbee device in my house #3

Closed amaisano closed 1 year ago

amaisano commented 1 year ago

When this paired with Z2M, any action the cube performs is toggling on and off all my lights, switches, EVERYTHING.

What on earth? I've disabled it from HA, but even then it's still interacting with lights across the house. There are no data bindings setup in Z2M.

When I rotate the cube, i get the below. It seems to be sending onOff commands to EVERYTHING...

2023-01-23 17:06:02Received Zigbee message from 'Owl', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from '0x54ef4410006a4928', type 'commandOff', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
2023-01-23 17:06:02No converter available for 'CTP-R01' with cluster 'genOnOff' and type 'commandOff' and data '{}'
2023-01-23 17:06:02Received Zigbee message from 'Washing Machine Outlet', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0
JJPro commented 1 year ago

That's quite odd, a few others reported same issue long ago, then I added the following to ignore genOnOff cluster:

  fromZigbee: [aqara_opple, action_multistate, action_analog, fz.ignore_onoff_report],

In fact, I never saw genOnOff cluster messages all this time, even with the sniffer.

Can you verify you are with the latest version of Z2M and HA?

JJPro commented 1 year ago

I wonder whether there exists different versions of this cube, or you cube needs an firmware update. I got my cube from Amazon on Dec 18th, when and where do you get yours?

I'm with the latest firmware 0.0.0_0025, what about yours? (on device's about tab)

JJPro commented 1 year ago

Moreover, have you tried restart z2m and HA after putting the code in place?

amaisan0 commented 1 year ago

Got mine the first week of January from Amazon US.

I had it pair with an Aqara G3 hub until today.

Firmware build date 20220602 Firmware version 0.0.0_0025

I'm on the latest stable HA and Z2M addon.

I'm using a zzh! stick as my coordinator.

JJPro commented 1 year ago

Another thing, this converter doesn't bind the device to anything.

image

See? My bind list is empty.

I saw someone else's code binds genOnOff with coordinator.

Can you make sure my converter, and only my converter for this particular device, is actually in effect?

To test my code is in effect, you can put console.log('>>> hi there') in one of the converter callbacks, e.g. in action_multistate's converter callback:

const action_multistate = {
  cluster: 'genMultistateInput',
  type: ['attributeReport', 'readResponse'],
  options: [],
  convert: (model, msg, publish, options, meta) => {
    console.log('>>> hi there');
    const value = msg.data['presentValue'];
    let payload;
    ...
  }
};

Then see if you can find ">>> hi there" in your logs.

Also, check in Settings > External Converters see if you find other converters there:

image
JJPro commented 1 year ago

oh, Z2M needs to be restarted whenever code is changed.

amaisan0 commented 1 year ago

It's the only external converter I have, copied 1:1 from your repo. I restarted the Z2M addon after adding it. No binds for me either, but that was what I thought was happening because I had no automations that did such things.

JJPro commented 1 year ago

Interesting, I've had the sniffer running for like 30mins now after seeing your issue report, and have been rotating, flipping.... No packets from Cluster genOnOff have been caught.

Just placed another order on Amazon, see if I can get this issue on the new one. Wait for two days.

amaisan0 commented 1 year ago

I force removed the cube and set it to ONLY join to the main coordinator (something I've had to do with many other Aqara Xiaomi devices).

I kept pressing the link button on the cube and performing the shake action the first time to ensure communication during pairing, so THIS time I didn't touch anything after initiating the pair.

And now it seems to be working without affecting the rest of my Zigbee devices.

It's in scene mode right now so I will also test in action mode.

JJPro commented 1 year ago

cool~ No need to keep shaking while pairing. Just hold the LINK button (5s) until LED flashes three times should work.

amaisano commented 1 year ago

It's been stable so far. I can't say what went wrong the first time, but providing you don't interrupt the pairing process I think it's good to close this.