[SOLVED] Mosquitto bridge and Ubidots


#1

Hi, Im triyng to configure in my raspberry a mosquitto bridge to ubidots, but for some reason doesnt work…

First, if I run this command, all work just fine and ubidots see the send value:

mosquitto_pub -u my-ubidots-token-abc123456 -h things.ubidots.com -p 1883 -t /v1.6/devices/iot001/power -m '{"value":"55.01"}'

My device post on my local rpi broker on the topic /v1.6/devices/iot001/power :

mosquitto_pub -h my-rpi-ip -p 1883 -t /v1.6/devices/iot001/power  -m "{\"value\":\"1.42\"}"

My /etc/mosquitto/conf.d/ubidots.conf:

connection ubidots
restart_timeout 10
address things.ubidots.com:1883
username my-ubidots-token-abc123456
cleansession true
start_type automatic
topic # out 2 /v1.6/devices/iot001/power/ /v1.6/devices/iot001/power/
clientid myid12345
try_private false

but the messages never show on ubidots, here my mosquitto.log:

1497643486: Bridge raspberrypi.ubidots doing local SUBSCRIBE on topic /v1.6/devices/iot001/power/#
1497643486: Connecting bridge ubidots (things.ubidots.com:1883)
1497643486: Bridge raspberrypi.ubidots sending CONNECT
1497643486: Received CONNACK on connection raspberrypi.ubidots.
1497643486: Bridge raspberrypi.ubidots sending UNSUBSCRIBE (Mid: 18, Topic: /v1.6/devices/iot001/power/#)
1497643486: Socket error on client raspberrypi.ubidots, disconnecting.
1497643517: Bridge raspberrypi.ubidots doing local SUBSCRIBE on topic /v1.6/devices/iot001/power/#
1497643517: Connecting bridge ubidots (things.ubidots.com:1883)
1497643517: Bridge raspberrypi.ubidots sending CONNECT
1497643517: Received CONNACK on connection raspberrypi.ubidots.
1497643517: Bridge raspberrypi.ubidots sending UNSUBSCRIBE (Mid: 20, Topic: /v1.6/devices/iot001/power/#)
1497643517: Socket error on client raspberrypi.ubidots, disconnecting.

Whats is the mining of Socket error on client


#2

hi @gazambuja

I make some changes in your configuration:

connection ubidots
restart_timeout 10
address things.ubidots.com:1883
cleansession true
try_private false
bridge_attempt_unsubscribe false
notifications false
remote_clientid clientRandom124123
remote_username TOKEN
remote_password TOKEN
topic # out 1 rpi/ /v1.6/devices/

In your raspberry the command would be:

mosquitto_pub -h my-rpi-ip -p 1883 -t rpi/iot001/power  -m "{\"value\":\"1.42\"}"

Gustavo.


#3

Thanks!
For the record, if you use a RPi, you have mosquitto 1.3.4, this is the file compatible with that:

connection ubidots
restart_timeout 30
username MY-UBI-TOKEN
password MY-UBI-TOKEN
address things.ubidots.com:1883
notifications false
cleansession true
start_type automatic
topic # out 1 rpi/ /v1.6/devices/
try_private false
clientid clientRandomIOT001

#4

Thanks for sharing it with the community!

All the best,
Maria C.