-
Notifications
You must be signed in to change notification settings - Fork 568
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
Zigbee Gateway Support #739
Conversation
…bee_gateway_support
2. Made commands into constants in pytuya
2. Added TuyaGatewayDevice and TuyaSubDevice to support gateways 3. Added constants to support gateways 4. Added type_0d commands for gateway in pytuya (although Zigbee gateways should not do that)
@knifehandz thanks for the commitment. I've tried it but seems still has an issue. It could be an issue with my gateway (I've ordered a new one and see if this solved the problem)
output of terminal
|
The code looks cleaner. I'll go deeper in the code to see what the problem is. |
@leeyuentuen thank you for the feedback and helping to test out. I have not really optimized the logging so pretty much everything is in debug log, can you help to enable debug level logging for localtuya and see what it's doing under the hood? |
…to pytuya causing everything to appear unavailable
…pe switching) 2. Added status retry loop for sub-devices that are unable to get status 3. Added constants for sub-device retry intervals 4. Status updates of sub-devices now follow if they are able to get the status of dps
Made some changes to reflect what I have observed in the past week:
To be figured out...
I have about three dozens of different gang switches installed at home, with three Zigbee gateways, so there really isn't much to test them out as I am using them everyday. My suggestion is to not suspect the gateway, instead, find out what those sub-devices are doing. |
don't know why, but in the common.py. If i put a sleep(2) in async_setup_entry, then all my sensor that I've put in the yaml will loaded correctly
|
Interesting, I think it has to do with the order and timing between the gateway device and sub-devices.If the gateway device is not ready to take requests, at the moment there is a loop in sub-device to attempt resend (dispatch) messages if it doesn't receive an acknowledgement within 5 seconds from the gateway, maybe this is not working properly.Was trying to figure out if the order of loading can be forced but yet to find a solution.
|
I've opened a merge request https://github.com/knifehandz/localtuya/pull/1 it is a dirty fix but on a load of the gateway, I've forced them them to connect and it seems to work for me. I've removed the sleep and it loads for me without a problem. |
Update gateway connection to connect at load time instead of waiting for a call to async_connect
Thank you, merged. Seems will get the job done but I have yet to test with my environment, will test and post results tomorrow when I get back home. Just thinking there must be a better way to get sub-device and gateway synchronized in load order... |
I'm actually pretty keen on it. Yeah, git history might need a bit of clean up; but you guys have done a lot of testing. Squash merges solve many things :P |
TODO: Compare with #1305 |
Hello !! |
Sorry, I didn't notice the fork. I have introduced Zigbee support in PR #1493, if anybody wants to test it and provide feedback, please comment in the PR. |
if you are using yaml instead of conflg flow, you need to put the local key between quotes "" |
I understood that it was beyond my abilities, so I didn't even ask anymore, because I'm just an amateur and I have only minimal experience with programming. I asked on the localtuya website to add support for my zigbee gateway, so maybe it will be possible in time. My gateway is model: JMWZG1 |
@lumiror
@Lonelysoulman for entities, it should look something like this:
|
sorry but im still a bit confused. what do i need to add here in my configuration?
|
i haven't look at this repo, not sure what already has changed. my own repo. i've also long time not maintain because it is still working. and partial zigbee part, i've use conbee with zha |
how to install your version of leeyuentuen/localtuya or the one you use. You can be more detailed. |
hacs add the github repo, you must first uninstall the other localtuya https://github.com/leeyuentuen/localtuya i'm using one of the latest beta version 3.7.0.beta.10 |
I already have it installed, I'm going to try it |
i'm not behind my pc, but let me make some quick steps go to hacs, remove the old localtuya from rospogrigio on the right top in hacs you can add custom repository, select then add new repo. fill the url link from above and add the repo after added, you can find localtuya and download them. reboot the home assistant and you can use the config in yaml to add the devices. example you can find them on the first page of github repo |
now i can add subdevices. thanks so far. what sensor type should i choose for a scene remote? is it even supported? and my thermostat doesnt show the battery info or the window open detection. its not supported too i guess?
i think its the uuid. ( i get my ids with tuya-cli that looks bit different. but the combo with a4... looks like what u need as cid for me) |
Been testing for a while and made a working Zigbee Gateway support, based on #628 @sbneto's work.
Major changes are:
This way, there is only one IP connection to the Zigbee gateway, and all sub-devices send or receive requests based on their client ID.
Sample configuration used to test:
Will work on flow configuration support to ease adding things.
Any feedbacks welcome :)