clach04 / python-tuya

Python interface to ESP8266MOD WiFi smart devices from Shenzhen Xenon. NOTE I'm not using any devices with this library so I can't test :-(
MIT License
239 stars 55 forks source link

Key does not get recognized/throws error #20

Closed Darkyputz closed 6 years ago

Darkyputz commented 6 years ago

Hello...

Since i dont get any node or c# working on my device i want to run the tuya controll logic on it want to try the python now... But the code provided here is not totally clear to me. (python noob) In the code it states: d = pytuya.OutletDevice('DEVICE_ID_HERE', 'IP_ADDRESS_HERE', LOCAL_KEY) and when i fill that with my values all over the code like d = pytuya.OutletDevice('02200506600104944eb9', '192.168.178.65', 78382189fd5087ba) it throws a fit at the ba at the end of the local key which i know is correct And as a quick question on the side...do i have to call this code with paramteters to get it do something or is a dumb code just for showing general functionality? Casue is would not be able to alter it to get on/off/toggle into it

Thx for any thoughts

kristjaneerik commented 6 years ago

The issue might be that you didn't put 78382189fd5087ba in quotes, e.g. '78382189fd5087ba'.

It would be helpful to see the actual error message that you get.

Exilit commented 6 years ago

@kristjaneerik is right, the key needs also to be passed as str.

The other question I don't quite understand. Which code are you talking about? The code in the README.md is example code that should work as is.

I started working on a command line tool called tuyactl using this library, but could not finish it so far. That would allow you to control a tuya device via command line.

In order to be more helpfull we need some more information.

Darkyputz commented 6 years ago

Hello... Thx for the replies... I think i found my culprit after reading your comments... The demo now seems to toggle the switch now...but i had to comment out the part below the toggle since mine is just a one outlet only... Will keep you posted of my tests and changes...looks like it is working now... You guys are the best!! Thx Jan

Darkyputz commented 6 years ago

Ok...after playing around, i got it working on my mips based router with fresh compiled python 2.7 JUST AWESOME!!!