martenjacobs / py-otgw-mqtt

Python OTGW MQTT bridge
MIT License
9 stars 16 forks source link

python 3 compatibility #5

Closed kobbejager closed 6 years ago

martenjacobs commented 6 years ago

This looks pretty good. Have you tested it in Python 2.7?

kobbejager commented 6 years ago

It does work on python2, still better than on python3. On python3 there remains an interpretation issue for true and false, which has probably something to do with str <-> byte conversions. This is new stuff for me, and I'm kind of struggling with it.

You should probably not merge my code until I have this remaining issue ironed out and have tested it thoroughly on both py2 and py3.

martenjacobs commented 6 years ago

OK, please let me know when you’re done

kobbejager commented 6 years ago

I think it's ready. Tested with my otgw directly connected (via usb) with both python 2.7 and 3.5.

Besides python 3 compatibility, I slightly changed how this script interprets the set-values received by mqtt, to more closely follow the description of the otgw serial commands

martenjacobs commented 6 years ago

Looks good! I think there may be some room for improvement by making the float conversions a bit more EAFP, but as this already works I'm not going to put much time into it.