Tuya Switch Control (Jinvoo, Smart Life)

Sorry, I would rather jump out of a plane than help you… I’m on holiday skiing and skydiving. So it will be a couple weeks before I can help. Anyway don’t use windows, get a raspberry pi and send me a PM and I’ll send you the $10 or whatever it costs.

1 Like

@GadgetAngel
yes for njstuya use. Instead of retrieving a single dps value one at the time like this

node /etc/openhab2/scripts/node_modules/njstuya -ip <> -id <> -key <> -get '{ "dps": 18 }'
node /etc/openhab2/scripts/node_modules/njstuya -ip <> -id <> -key <> -get '{ "dps": 19 }'
node /etc/openhab2/scripts/node_modules/njstuya -ip <> -id <> -key <> -get '{ "dps": 20 }'

I would like to know if I could specify dps values (e.g. 18, 19, 20) and retrieve only those values in a single command.

-get '{ "schema": true}'

returns all dps values. I guess I could learn how to parse the list and pick out the values I need.
Thanks.

UPDATE: Using https://www.openhab.org/addons/transformations/jsonpath/ I can easily select the dps values I need.

Thanks for the link, great information to know. Now if I can just get my MQTT connection to work through OPENHAB2, I could test out my setup.

Any good links to how to get MQTT binding to work correctly?

I am quite confused with all the scripting here. Is there anyway this can be a binding to simply its use?

With the cloud control, yes, this can finally be made into a binding. I asked everyone else who was interesting and got not response. The cloud based biding would be a bit more limited with less features but would be much easier to use. Also there are lots of changing with openhab and the advices is too wait a bit for things to settle down then start writing the binding. Also binding are written in Java and I’ve never written anything in Java before and I have lots of other stuff going on do it might be a a while before a binding is available if ever.

Awesome. I will be happy to test whenever your binding is ready.

In the meantime, I am still trying to get my head to understanding all these scripts

I did some quick programming in Java and came up with a working Tuya Socket binding. Currently the binding only supports simple ON/OFF devices, but I guess with some more coding one could easily add more functionallities.

The code can be found at my github repository: Github Tuya Binding
I also build a jar file for quick testing: Tuya Jar Binding

As I did not yet upgrade to the new build system, only openHAB 2.4 (I guess) works. Check it out and let me know what works and what not.

4 Likes

Hello, I tried Njstuya, it work fine with teckin in local, but with Emylo SS-8839-03 there is an error :

When I launch this command :

node njstuya.js -mode local -ip 192.168.1.XX -id 4620XXXXXXX0029 -key f7edXXXXXX2b ON

I received this error :

(node:2189) UnhandledPromiseRejectionWarning: undefined

(node:2189) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:2189) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

But when i try with cloud mode and device id, it work fine. Any ideas please ?

Also with this command node node_modules/njstuya , njstuya detect all Teckin devices in local, but never Emylo device.

Thank you

My appologies if this has already been discussed but I have scanned through every post looking for any mention of the ability to update these over the air to Tasmota firmware.

If you have brand new Tuya devices it can be done OTA without soldering or opening up your device.

I have purchased one to try this out over the next week, if anyone has done it or can recommend a better way to get Tuya power point switchs working in Openhab then please post with a link or info.

As long as you do not connect via the Tuya smart app which will update your firmware to one that cannot be flashed over the air.

I used the Tuya-Convert method to convert most of my Tuya devices.

Check out the already tried and tested devices before buying if possible

Thanks for the links they will be helpful as I take the plunge soon and I am keeping it right away from the web and app till this is done. I did check before buying and mine is in the list and if 1 works I’ll go back and buy up big to roll them out.

I was surprised there was no info on doing this when I searched the forum as it seems a better way then using a cloud based API.

Any other info on this or any other ways to get them going would be great.

No worries. I can share with you which Tuya products worked with Tuya-Convert for me, which are the ones I have not figured out yet.

Works with Tuya-Convert:

  1. https://www.aliexpress.com/item/33001149822.html?spm=a2g0s.9042311.0.0.27424c4daXZNpF
  2. Buy Products Online from China Wholesalers at Aliexpress.com
  3. https://shopee.sg/product/74752093/1598782874
  4. https://shopee.sg/product/64129412/1694422470
  5. https://www.amazon.co.uk/TECKIN-Monitoring-Function-Control-Required/dp/B07QN5XY89/ref=pd_lpo_sbs_60_t_1/260-8161168-7203409?_encoding=UTF8&psc=1&refRID=GPRHEYPXAKHBJDWBR6TN

Does NOT work (In my hands) with Tuya-Convert. Still figuring out

  1. Buy Products Online from China Wholesalers at Aliexpress.com
  2. Buy Products Online from China Wholesalers at Aliexpress.com

I used a Pi3 , followed the instructions on the Github page. Have a mobile phone near to you (because you will be switching wifi networks during the process). Once flashed, just login to Sonoff and put in your wifi SSID and password and you are done.
Then just keep that microsd card and popped it into the Pi3 whenever u need to flash Tuya Convert.

Can I use any device that works through smart life?
use https://ru.aliexpress.com/item/32901221191.html?spm=a2g0v.search0104.3.1.6052497eFF4jNU&ws_ab_test=searchweb0_0%2Csearchweb201602_3_10065_10068_319_317_10696_453_10084_454_10083_10618_10307_10301_537_536_10059_10884_10887_321_322_10915_10103_10914_10911_10910%2Csearchweb201603_53%2CppcSwitch_0&algo_expid=b1cfab11-29e7-473c-8b30-1a373aa128c3-0&algo_pvid=b1cfab11-29e7-473c-8b30-1a373aa128c3&transAbTest=ae803_4

I’ve posted here a light bulb that I flashed with tasmota:

It’s worked pretty good with ESPurna and Tasmota.

Brilliant work, thanks Alexander :smiley:

@alexsee How to install the .jar file as binding in openHAB? placing the .jar file in the addons folder doesn’t seem to be helping. Can you pls let me know how it can be used? Can it be accessed through paperUI? or should I test with config files?

It should be available via PaperUI. For new Addons you need to restart Openhab before they are visible.

I’m currently working on a native openHAB binding for Tuya devices. If anyone is interested, you might give it a try. See: GitHub - wvissers/openhab2-addons-tuya: tuya device properties. Don’t expect a fully operational binding yet since I just started with the development. Remarks are welcome anyway.

1 Like

What are the numbers such as ‘01200701dc4f2200682e’ that you are using if it is not a valid key? Is it what the Tuya app calls th ‘Virtual ID’?

You may not always have to open it up. I got one very similar and used “tuya-convert” successfully. I turned the light on and off repeatedly giving it a rest of a few seconds after each 5 or so cycles and it started flashing. I ran “tuya-convert” using a Rpi 3 and flushed it with Tasmota. I just connected it via MQTT and it works like a charm.