btmon patch for MQTT Publication
-
- Posts: 25
- Joined: Thu Feb 10, 2011 1:17 pm
- Location: California
btmon patch for MQTT Publication
Hi,
I have a patch that adds MQTT to the list of sinks that btmon.py can publish to. I've been running it for a few days now to publish my GEM & ECM-1240 data to openHAB.
I PM'd @mwall, as I wanted to have it vetted prior to publishing it out. Does anyone know a better way to get ahold of Matthew?
It looks like the Contact Information link on his page doesn't list him anymore.
I have a patch that adds MQTT to the list of sinks that btmon.py can publish to. I've been running it for a few days now to publish my GEM & ECM-1240 data to openHAB.
I PM'd @mwall, as I wanted to have it vetted prior to publishing it out. Does anyone know a better way to get ahold of Matthew?
It looks like the Contact Information link on his page doesn't list him anymore.
-
- Site Admin
- Posts: 4262
- Joined: Fri Jun 04, 2010 9:39 am
Re: btmon patch for MQTT Publication
That's pretty interesting, do you have any screenshots of what the integration looks like?
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Brultech Research Inc.
E: ben(at)brultech.com
-
- Posts: 25
- Joined: Thu Feb 10, 2011 1:17 pm
- Location: California
Re: btmon patch for MQTT Publication
No screenshots (yet) since I'm pushing the data to openHAB to allow for Home Automation events, more than display/graphs (although it can do both).
Arch wise it's just:
I pump all the same data that btmon emits (W, Wh, dWh, Temp, Pulse), and allow btmon to have optional aliases for each Channel into their counterpart MQTT Topic. btmon also publishes the data to SEG & PVOutput.
eg.
and you end up with a set of discrete MQTT topics like:
Then anything that can subscribe to the MQTT Broker will see the same data including:
In openHAB you bind them to Items, and then write rules against them, put them into charts and/or simple displays. The raw Item update stream might look like:
but the rule is just a script that looks at the Item values, sourced from the GEM-via-MQTT, and does stuff.
eg. shutdown stuff is today's Solar-gen is too low, or start Dish/Clothes washers if you have excess.
Arch wise it's just:
Code: Select all
GEM (RN-XV) ---> btmon.py (RPi B) ---> MQTT Broker/mosquitto (ODroid C1) <---> openHAB + HA Bindings (ODroid C1)
ECM-1240 (USB-Serial)---^ ^ ^ (Lights|TStats|Alarm|AV)
/ \
v v
OwnTracks MQTTWarn
eg.
Code: Select all
[mqtt]
mqtt_out = true
mqtt_topic_base=/home/energy
mqtt_upload_period = 90
mqtt_host = odroid
mqtt_clientid = my_power
mqtt_user = bythepower
mqtt_passwd = ofgreyskull
mqtt_map = 010EIEI0_volts,volts,010EIEI0_ch1_w,bath_w,...010EIEI0_ch14_w,solar_w,010EIEI0_ch14_wh,
solar_wh,010EIEI0_ch14_dwh,solar_dwh,010EIEI0_ch,01000175_t1,garage_temperature,...
Code: Select all
/house/energy/volts
/house/energy/bath_w
/house/energy/solar_w
/house/energy/solar_wh
/house/energy/solar_dwh
/house/energy/garage_temperature
...
- * other, federated, MQTT Brokers (like https://www.cloudmqtt.com)
* monitoring/alerting tools like MQTTWarn (https://github.com/jpmens/mqttwarn)
* openHAB/MQTT Binding
In openHAB you bind them to Items, and then write rules against them, put them into charts and/or simple displays. The raw Item update stream might look like:
Code: Select all
2015-09-16 16:56:12 - HouseVoltsAlt state updated to 127.2
2015-09-16 16:57:23 - HouseVolts state updated to 123.7
2015-09-16 16:57:23 - HousePowerGarage state updated to 41.297
2015-09-16 16:57:23 - HousePowerSolar state updated to 709.495
2015-09-16 16:57:23 - HousePowerGarageLights state updated to 20.967
2015-09-16 16:57:23 - HouseEnergyGarage state updated to 966622.902
2015-09-16 16:57:23 - HouseEnergySolar state updated to 6929898.28
2015-09-16 16:57:23 - HouseEnergyGarageLights state updated to 328703.711
2015-09-16 16:57:23 - HouseTemperatureGarage state updated to 75.0
2015-09-16 16:57:23 - HouseDEnergyGarage state updated to 1.044
2015-09-16 16:57:23 - HouseDEnergySolar state updated to 17.934
2015-09-16 16:57:23 - HouseDEnergyGarageLights state updated to 0.53
2015-09-16 16:57:43 - HouseVoltsAlt state updated to 125.8
2015-09-16 16:58:55 - HouseVolts state updated to 123.8
eg. shutdown stuff is today's Solar-gen is too low, or start Dish/Clothes washers if you have excess.
-
- Posts: 25
- Joined: Thu Feb 10, 2011 1:17 pm
- Location: California
Re: btmon patch for MQTT Publication
This is the corresponding discussion thread on the openHAB forum:
I was going to write a native openHAB binding, but the MQTT route seemed more flexible.
It'd be really interesting if the GEM's emitted MQTT as a native format.
It'd be really interesting if the GEM's emitted MQTT as a native format.
-
- Posts: 25
- Joined: Thu Feb 10, 2011 1:17 pm
- Location: California
Re: btmon patch for MQTT Publication
ben,
I've done a little reading and, from a pure-ui standpoint, I'd probably do something like this: and then substitute the openHAB Datasource components for bits working directly against my MQTT (having everyone then publish their bits to MQTT, since there's already a MQTT Gist to do that type of thing.
The Dashing library seems fairly flexible for a UI that needs both Display + Control components.
That said, I'd likely simplify the Energy data down to Solar (today, this month), Net Consumption (today, this month) and a label of which channel is currently consuming the most... I need room to fit a bunch of other controls on the page
I've done a little reading and, from a pure-ui standpoint, I'd probably do something like this: and then substitute the openHAB Datasource components for bits working directly against my MQTT (having everyone then publish their bits to MQTT, since there's already a MQTT Gist to do that type of thing.
The Dashing library seems fairly flexible for a UI that needs both Display + Control components.
That said, I'd likely simplify the Energy data down to Solar (today, this month), Net Consumption (today, this month) and a label of which channel is currently consuming the most... I need room to fit a bunch of other controls on the page
-
- Site Admin
- Posts: 4262
- Joined: Fri Jun 04, 2010 9:39 am
Re: btmon patch for MQTT Publication
That's pretty neat, last time I played around with OpenHAB I was messing with GreenT.guessed wrote:ben,
I've done a little reading and, from a pure-ui standpoint, I'd probably do something like this: and then substitute the openHAB Datasource components for bits working directly against my MQTT (having everyone then publish their bits to MQTT, since there's already a MQTT Gist to do that type of thing.
The Dashing library seems fairly flexible for a UI that needs both Display + Control components.
That said, I'd likely simplify the Energy data down to Solar (today, this month), Net Consumption (today, this month) and a label of which channel is currently consuming the most... I need room to fit a bunch of other controls on the page
I let Paul know about MQTT, not sure when he'll have time to look into it.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Brultech Research Inc.
E: ben(at)brultech.com
-
- Posts: 68
- Joined: Sat Oct 08, 2011 2:48 am
- Location: Sweden
Re: btmon patch for MQTT Publication
I'm heading into guessed's route now, so I just wanted you guys not to forget to the MQTT wish. It all would be much cleaner.
-
- Posts: 14
- Joined: Thu Oct 27, 2016 9:00 pm
Re: btmon patch for MQTT Publication
Another OpenHAB user here, adding +1 to request for native MQTT formatted data from the GEM.
Any status or ETA on this?
Any status or ETA on this?
-
- Posts: 140
- Joined: Wed Dec 07, 2011 6:25 pm
Re: btmon patch for MQTT Publication
btmon has had mqtt support for some time now.gosmond wrote:Another OpenHAB user here, adding +1 to request for native MQTT formatted data from the GEM.
Any status or ETA on this?
ben and paul would have to say for certain, but mqtt in the gem firmware could be complicated. the protocols are easy, but there are many permutations, such as retain, last-will-and-testament, quality-of-service, not to mention the variety of possible data formats. it would be easy to upload a json-formatted packet with all of the data. but if your broker or downstream consumer cannot handle that, then you'll have to inject some processing along the way anyway.
try the btmon mqtt implementation. then give ben and paul some feedback about exactly *how* you want mqtt implemented.
m
-
- Site Admin
- Posts: 4262
- Joined: Fri Jun 04, 2010 9:39 am
Re: btmon patch for MQTT Publication
We looked through MQTT but it unfortunately doesn't look like something the GEM can support by itself.
You're best off using a solution with btmon.py as mwall mentioned above. You should be able to run it on the same server running OpenHAB.
You're best off using a solution with btmon.py as mwall mentioned above. You should be able to run it on the same server running OpenHAB.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Brultech Research Inc.
E: ben(at)brultech.com