Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.24k stars 1.69k forks source link

Attempt to pair Livolo Zigbee switch #592

Closed Ton1965 closed 4 years ago

Ton1965 commented 6 years ago

I have bought a Livolo zigbee switch like this one: https://www.aliexpress.com/item/Livolo-Touch-ZIGBEE/32918552579.html?spm=a2g0v.10010108.1000016%2FB.1.12754ab2JVEKJU

It seems to be a good option for its price.

The original Livolo instruction is to buy their own gateway and pair using their application. The pairing should be done by keeping a switch button pressed for 5 seconds. It should beep and pair after that.

The problem is it does not want to pair to zigbee2mqtt. I tried the following:

All the time I kept the device close to the zigbee stick.

I just could not observe any activity in zigbee2mqtt log in any of these cases. I have double checked that 'permit_join' is set to true and log_level set to 'debug'. I even tried to run zigbee2mqtt together with DEBUG=zigbee-shepherd* - no result.

Does anyone have any suggestions/advices/ideas? It would be very nice to add support to this device since this model seems to be much more attractive than the corresponding RF model.

lych commented 6 years ago

@khzd How should the mqtt payload look like in this case?

khzd commented 6 years ago

give me 5 mn, need to put HA in Debug mqtt to have the exact syntax

khzd commented 6 years ago

mosquitto_pub -h 127.0.0.1 -t zigbee2mqtt/"your friendly name"/set -m "ON"

lych commented 6 years ago

how to set left/right button?

khzd commented 6 years ago

hi do you use HA?

lych commented 6 years ago

No, I don't

khzd commented 6 years ago

if yes this the example in zigbee2mqtt for a double switch in HA config switch:

switch:

khzd commented 6 years ago

so from previous example we can build the good syntax :+1: right : your broker zigbee2mqtt//right/set -m 'ON' which mqtt broker do you use?

lych commented 6 years ago

I use mosquitto. Thanks, I've alredy found how to do it, but something wrong Zigbee cannot publish message to device because '0x00124b000befc0b9' not known by zigbee-shepherd Maybe I should update my zigbee2mqqt, but tomorrow, it's time to go to bed :) thanks

khzd commented 6 years ago

I also have the same issue, it's a zigbee2mqtt responsability

never give up with zigbee :)

khzd commented 6 years ago

hi @kirovilya @Koenkk do you have enough debug log or do i need to give more? Merci

Ton1965 commented 6 years ago

Hi @khzd ,

I see you are ready to submit a PR to shepherd-converters to support these switches. It's great news! You guys are awesome! I have a couple of questions though (more than a couple actually 😄). It was reported here that the coordinator needs to be on channel 26 to pair with these switches. Is it still true? I currently have a bunch of devices paired to my stick, will I need to repair them if I change the channel? Is it possible to make channel selection automatic again after the pairing is done?

khzd commented 6 years ago

