Connecting with Tasmota/ESPURNA and Mosquitto Bridge

#1

Hi

gbridge.io is so nice that im surprised the community is empty.
This looks like the best option for replacing china sonoff service.

But i tried with many configurations and still cant make it working.
Are there any logs for gbridge? mosquito is connecting but its not working in google home.

0 Likes

#2

Even when i dont use mosquitto and connect using plain mode. No action when using google home. Ofcourse always after “sync my devices”

0 Likes

#3

Thanks for sending your user id and moving this thread to the forum!

I’ve checked the logs, however there were now obvious issues in the last five hours.

Please try subscribing to the MQTT topics, either with
mosquitto_sub -h localhost -d -v -t gBridge/# when using your local bridge or
mosquitto_sub -u gbridge-uXYZ --pw 'your-password' -p 8883 --capath /etc/ssl/certs -t gBridge/# -d -v -h mqtt.gbridge.kappelt.net (direct). This will show whether it is an communication issue or a problem with the Tasmota conf.

0 Likes

#4

Done this and this the output

end maybe it seems to me but when i click light in google home the messages shows in (mosquitto_sub -h localhost -d -v -t gBridge/#) window

0 Likes

#5

Think I got it, thanks for the last image. Don’t know why I haven’t seen that earlier.

There is a problem with your Mosquitto bridge conf. Two problems there:

  1. The lines
    topic cmnd/# in 0 {local_prefix}/ gBridge/u{userid}/
    topic stat/# out 0 {local_prefix}/ gBridge/u{userid}/
    are commented out (a hash is before those lines). They are not applied.

  2. The lines from 1 only work for the default tasmota config. You’ve entered a custom “full topic” in your sonoff, so you’d need to bridge topics like that:
    topic gBridge/u{uid}/cmnd/+/power both 0 "" ""
    topic gBridge/u{uid}/stat/+/POWER both 0 "" ""

Another problem: The tasmota firmware requires you to use lowercase power for the Action topic and uppercase POWER for the status topic. I’ve checked your devices in the database, you are using POWER (uppercase) for both.

Sorry if the documentation is not clear at those points, we’ll improve some parts (especially those for integration) soon.

0 Likes

#6

Yes Yes Yes :slight_smile: Now everything working like a charm . And it’s working waaay better than openhab2 cloud. Thanks. And I wish you this project to be more popular :slight_smile:

So for others making Tasmota working with Mosquitto more clearly .

  1. Install Mosquito newest version:
    https://theembeddedlab.com/tutorials/install-mosquitto-on-a-raspberry-pi/

  2. Edit /etc/mosquitto/mosquitto.conf adding at the end:

connection gbridge-io
address mqtt.gbridge.io:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv311
cleansession true
remote_username {gbridge-mqtt-username}
remote_password {gbridge-mqtt-password}
remote_clientid gbridge-u{userid}-{randomstring}
topic gBridge/u{uid}/cmnd/+/power both 0 "" ""
topic gBridge/u{uid}/stat/+/POWER both 0 "" ""
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2
  1. Configure Tasmota MQTT settings

  2. Add Device on https://gbridge.kappelt.net/device

Edited by Administrator on 01-29-2019: Adapted config for new MQTT server (mqtt.gbridge.io)

0 Likes

#7

Awesome! Thanks for the hints, I’ll consider them when updating the docs.

0 Likes

#9

@Paddy Is your problem resolved now?

0 Likes

#10

Thank you very much @kaju666 !

I could not get the bridge working, with your screenshots I managed to get it working perfectly !

@peter it would be great to update the page with the correct configurations :slight_smile:

0 Likes

#11

Honestly, I don’t See what the problem with the documentation is…

It just works, as well as this guide. The only difference is that the guide in the docs uses default Sonoff settings, while this one modifies them to directly match gBridge topics.

Could you give me a hint there?

0 Likes

#12

@peter the issue was the configuration to bridge mqtt messages to the tasmota module.

Mqtt messages from your server arrive successfully on my mosquitto server, I see them in the logs, but aren’t forwarded to my tasmota module.

0 Likes

#13

So i changed in my house from Tasmota to ESPURNA becouse of low stability of mqtt conection

This is working config for ESPURNA:

  1. /etc/mosquitto/mosquitto.conf

    connection kappelt-gbridge
    address mqtt.gbridge.kappelt.net:8883
    bridge_attempt_unsubscribe true
    bridge_protocol_version mqttv31
    cleansession true
    remote_username {gbridge-mqtt-username}
    remote_password {gbridge-mqtt-password}
    remote_clientid gbridge-u{userid}-{randomstring}
    
    topic gBridge/u{uid}/+/relay/0/set both 0 "" ""
    topic gBridge/u{uid}/+/status both 0 "" ""
    #you might need to change the path of the CA files
    #This one is valid for most Debian based systems
    bridge_capath /etc/ssl/certs/
    bridge_tls_version tlsv1.2
    
  2. ESPURNA Config MQTT

  1. Config gbridge.kappelt.net/device

0 Likes

#14

Yes, sorry. I just had a typo :sweat_smile:

0 Likes

#15

I setup as documented. Everything works perfectly except this:
I ask google assistant to turn on a light and the light turns on. Then I ask if the light is turned on and the response is that the light is turned off! What might be wrong?

0 Likes

#16

Opps! My mistake. Found a typo in mosquitto.conf. Works fine now.

1 Like