TuyaGateway v2.0 now available

Sorry, that testing page is outdated. That was based on topic configuration, which has been removed.

If you followed the 3 setup steps the device should be visible in your HA devices page.

you should be able to send a command to the following topic.
mosquitto_pub -t tuya/<device-id>/<dp-key>/command -m ON
e.g.
mosquitto_pub -t tuya/34280100600194d17c96/1/command -m ON
hth

There is no docker-compose in the codebase. Can ypu explain what you tried to do?

OK so that helped - now when I start to listen for events I get a reply of ā€œonlineā€, but the commands still donā€™t seem to work.

If I listen on Mosquitto to: tuya/0220014568c63aa7f5e4/#

I get back immediately:

Message 3 received on tuya/0220014568c63aa7f5e4/availability at 12:55 PM:
online

But if I send the tuya/0220014568c63aa7f5e4/1/command -m ON I get nothing back.

I am sending it through the Mosquitto configuration testing page directly in HA.

Thoughts?

@dmpk there is no add-on thingy available (yet)
@denis.besir Purely technical speaking, yes it should be possible. It doesnā€™t take much system resources. But I donā€™t work with hassio, and donā€™t know anything about the limitations it imposes

Do you see the device in HA devices page?

Yes - just found them thereā€¦ will do a little more digging. So I should be able to just call switch.turn_on etc against that switch?

I have noticed though that the names in HA are switch.on_off and switch.on_off_2 that I set up. In Gismocaster they I named the Gismo with a more descriptive name.

I now see the message for command ON when I call the service, but it is not actually affecting the light itself which makes me think I have it set up wrong in Gismocaster.

yes, or just click the button right there (in the popup)

Can you add some screenshots of your setup? (Gismo and Gismomodel)

Restarted my Gismocaster container and lost itā€¦ will try again later with a new setup. Thanks for the responsiveness!

Ok here we go. New behaviour is that I can turn on the switch via HA / Gismocaster but every time I send a command to the switch it flips to offline then back online. The on command worked, but the off command wonā€™t stick (or at least HA doesnā€™t get the state change that is published).

Hmmm, that is odd behavior. But it looks like a bug I had before. Iā€™ll have to dig through the code for a bit.

Hereā€™s what Iā€™m seeing from a simple switched outlet:

Message 20 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 19 received on tuya/02200360600194733ae3/availability at 10:58 AM:

online

QoS: 0 - Retain: false

Message 18 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 17 received on tuya/02200360600194733ae3/availability at 10:58 AM:

online

QoS: 0 - Retain: false

Message 16 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 15 received on tuya/02200360600194733ae3/availability at 10:58 AM:

online

QoS: 0 - Retain: false

Message 14 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 13 received on tuya/02200360600194733ae3/availability at 10:58 AM:

online

QoS: 0 - Retain: false

Message 12 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 11 received on tuya/02200360600194733ae3/availability at 10:58 AM:

online

QoS: 0 - Retain: false

Message 10 received on tuya/02200360600194733ae3/availability at 10:58 AM:

offline

QoS: 0 - Retain: false

Message 9 received on tuya/02200360600194733ae3/availability at 10:57 AM:

online

QoS: 0 - Retain: false

Message 8 received on tuya/02200360600194733ae3/availability at 10:57 AM:

offline

QoS: 0 - Retain: false

Message 7 received on tuya/02200360600194733ae3/availability at 10:57 AM:

online

QoS: 0 - Retain: false

Message 6 received on tuya/02200360600194733ae3/availability at 10:57 AM:

offline

QoS: 0 - Retain: false

Message 5 received on tuya/02200360600194733ae3/1/command at 10:57 AM:

OFF

QoS: 0 - Retain: false

Message 4 received on tuya/02200360600194733ae3/availability at 10:57 AM:

online

QoS: 0 - Retain: false

Message 3 received on tuya/02200360600194733ae3/availability at 10:57 AM:

offline

QoS: 0 - Retain: false

Message 2 received on tuya/02200360600194733ae3/availability at 10:57 AM:

online

QoS: 0 - Retain: false

Message 1 received on tuya/02200360600194733ae3/availability at 10:57 AM:

offline

QoS: 0 - Retain: false

Message 0 received on tuya/02200360600194733ae3/availability at 10:57 AM:

online

QoS: 0 - Retain: true

The good news is for a single wall switch I am getting the following:

Message 4 received on tuya/05200385dc4f222a77db/1/state at 10:59 AM:

OFF

QoS: 0 - Retain: false

Message 3 received on tuya/05200385dc4f222a77db/1/command at 10:59 AM:

OFF

QoS: 0 - Retain: false

Message 2 received on tuya/05200385dc4f222a77db/1/state at 10:59 AM:

ON

QoS: 0 - Retain: false

Message 1 received on tuya/05200385dc4f222a77db/1/command at 10:59 AM:

ON

QoS: 0 - Retain: false

Message 0 received on tuya/05200385dc4f222a77db/availability at 10:59 AM:

online

QoS: 0 - Retain: true

How do I reference individual switches on a multi-gang switch or a power bar with 4 independently switched outlets? I assume I need to build a different gismo model for those?

Do you have any suggestions for the Gismo models for:

  • Dimmer Light
  • 4 Outlet Power Bar
  • Wall Switch with 2/3 Switches in 1 Gang

The gismo model describes the device. So, 1 model for e.g. all 2 gang switches (assuming they are of the same brand/type). For each specific device e.g. 2 gang switch in hallway and 2 gang switch in living you create a gismo and reuse (link) the gismo model.

Defining a model with multiple dp points (e.g. 2 or 3 gang switches) You add a extra dp key and select the ha component. ha topic (state_topic for switches)

For the 2 and 3 gang switches I have the extra dp keys are 2 and 3. (good chance that is the same for your devices but not guaranteed. )

P.S. thanks for the logs, will look into it

Iā€™m working to get this solution setup and Iā€™ve found that when I restart MQTT my switches and lights become unavailable. It looks like once MQTT restarts and Tuyagateway loses its connection the only solution is to restart the tuyagateway service on my linux box. Once I restart the tuyagateway service everything works perfectly. I was thinking I could use the HA command line switch to restart the tuyagateway service when HASS restarts and also create a button to do a restart on demand if I manually restart MQTT. I was wondering if anybody else has any better suggestions.

P.S. This solution is very promising and exciting! Thanks to the developer. I have my switches and an LED light setup. Iā€™m working on a Gizmo template with a dimmer switch and then all 30 or so of my Tuya devices will be local without flashing.

Hi Brian,
Perhaps your MQTT Broker isnā€™t setup correctly. TuyaGateway sends HA discovery messages to MQTT with the retain flag. So it wonā€™t send it again to prevent unnecessary network connections. The MQTT broker is expected to retain the messages as well (also on reboot). If youā€™re using mosquitto youā€™ll have to configure the database (path).
hth

Restarting home assistant should not restart the mqtt broker if you are using the addon. It runs in its own container.

Guys, can you share a quick tutorial how to install it in docker?

ā€œGuys, can you share a quick tutorial how to install it in docker?ā€

+1

possibility of an addon or custom component?