Community
OpenEnergyMonitor

Community

Read Power, Current and VRMS in personal python script

Hello,

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 (https://github.com/openenergymonitor/emonpi#raspberry-pi-based-energy-monitoring-unit), 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?

Thanks,

Daniel

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.

Thanks,

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