Spent this weekend doing a project using some old ARM boards I had around to start using MQTT to centralize my sensor data a bit from multiple sources. Sorry for the long post, but figured it may interest a few people here.
Currently I had data coming from a few places that I started with:
- 1-wire -> XapMCS1wire -> Xap -> Xap Plugin -> Homeseer
- Davis Weather station -> Weewx -> Wunderground, APRS-IS, *not* connected to Homeseer
- ESP8266 wifi boards I wanted to use (coming soon!)
Starting config:
- HS3 on Windows, running MQTT plugin from Updater (more details here http://www.domoticaforum.eu/viewforum.php?f=74)
- Weewx on a BeagleBone Black running Ubuntu
MQTT Server:
Coworker gave me a Raspberry Pi 2 he didn't need, so decided to use this for the MQTT server. Started with Linux Mint, removed the UI and installed Mosquitto server following these directions:
https://lukeisadog.wordpress.com/201...buntu-round-1/
Took literally 5mins to get running... was amazed how easy. Added auth support, but MQTT plugin in HS I don't see a way to do auth with it, so optional for now.
MQTT Plugin Initial Config:
Started with a simple config since my own internal network, and set the subscribe path to watch everything, "#, /#"
WeeWX:
This was actually a lot easier than I thought. I had already been pushing data to Wunderground and APRS-IS, but wanted to also be able to receive within HS. turns out there's a WeeWX plugin for MQTT:
https://github.com/weewx/weewx/wiki/mqtt
Changed setting in weewx.conf to match my server details, and within a few minutes starting seeing data on the MQTT server using the command:
Output:
1-Wire:
I've been using 1-wire for yeeaaars with XapMCS1wire and the MCSXap plugin (they work GREAT btw.) However lately wanted to try my hand at using OWServer, http://owfs.org/ so I could use some existing wiring going thru the house for Ethernet as a generic sensor network instead of just 1wire. (This is sort of what started this project off...) Plan is to add OWServers in the two key areas; attic and basement then reuse the existing cat5 going to attic for 1wire to be a normal LAN (chase pipe to attic is already pretty full...)
Right now I've started with the first server using an old Beagle Bone Black in the basement until I split the network into pieces. This BBB is running Ubuntu Server, with DS9490 USB plugged into the back. Installation of OWW was thru the normal Ubuntu packages, and set the config files using this post:
https://www.raspberrypi.org/forums/v...27379&p=505250
IMPORTANT NOTE: I'm not using OWFS but the OWServer Service ATM as not need for it. more on that in a moment.
1-Wire to MQTT Bridge:
This is where the magic happens... After some Google searches I found an OW Server to MQTT python script that did 90% of what I needed:
https://github.com/kylegordon/mqtt-owfs-temp
However it's a few years old, and only supported temperature sensors. It did support OWServer queries directly, so no need to do an OWFS local mount and parse it. I started doing some modifications, and forked my own version here:
https://github.com/mloebl/mqtt-owfs-temp
I added support for Humidity, Barometer and Illuminance sensors, including more complex pathing. Details on packages I needed to install are in the readme file within that repo. It's still only supports a few sensors, but wouldn't be hard to modify to add more as needed. Also seems to support sensors thru the Hobby Boards hub that are in the attic until I split it, so double bonus. This python script runs and queries the OWserver every 60s, and dumps to my MQTT server here:
Data Aggregation Within Homeseer3:
The MQTT plugin makes this pretty easy. You can easily subscribe to MQTT topics thru their subscription options. You can see the topic paths using the mosquitto_sub I mentioned above:
Current Configuration:
- HS3 on Windows, running MQTT plugin connected to MQTT server
- Mosquitto MQTT server running Ubuntu
- Davis Weather station-> Weewx Server on Ubuntu Server-> WeeWX MQTT Plugin->MQTT Server
- 1-wire ->OWFS OWServer on Ubuntu -> Python MQTT Script running as a service->MQTT Server
Going to run with this for a couple weeks and see how it does. We've used MQTT at work for some past projects, but first time I've gotten my hands dirty with it. Pretty happy with the results so far and was amazed how easy it was. Worst part of the project, that I left out above, was when I reused an IP addressed from an old server that apparently had powered on by accident... So spent 2 days trying to figure out why some things could connect and others couldn't to the MQTT server... oops
Currently I had data coming from a few places that I started with:
- 1-wire -> XapMCS1wire -> Xap -> Xap Plugin -> Homeseer
- Davis Weather station -> Weewx -> Wunderground, APRS-IS, *not* connected to Homeseer
- ESP8266 wifi boards I wanted to use (coming soon!)
Starting config:
- HS3 on Windows, running MQTT plugin from Updater (more details here http://www.domoticaforum.eu/viewforum.php?f=74)
- Weewx on a BeagleBone Black running Ubuntu
MQTT Server:
Coworker gave me a Raspberry Pi 2 he didn't need, so decided to use this for the MQTT server. Started with Linux Mint, removed the UI and installed Mosquitto server following these directions:
https://lukeisadog.wordpress.com/201...buntu-round-1/
Took literally 5mins to get running... was amazed how easy. Added auth support, but MQTT plugin in HS I don't see a way to do auth with it, so optional for now.
MQTT Plugin Initial Config:
Started with a simple config since my own internal network, and set the subscribe path to watch everything, "#, /#"
WeeWX:
This was actually a lot easier than I thought. I had already been pushing data to Wunderground and APRS-IS, but wanted to also be able to receive within HS. turns out there's a WeeWX plugin for MQTT:
https://github.com/weewx/weewx/wiki/mqtt
Changed setting in weewx.conf to match my server details, and within a few minutes starting seeing data on the MQTT server using the command:
Code:
mosquitto_sub -t \#
Code:
weather/monthET 0.0 weather/barometer_inHg 29.6840967742 weather/windrun_mile 0.0 weather/rainAlarm 0.0 weather/dayET 0.0 weather/interval_minute 1.0 weather/dewpoint_F 15.5842869329
I've been using 1-wire for yeeaaars with XapMCS1wire and the MCSXap plugin (they work GREAT btw.) However lately wanted to try my hand at using OWServer, http://owfs.org/ so I could use some existing wiring going thru the house for Ethernet as a generic sensor network instead of just 1wire. (This is sort of what started this project off...) Plan is to add OWServers in the two key areas; attic and basement then reuse the existing cat5 going to attic for 1wire to be a normal LAN (chase pipe to attic is already pretty full...)
Right now I've started with the first server using an old Beagle Bone Black in the basement until I split the network into pieces. This BBB is running Ubuntu Server, with DS9490 USB plugged into the back. Installation of OWW was thru the normal Ubuntu packages, and set the config files using this post:
https://www.raspberrypi.org/forums/v...27379&p=505250
IMPORTANT NOTE: I'm not using OWFS but the OWServer Service ATM as not need for it. more on that in a moment.
1-Wire to MQTT Bridge:
This is where the magic happens... After some Google searches I found an OW Server to MQTT python script that did 90% of what I needed:
https://github.com/kylegordon/mqtt-owfs-temp
However it's a few years old, and only supported temperature sensors. It did support OWServer queries directly, so no need to do an OWFS local mount and parse it. I started doing some modifications, and forked my own version here:
https://github.com/mloebl/mqtt-owfs-temp
I added support for Humidity, Barometer and Illuminance sensors, including more complex pathing. Details on packages I needed to install are in the readme file within that repo. It's still only supports a few sensors, but wouldn't be hard to modify to add more as needed. Also seems to support sensors thru the Hobby Boards hub that are in the attic until I split it, so double bonus. This python script runs and queries the OWserver every 60s, and dumps to my MQTT server here:
Code:
/raw/owserver01/1-wire/1F.497F02000000/main/26.CDA721010000/humidity 45.8854 /raw/owserver01/1-wire/1F.497F02000000/main/10.F54D7C020800/temperature 41.25 /raw/owserver01/1-wire/26.09E39D000000/B1-R1-A/pressure 29.803598403 /raw/owserver01/1-wire/1F.497F02000000/main/26.CDA721010000/S3-R1-A/illuminance 65.8839
The MQTT plugin makes this pretty easy. You can easily subscribe to MQTT topics thru their subscription options. You can see the topic paths using the mosquitto_sub I mentioned above:
Current Configuration:
- HS3 on Windows, running MQTT plugin connected to MQTT server
- Mosquitto MQTT server running Ubuntu
- Davis Weather station-> Weewx Server on Ubuntu Server-> WeeWX MQTT Plugin->MQTT Server
- 1-wire ->OWFS OWServer on Ubuntu -> Python MQTT Script running as a service->MQTT Server
Going to run with this for a couple weeks and see how it does. We've used MQTT at work for some past projects, but first time I've gotten my hands dirty with it. Pretty happy with the results so far and was amazed how easy it was. Worst part of the project, that I left out above, was when I reused an IP addressed from an old server that apparently had powered on by accident... So spent 2 days trying to figure out why some things could connect and others couldn't to the MQTT server... oops
Comment