unparagoned / njsTuya

Openhab interface for Tuya home automation devices sold under various names
27 stars 11 forks source link

No longer works with latest Tuyapi #2

Closed acoulson2000 closed 6 years ago

acoulson2000 commented 6 years ago

Seems like getStatus() and SetStatus() have changed to get() and set().

unparagoned commented 6 years ago

Thanks. I've changed getStatus and setStatus to get and set. I've been having issue since a power cut last week so can't test the fix, there maybe some other changes required.

acoulson2000 commented 6 years ago

Thanks for that. I had to remove the "tuya.destroy();" too. That api has apparently been removed. After that, the script seems to work via command line.

Can you explain how the items and rules are intended to work? I trimmed them down to just a single device with some name changes, but they don't appear to work for me. I'm not clear how the arguments in the "String Details ..." items are supposed to be accessible to the rules. I am getting null values from the state property on those items, and from a bit of googling (https://community.openhab.org/t/cant-do-how-to-get-an-items-text-label-programmatically-within-rule/4135), that does not appear to be supported. In the meantime, I'm going to try to get it working with the exec binding.

unparagoned commented 6 years ago

OK. I copied the new template in from codetheweb/tuyapi. It kind of works now but I'm getting errors most of the time. I might just move over to one of the net or python ports.

I've copied my config rule over to the temperature.rules. Essentially you set the id and key as a variable in the rule then send a command to tuya_config and it assigns those values to the details item. So the rule just adds the items value to the exec command.

unparagoned commented 6 years ago

OK. I've rewritten the interface to limit the get calls to one. On change state it relies upon the return value and infers the new state. This seems to fix the errors and everything seems to be working fine with version 2 of the tuyapi.