I have managed to put the pieces in place and have a Sonoff TH16 switching both locally in Hassio and remotely in Google Assistant using gBridge.
Thing is the state of the switch is not updated properly.
The Google Assistant command “on or off” does what it should however not knowing the state is a pain. Any ideas?
As the doco on this is fragmented here is the working code you need to make it happen.
Why are you using bridge for that? Just install the Google Assistant component in Home Assistant or use Nabu Casa… mine all work fine with state correct.
The manual integration I use… the simulator @ google needs to be re-enabled every 30 days BUT only if you re-sync your devices. If you don’t add/subtract anything it will go for months.
You’re just overly complicating it for no benefit IMO.
All my switches update when I issue voice commands. It works perfectly.
I agree, the gBridge route was painful.
Checked my Google API and it is a wreck so will need to redo that.
I have a duckdns domain set up their end but guessing that needs to be integrated into Hassio with the Duck DNS addon…somehow.
Enough experimenting for the day, getting that relay to click took a lot out of me
It doesn’t have to be… my duckdns is updated by a shell script… I’m running Debian/docker/hass.io but yeah… you heed a https endpoint for google to be able to talk to Home Assistant… but if you setup that bridge you can do that without breaking a sweat lol!
Regarding your gBridge setup, I found this link a useful example to work from.
Something I noticed with your setup is you have topic and prefix reversed in your sonoff device (to enable auto discovery?). So your gBridge Action and Status topics should be reversed to match this:
Also, the topic definitions in your mosquitto.conf file:
topic cmnd/# in 0 sonoff01/ gBridge/u0000/sonoff01/
topic stat/# out 0 sonoff01/ gBridge/u0000/sonoff01/
I am in the process of setting up gBridge with my tasmota devices and still learning about topic mappings, so dont take the suggestions above as gospel.