Merewether Weather, Merewether Tides and Solar Power Monitoring for Merewether, NSW, Australia - Newcastle Weather

Twitter Contact Login Search

Main

Mosquitto to COSM Bridge

Date:
By Mangrove Mike

Over the last couple of weeks I have been writing a MQTT to COSM bridge. Unfortunately (I think because of COSM) it has only been staying up and running for a few hours at a time.

My original code is here:

 

 

Thanks for Mosquitto developer and god, Roger Ligh (@ralight) t, I was pointed in the direction of the mosquitto topic bridging. It's all handled by the broker and is absolutely brilliant!

In the mosquitto.conf file you just need to add code similar to below:

## MB COSM Bridge configuration
connection cosm
try_private false
address api.cosm.com
start_type automatic
username <COSM_API_KEY>
password ignored
clientid mangrovemike
notifications true
notification_topic system/bridge/connection/cosm/state
topic "" out 0 weather/merewether/channel/ext_temperature /v2/feeds/81461/datastreams/0.csv
topic "" out 0 weather/merewether/channel/wind_speed /v2/feeds/81461/datastreams/10.csv
topic "" out 0 weather/merewether/channel/precipitation_daily /v2/feeds/81461/datastreams/2.csv
topic "" out 0 weather/merewether/channel/ext_humidity /v2/feeds/81461/datastreams/3.csv
topic "" out 0 weather/merewether/channel/pressure out /v2/feeds/81461/datastreams/4.csv
etc

 

Make sure you set the QOS value (which in this case is 0) as it wouldn't work with out it. Thanks also to Nick O'Leary (@knollery).

The full tribulations can be found on the MQTT google groups https://groups.google.com/forum/?fromgroups=#!topic/mqtt/_CqQkNtqmk8 .

 

 

 

You need to login to make a comment.