ralphm2004 / broadlink-thermostat

link broadlink thermostat with mqtt to openhab
GNU General Public License v3.0
35 stars 15 forks source link

failes to authenticate or encryption issue? #16

Open betyar opened 4 years ago

betyar commented 4 years ago

The script seems to no longer work. Until now it worked flawlessly. I am not sure that with the new release of the app something changed with the encryption. When discovery runs I get the device type, the IP and the MAC, then comes a Reconnect and and a Connect, reason: 0. That's all, it stops there. There is no timeout, nothing happens after that. At first I thought it might be a problem with authentication but the type, IP, and MAC are given which apparently follow device.auth(). Has anyone else had a similar problem? Is there a solution for this?

balistof commented 3 years ago

@betyar also having the same problem:

Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Reconnect
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Connect, reason: 0
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Killing job.
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Deleting pipe from pipes array
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Deleting device from founddevices array.
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: Deleting job from jobs array.
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: broadlink discover
Jan 13 21:27:34 openHABianDevice broadlink-thermostat.py[5331]: found: 192.168.0.122 0d93fa770f78
Jan 13 21:27:35 openHABianDevice broadlink-thermostat.py[5331]: PID child 5517
Jan 13 21:27:35 openHABianDevice broadlink-thermostat.py[5331]: Hysen heating controller

any luck or update on this?

betyar commented 3 years ago

I used to have this all the time. I found that if you define the device manually in broadlink-thermostat.py it works. You still get the Connect, reason: 0 error at the very beginning but it then gets past it and reads the device properly.

Below is a snippet of where you make the change (assuming the IP of your thermostat is 192.168.1.123). Also, make sure you change the byte array of your device's MAC address accordingly.

[...]
print ("broadlink discover")
hysen = 0x4EAD
d1 = broadlink.gendevice(hysen, ('192.168.1.123', 80), bytearray(b'\x34\xea\x34\x70\x44\x0a'))
devices = [d1]
for device in devices:
[...]

Unfortunately, I haven't found a way to work around this problem with DCHP allocated addresses. Also if you have more than one device then you have to add each one manually into the device array.

Hope this helps.

mrbalintlorand commented 3 years ago

@betyar Does it still work for you? I tried now recently, but I had no luck and go stuck at the described problem above. :/ I actually tried with this fork as it was updated to python 3: https://github.com/balistof/broadlink-thermostat I also noticed that you wrote the MAC address in normal direction here above, but the script by itself when auto detecting devices on the network prints it out reversed. I tried defining it both ways but had no luck with the connection. Thanks

betyar commented 3 years ago

For me it's still working, I am currently using it and have been doing so for the past year or two with no problem. I am still using the older version running on Python 2.7. I am not keen on upgrading because it still works well so why fix something if isn't broken.

No idea what else can be the problem. Have you installed the official app and had it connect to your device? I think you need to set it up with the app first before it will work with the script.

Not sure what else to suggest.

On Tue, Mar 30, 2021, 17:35 mrbalintlorand @.***> wrote:

@betyar https://github.com/betyar Does it still work for you? I tried now recently, but I had no luck and go stuck at the described problem above. :/ I actually tried with this fork as it was updated to python 3: https://github.com/balistof/broadlink-thermostat I also noticed that you wrote the MAC address in normal direction here above, but the script by itself when auto detecting devices on the network prints it out reversed. I tried defining it both ways but had no luck with the connection. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ralphm2004/broadlink-thermostat/issues/16#issuecomment-810361043, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJTQOJAO56NTL6W6LAPN3YDTGHVVVANCNFSM4NVEE2CQ .

mrbalintlorand commented 3 years ago

@betyar Thanks! I'll try with this original repo then, maybe python 3 causes some issues… And may I ask what version of python-broadlink (https://github.com/mjg59/python-broadlink) you use as a dependency? I went the python 3 way because that is already updated to it, so I suppose I have to go back with that as well. Thanks

Edit: Yeah, I have the official app for the thermostat installed and working. Actually I had this script running fine before, set it up in late 2018. Back then I used this fork of the python-broadlink project: https://github.com/ptd006/python-broadlink