kservices / gBridge

gBridge.io allows you to control (almost) anything with Google Assistant, by translating voice commands to MQTT messages.
https://about.gbridge.io
MIT License
173 stars 44 forks source link

gBridge and Tasmota: Action topic works, status topic does not #12

Closed ruhrgebietler closed 5 years ago

ruhrgebietler commented 5 years ago

Hi Peter,

great work with gBridge, I really do enjoy the experience!

Here's a problem that came up when I integrated my Tasmota-enabled Sonoff S20 power plugs with gBridge. I have a similar setup as the user in #11 and my problem might also have to do with the interpretation of topics between Tasmota and gBridge.

Here's my basis setup: Tasmota-enabled device <--MQTT-unencrypted--> Mosquitto-Bridge <--MQTT-TLS--> gBridge <---> Google Home

Setup

Here are my configs:

Tasmota

Topic = wallsocket
FullTopic = gBridge/uXX/%prefix%/%topic%/

As mentioned in #11 the prefix can be cmnd or stat and there is also the suffix POWER. Therefore, the resulting topics of my Tasmota are gBridge/uXX/cmnd/wallsocket/POWER and gBridge/uXX/stat/wallsocket/POWER as verified in the log of Tasmota and in the log of the Mosquitto bridge.

Mosquitto

connection kappelt-gbridge
address mqtt.gbridge.kappelt.net:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv31
cleansession true
remote_username gbridge-uXX
remote_password YYY

topic gBridge/uXX/+/+/POWER both 0 "" ""
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2

Nothing spectacular here. Compared to the section on bridge configuration in the gBridge Docs I only changed the topic to match my topic format.

gBridge

Light with on/off trait
ActionTopic = gBridge/uXX/cmnd/wallsocket/POWER
StatusTopic = gBridge/uXX/stat/wallsocket/POWER

gBridge was configured to match the Tasmota topics. I hope that I interpreted it correctly that cmnd is the action topic and stat is the status topic, see https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview

Google Home Has been linked with gBridge and sees the device.

Problem

The setup described above seems to work just fine. Google Home sees the device in gBridge. The bridge also works and successfully connecty the Tasmota to gBridge. I can toggle the light in the Google Home app or via voice commands.

However, Google Home always reports the light as being turned on. I can toggle it off but as soon as i close the Home app and reopen the device it is again shown as switched on. Therefore, I think the issue is with the status topic.

Possible things that could be wrong:

Do you know what could be the issue? Can you suggest ways how I can better debug what went wrong?

Thanks in advance!

peterkappelt commented 5 years ago

"Ruhrgebietler" hört sich Deutsch an, oder?

Yep, the values are case-sensitive. This is not an issue with MQTT itself, but with gBridge. Thats likely the issue with Tasmota.

I'm going to implement a first fix (making the values case-insensitive) this weekend.

ruhrgebietler commented 5 years ago

Thanks for the quick reply! I'll report back when your fix is deployed.

PS: Ja, ich bin aus dem Ruhrpott :-)

peterkappelt commented 5 years ago

Fix is implemented, now uppercase values for the OnOff trait are supported. Please re-open the issue if the problem persists.

ruhrgebietler commented 5 years ago

I can report back that the issue is resolved. Much appreciated!

kaju666 commented 5 years ago

@peterkappelt hi i tried with many configurations and still cant make it work :( is ther any logs for gbridge? mosquito is connecting but its not working in goolge home, any reaction. congig