I've been working on the idea of a dedicated version of emoncms designed for running on the raspberrypi (or other linux computer with rfm12pi or jeelink connected). The provisional name is emonview but that doesnt really describe what this version of emoncms is designed to do as Im intending that it also handles control, serving control UI like a heating system scheduler (keeping control within the home rather than using a control implementation in the cloud). Interested in hearing ideas for a better name.
I've been trying to implement a higher quality HTTP API as part of this which may be of particular interest https://github.com/trystanlea/emonview/blob/version2/docs/httpapi.md
It also uses MQTT as the bridge between emonhub and 'emonview' for updating the latest values. The way node data is stored in emonview reflects the way emonhub stores the nodes configuration and the way it handles node decoding. emonview uses the same conf file as emonhub.
This is the line in the emonview server where the MQTT message from emonhub is received:
https://github.com/trystanlea/emonview/blob/version2/server.py#L262
The MQTT topic name is: api/nodeid/values, and msg payload 100,200,300 (csv values) as produced by the output of the emonhub decoder.
This is the line in the MQTT emonhub dispatcher where the MQTT message is sent (using pb66's template MQTT dispatcher)
https://github.com/TrystanLea/emonhub/blob/development/src/emonhub_repor...
I've moved away from the idea of emonhub sending MQTT messages (to emonview) with topics of the form:
api/nodeid/varid/value
api/room/temperature/value
to sending all the values in a csv: api/nodeid/values 100,200,300 which is easier to work with inside emonview especially as the nodes interface aims to represent rfm12/69 network nodes. That said I dont see any reason why emonhub could not also send messages out with the full node/var api for other applications like node-red.
Im now running emonview on my home setup (as well as the standard image) Im also copying developments I make in emonview across to emoncms such as improvements to the feed engines for better graphing and a series of application specific dashboards.
Im also exploring the idea of a setup that does not need input processing in the way it was initially required in emoncms and am in the process of writing a post processing module that will make it possible initially to calculate accumulating kwh feeds from power feeds but could be extended.
The code for emonview is on github here, it uses python, flask & socketio :) Hope that gives a bit of an idea for what Im exploring, its ongoing work in progress, and there are lots of things around control packet implementation, input processing, post processing, dashboard implementation, config variable storage that need working on before this gets to something stable.
The idea at the moment is to go through a period of faster development by exploring lots of options without constraining to one development path and trying to pull the entirety of emoncms cloud and raspberrypi versions along that at the same time
Re: EmonView (RaspberryPI Python version of emoncms) concept + MQTT
Hi Trystan,
Nice job, I'm trying to use this one as new project. To be honest, I'm a little lost because the "node" part of emoncms had so much change during the past that I'm not really sure this is the one I need to use for emoncms, but as it's new, I think so ;-)
Well, that said, I followed your wiki and it's working fine. I would like now to have this part on a dedicated server and be able to send data using API but I did not succeeded to do so. Ideally I would like to just have REST api and be able to send data using simple command like http://myserver/emonview?node=10&data=10,20,30 as it was done by emoncms core.
Whatever post syntax will be fine (JSON, CSV, ..) But I'm unable to get it working. What I tried is to remove emonhub from the loop because I don't need it and potentially also remove MQTT but for this one I'm not sure it's possible.
Would you mind provide me example on how to post data without emonhub ? I think I can live also with posting using mosquitto_pub syntax, but once again I did not succeded to do this.
Any help and example would be greatly appreciated.
Thanks for your nice job
Re: EmonView (RaspberryPI Python version of emoncms) concept + MQTT
I've moved the emonview repository from the emoncms github account to my personal github account here https://github.com/trystanlea/emonview to keep the main emoncms repository cleaner. I would like to build on this at some point but for now its an idea on pause...