Add Support for Smart Life Components

Hey everyone! I am the owner of the repo updated 3 days ago Jolanrensen mentioned. It was fairly easy to figure out how to change the colour and the brightness etc. but there are still a few values I don’t quite understand. Other than that the code does work so far. I might open a pull request so that it can be merged into the original python-tuya repository. I’m fairly new to HA (just started today) but I might be able to take a look at the tuya-homeassistant repo these days. If there’s someone else with more time to spare, feel free to do what you need to do with my repo :wink:

5 Likes

Would love to see this all integrated and easily working in home assistant. I have switches and a light bulb now that uses the Smart Life/Tuya protocol

1 Like

To give you guys a status update:
I’m now working on a better implementation of the bulb into python-tuya. This will probably be done within the next two days. After that I’ll get back to tuya-homeassistant. I already was able to switch the bulbs on/off via HA but I had some problems with setting the colour.

I’ll keep you updated!

2 Likes

Working thanks very much for the information.

I don’t have any of the bulbs to help you test but I have a bunch of the switches.

I can’t really edit the implementation of the switches (I don’t own any of them) but I own a tuya based bulb. So bulbs should soon be working (my fork of the tuya-homeassistant repo: https://github.com/samuscherer/tuya-homeassistant/blob/master/tuya.py) - the switches are already implemented within the original repository but I can’t check if they work properly.

1 Like

Bulbs do work now.
Just follow the instructions in the readme file of my tuya-homeassistant repo (https://github.com/samuscherer/tuya-homeassistant/blob/master/tuya.py).
PLEASE KEEP IN MIND: My implementation of the bulb isn’t yet merged into the official pytuya repo and therefore not available via pip. You need to use my fork of pytuya (https://github.com/samuscherer/python-tuya) until it’s merged. I recommend waiting until this has happened. If you still want to use it, go ahead, but there may be some problems (although there shouldn’t be). I’ll post another update once this has happened.

Let me know if you have any questions.

3 Likes

I tried following the instructions to get the product id and local key but I was unsuccessful :frowning: Is there any other way?

isn’t all this still dealing with a cloud server api. Not really fitting with home assistant’s ethos or my wishes.

I have a dual gang wifi switch which uses smart life, but my preference is to flash tasmota or something similar and control it locally.

1 Like

Have you tried flashing the tasmota to one yet?

I’ve tried, but I think there is a problem with my wiring (trying to hold pogo pins and typing really requires 3 hands)

1 Like

@samuscherer can this monitor the watts

I usually just block the devices MAC addresses so that they can’t communicate with the cloud anymore.

My tuya plugs “SWA1” cannot monitor energy consumption, I don’t think they have the required hardware built-in to do that.

Edit: Apparently there are other tuya plugs that monitor energy consumption, I don’t know whether that is implemented in pytuya yet.

If you use this way of communicating with the tuya devices, you do not need an internet connection. Also, as far as I understand, a common theme is that these devices can only keep one TCP connection alive, meaning that when using this way of controlling the devices, you need to uninstall the “smart life” app.

My smart switch, can monitor the wattage (mw), amperage, see how much it’s used this week and the year, it shows also for the time it has on, how much KWh has been used since it came on. It would be nice to use that information for another automation.

Thank you, my mistake and excellent to know.

EDIT: when I saw “API” I thought that it meant an API to connect with some cloud server, I guess I should have read the code. I have now voted and will stop trying to flash Tasmota on to the switch. If there is any testing I can help with, please let me know. I have one two gang US switch with touch controls. This one https://www.aliexpress.com/store/product/QIACHIP-Wifi-Smart-Switch-2-buttons-Wireless-Smart-Home-APP-Touch-Control-Wall-Light-Switch-US/2888005_32845528129.html?spm=2114.12010612.0.0.21ce735aHiNesN

It uses smart life and has an open port 6668.

I don’t think it’s implemented. Can you tell me which plug is able to monitor the power consumption so that I can maybe take a look at implementing this?

I have a couple Gosund which has Energy Monitoring and Timer.

1 Like

Do you still have a problem? I managed to get my sorted using an android phone and an old version of the Jinvoo app, will try and assist if you need help?