Adding TCP Connected (Greenwave Reality) support to Home Assistant

I recently did a job for someone, and as part of my payment, they gave me an old Internet of Things lighting system. It’s made by TCP Connected, leased from Greenwave Reality. TCP disabled the cloud functionality and local web access, which left many people in the dark.

The tinkerers out there just couldn’t let their bulbs sit and just be regular bulbs, they wanted their remote control back. So people built things like the TCP Connected Web Interface. It worked, but it was quite basic. And it was standalone, I couldn’t integrate it with anything. So i set out to get these bulbs working better than new.

I found the Home Assistant project, which was a fully developed Home Automation ecosystem, allowing you to control smart devices from many different brands, all in one place. And its written in Python! I chose Home Assistant to be the host for my new lighting system.

I looked through the source for the TCP Connected Web Interface to extract the commands to turn the bulbs on and off, and to set brightness. I then used these to build a basic component for Home Assistant.

The bigger issue was the newer firmwares, beginning with 3.0, used HTTPS, self signed certs, and required you to fetch a token before being able to issue commands. I again used bren1818’s code to figure out how to fetch a token.

The most recent edition of the code works with both firmware versions 2 and 3, and gives you all the functionality from the app (except for naming bulbs). In the future, I’ll add autodiscovery of the gateway, discovery of new bulbs without the need to restart Home Assistant, and probably more that I’ll think of later.

I submitted the code to become a part of Home Assistant itself, you can watch how that goes here. If you’d like to use the code before then, you can find it here. And if you’d like to build your own python application that interfaces with the bulbs, you can use my GreenwaveReality python module, found here,  and can be installed with pip install greenwavereality.

Let me know if you have any ideas or improvements for the code, or if you;re going to use it!