Read Power, Current and VRMS in personal python script


I am trying to write a python script to run some additional sensors I am adding to the emonPi, but I still want to pull in the data channels from the emonPi. I am trying to find the best way to pull the readings into my script. Looking at the data map (GitHub - openenergymonitor/emonpi: Raspberry Pi Based Energy Monitor. Hardware, Firmware & related software for the PI.), the sensors are read into the Raspberry Pi in the Jeelabs format to emonHub. From there to MQTT, and then sent to everywhere including the LCD.
The LCD does have python script that publishes the power and vrms on page 4 and power on page 3 by using the ConfigParser library and reading the cfg file.
Is there a way to read directly from MQTT using Pi, or is mirroring the LCD python the best option?



Yes you can subscribe to MQTT topics using python. I don’t know much python and even less about MQTT so all I can suggest is to google for examples, but perhaps somebody who does understand these subjects will come along with more direct help :grin:

As an alternative, if you go to the feed list page on your emoncms web site, you’ll see a link to Feed API Help. If you click on that, it will explain how to access feed data using HTTP requests, which can also be made from python of course.


I am going to try and copy some of the lines from the file and use it to hopefully get a response.