I’ve created an experimental bridge to automatically publish all updates on all Tuya devices on local network to MQTT using the Homie convention.
This allows the following:
- All Tuya devices are automatically discovered by Openhab MQTT binding as Things.
- Channels for these Things are setup appropriately.
- This is dependent on you linking your Tuya devices to their cloud at least once (if not for a couple of days until all the properties populate).
- Once you bind these channels to items those items can also push back to Tuya. I.e. if a Tuya property allows updates flicking your switch in Openhab will send that instruction to Tuya.
- Units are supported (well the ones I tested anyway).
- Updates to Tuya work for everything except for Tuya bitmaps (I don’t have a device with settable bitmaps, so not sure if this is even possible).
- It also publishes Home Assistant config topics now so should be compatible with that too.
- It should be noted that the
$nameproperty (i.e. the user friendly name) is populated off what is brought in from the Tuya API, so dependent on the quality of that. Sometimes their “friendly” names are not that great (guessing it depends on the device manufacturer). Can’t fix that but you can just override these in your item configuration.
It’s a python script that can be setup as a service. It uses the
tinytua python package. It is currently dependent on an PR to that package that’s still in development.
The project is available here:
In addition to the instructions above you need to setup an MQTT broker, and also connect Openhab MQTT binding to the same broker.