hello, i changed also to channel 26 and unhappily I had to re-pair all router devices the end-devices do not need see in the startup or in the database the nature of the devices, it will gives you the total effort :(

Ton1965 commented 6 years ago

Hi, Fortunately I do not currently have any routers, just the end devices 😄. Does it mean that we can easily encounter devices from different manufacturers that would be impossible to use together in the same network? Like after adding these Livolo switches we get stuck with channel 26 only and will be unable to move to any other channel.

khzd commented 6 years ago

not sure, i'm not expert on zigbee protocol. NB in wifi the channel is recommended to be changed to not interfere with others sources . I have manly xiaomi devices, but also a pair of GLEDOPTO and a pair of CC2530 routers. all are ok with 26 channel

lych commented 6 years ago

Hi, @khzd . Have you managed to make it work?

khzd commented 6 years ago

unhappily not :( the device is connected to the network, i can send request without timeout BUT no response for on/off, what is amazing is that ( because we are on channel 26, thanks) the pairing is reproducible without issue ( i did it 4 or 5 times) and have long log about it

i learn a lot how to debug on javascript, but no competency on coding zigbee2mqtt :( we need help from devs team, probably busy with a long list of requests, this is the price of the success

cheers

Ton1965 commented 6 years ago

@khzd , I am not an expert as well. I have looked through some papers like Zigbee standard and some papers. It looks like channel hopping was introduced to Zigbee around 2007 but it was never widely adopted. There were some statements that in general a device should scan all the channels while pairing but some devices might have a special application profile and they can be programmed at the firmware level to use some subset of channels or a single channel. Still just as a final test: could you please try to change the coordinator channel and wait for some time to see if it would still work. I just hope that this channel hopping is already there and a specific channel is necessary at pairing stage only.

khzd commented 6 years ago

give me 10 mn

lych commented 6 years ago

Livolo answers on on/off commands, I can see it in wireshark but relay doesn't click. There is also a 2 channels variant of this switch, I think it's possible that both switches have the same firmware, so I added ep: {'left': 1, 'right': 2, 'both': 3}, in my devices.js, but then I try to change the state (zigbee2mqtt/livolo/left/set) I get an error Zigbee cannot publish message to device because '0x00124b000befc0b9' not known by zigbee-shepherd I do not know what the problem is in zigbee2mqtt or in my config or livolo had to provide some information to make this feature work.

khzd commented 6 years ago

@Ton1965 when i switch to channel 11 i get systematically zigbee2mqtt:error 2018-11-30 19:24:12 Zigbee publish to '0x00124b000bf0725e', genOnOff - off - {} - {"manufSpec":0,"disDefaultRsp":0} - null failed with error Error: AF data request fails, status code: 205. No network route. Please confirm that the device has (re)joined the network.

do Channel 26 is relay more stable ;)

khzd commented 6 years ago

i would test this ep: {'left': 1, 'right': 2, 'both': 3}, but I have a single switch can you show me what do you have in eplist from DB? I have epList":[6]

lych commented 6 years ago

the same as yours: "epList":[6] . I don't have 2 channels switch, I just assumed that they can have the same firmware

khzd commented 6 years ago

ok, but in zifbee2mqtt , there is differentiation between single, double switch. they probaly have a common code but some thing to differentiate this feature

Ton1965 commented 6 years ago

Hi @lych,

in my devices.js, but then I try to change the state (zigbee2mqtt/livolo/left/set) I get an error Zigbee cannot publish message to device because '0x00124b000befc0b9' not known by zigbee-shepherd

This error is in file lib/zigbee.js. It looks like the only reason is zigbee2mqtt cannot find this address in the database. Could it be that your device lost pairing?

Also could it be that you need to specify endpoint 6 explicitly even if it is the only one? All devices I have (mostly a bunch of sensors) all have endpoint 1 and it easily can be the default not requiring an explicit specification. But probably 6 needs to be set explicitly in 'devices.js'.

khzd commented 6 years ago

probably, I have to GLEDOPTO and @Koenkk modify the code to manage the different version of those devices, they have different eplist. see the code for GLEDOPTO in devices (in github) { zigbeeModel: ['GLEDOPTO'], model: 'GL-C-008', vendor: 'Gledopto', description: 'Zigbee LED controller RGB + CCT / RGBW / WWCW / Dimmer', supports: generic.light_onoff_brightness_colortemp_colorxy().supports, fromZigbee: generic.light_onoff_brightness_colortemp_colorxy().fromZigbee, toZigbee: generic.light_onoff_brightness_colortemp_colorxy().toZigbee, ep: (device) => { if (device.epList.toString() === '11,12,13') { return {'': 12}; } else if (device.epList.toString() === '10,11,13') { return {'': 11}; } else { return {}; } }, }, but if the same eplist, i do not see why he needs to manage this. i think the issue is obviuos for devs team, they just need time to manage this.

I tried to have a look in the code, but it's really huge :)

khzd commented 6 years ago

after back to chanel 26 all my devices are coming back slowly , but the LIVOLO come back first, it probably preferes the channel 26.

Koenkk commented 6 years ago

When the device has only one ep, it is not necessary to have the ep: (device) => {..., zigbee2mqtt will select the first ep automatically.

Ton1965 commented 6 years ago

Yes, I believe I have also found this piece of code. @khzd, how much time does it take for the devices to reconnect after you change the channel? I tried to switch to channel 26 and all my Xiaomi devices stopped reporting. I did not have enough patience to wait for long so I switched the channel back after about 5 minutes.

lych commented 6 years ago

Hello guys. I give up. I've ordered the gateway, It will take about two weeks to get it, then, I hope, we will be able to find out how it works.

khzd commented 6 years ago

hi all, I did massive tests i discover that my cc2531 was not up-to-date, so I did it I had to re-pair all my xiaomo devices and discover that when the CC2530 is on, impossible to pair : when i switch it off it pair!!! now my livolo is back in the network but not dialog with the zigbee2mqtt : i have his damned log : Zigbee publish to '0x00124b000bf0725e', genOnOff - off - {} - {"manufSpec":0,"disDefaultRsp":0} - null failed with error Error: AF data request fails, status code: 183. APS no ack.

seems the protocol used by livolo has some

I tried also to replace all the code with the xiaomi switch no chance :( @Koenkk any further tests that I can perform, i m able now to code in js but beginner ;)

NB, I tried to change the ep no effect.

khzd commented 6 years ago

Hello guys. I give up. I've ordered the gateway, It will take about two weeks to get it, then, I hope, we will be able to find out how it works.

so we will test the coordinator :) with wich home-automation system do you plan to use it? Cheers

khzd commented 6 years ago

hi guys, i managed a good price with alibaba shop for 12 devices, just need the GO from @Koenkk to buy , mix of all devices type is possible:)

khzd commented 6 years ago

Yes, I believe I have also found this piece of code. @khzd, how much time does it take for the devices to reconnect after you change the channel? I tried to switch to channel 26 and all my Xiaomi devices stopped reporting. I did not have enough patience to wait for long so I switched the channel back after about 5 minutes.

you have to re-pair all devices if you want them immediately, i was not patient to wait too, in fact all my router had to be re-paired, AND enddevices, i loosed all of them now after last update of cc2531 !!!

lych commented 6 years ago

@khzd I'm not going to use it, I just hope it will help us to figure out how to make Livolo work

khzd commented 6 years ago

hi @lych on witch home-auto do you plan to use?

dzungpv commented 6 years ago

Livolo use default TI example for cc2630 chip, the model has some space and they may modified it to non standard, they have done with RF version too, if anyone have their gateway, try to capture it with Ubiqua and post the logs.

khzd commented 6 years ago

yes, @lych order one, he will update us asap so without this gateway no way to find the protocol ? my last staus :

cheers

dzungpv commented 6 years ago

@khzd yes, it is the only way. I have do with other xiaomi devices

khzd commented 6 years ago

Thanks @dzungpv for your feed back

khzd commented 5 years ago

hi guys, any update?

demonio2332 commented 5 years ago

img_20181216_2205031 livolo gateway

Lumbricus commented 5 years ago

Hi there,

there is a rurussian page with information about the parts of the gateway:

https://mysku.ru/blog/aliexpress/68804.html

The german translation with google is not the best, the english one may be better. They use the following for the wifi connection: EMW3165-P http://en.mxchip.com/product/wifi_product/38

Maybe, this might help.

kirovilya commented 5 years ago

@Lumbricus as a Russian, I will say that there is no additional information for us :) SZ05-L-PRO-2 http://www.shuncom.com/page42.html?product_id=1&_l=zh_CN If to believe the specifications of the module, inside it uses the famous chip cc2530

khzd commented 5 years ago

Hi @domnio2332 did you try it with zigbee2mqtt Can you send log?

khzd commented 5 years ago

Hi @/dzungpv May you give the action plan to hack this gateway? With log do we need and how to get it ? Thanks

lych commented 5 years ago

@khzd my geteway is already on its way to my post office. I hope to get it next week, then we will see what it sends to a switch to make it work.

khzd commented 5 years ago

Excellent @lych But do you need an action plan to hack it or you « know » ?

khzd commented 5 years ago

hi guys, about the channels used for this device, I got this screenshot from livolo dev team confirming that they use channels 11 to 26 ! can any body explain this ? @@ptvoinfo any comment?

image

lych commented 5 years ago

This screenshot means...nothing, at least without rest of code, just because 'defines' can be used in any way. If you can, ask them, please, why the switch responses 'ok' in return to 'ZCL on/off command' without actually changing relay state and what command has to be send to change the real state of a switch's relay.