btmon guide

Post any 3rd party software here.
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: btmon guide

Post by mwall » Sun Jan 27, 2013 12:15 pm

grondo wrote:I just want to be able to send instantaneous consumption values to pvoutput,
the solar generation is gathered out-of-band by pvoutput itself. To do that I will
probably have to calculate a stream either by summing all the individual loads
or using the mains stream + solar stream (where solar is typically negative
when generating power). Does btmon already support this kind of configuration?
here are the instructions for using btmon with pvoutput.org:
PVOutput Configuration:

1) create an account
2) obtain API Key and System ID

Create an account at the PVOutput web site.

Create a system at the PVOutput web site.

In the Settings panel, obtain the API Key and System Id.

PVOutput expects the following information for each system:
- generated power/energy
- consumed power/energy
- temperature
- voltage

You must identify which channel monitors the total generated energy/power, and
which channel monitors the total consumed energy/power. If the device is a GEM
you can identify one of the temperature sensors as the temperature to upload.

The generation and consumption channels can be identified by channel, e.g. ch1,
or by serial_channel pair, e.g. 399999_ch1. The latter is useful when
collecting data from multiple ECM/GEM devices.

Code: Select all

[pvo]                                                                           
pvo_out = true                                                                  
pvo_api_key = XXXXX                                                             
pvo_system_id = XXXXX                                                           
pvo_generation_channel = 399999_ch1                                             
pvo_consumption_channel = 399999_ch2                                            
pvo_temperature_channel = 399999_t1                                             
grondo
Posts: 6
Joined: Sat Jan 26, 2013 10:03 am

Re: btmon guide

Post by grondo » Thu Jan 31, 2013 10:10 am

Thanks, I got it working from the comments in the code.
However, I did have to make the following change to get the right time sent to PVOutput
(I guess for me it is expecting local time not UT). Did I configure something incorrectly on
PVOutput, the GEM or my system running btmon?

Code: Select all

diff --git a/btmon-3.0.6-b3.py b/btmon-3.0.6-b3.py
index 5fbfbb0..682c83c 100755
--- a/btmon-3.0.6-b3.py
+++ b/btmon-3.0.6-b3.py
@@ -3715,8 +3729,8 @@ class PVOutputProcessor(UploadProcessor):
         p = packets[len(packets)-1]
         if self._havegen(p['serial']) or self._havecon(p['serial']):
             data = {}
-            data['d'] = time.strftime('%Y%m%d', time.gmtime(p['time_created']))
-            data['t'] = time.strftime('%H:%M', time.gmtime(p['time_created']))
+            data['d'] = time.strftime('%Y%m%d', time.localtime(p['time_created']))
+            data['t'] = time.strftime('%H:%M', time.localtime(p['time_created']))
             data['c1'] = 1
             data['v6'] = p['volts']
             if self._havegen(p['serial']):
grondo
Posts: 6
Joined: Sat Jan 26, 2013 10:03 am

Re: btmon guide

Post by grondo » Thu Jan 31, 2013 10:34 am

I also need to combine channels to get the total Consumption for my site
(no one single channel indicates total consumption, as the main feed obviously
is consumption - generation)

In my local copy of btmon I have added a TransformProcessor that always runs
before all other processors, and simply runs a function with the p[] dict as the
local namespace. This allows me to have the following in my config:

Code: Select all

transform_function = consumption_w = ch2_w + ch3_w + ch4_w + ch5_w + ch6_w + ch7_w + ch8_w + ch9_w + ch10_w + ch11_w + ch12_w + ch13_w + ch14_w + ch15_w + ch16_w + ch17_w +ch18_w + ch31_w;consumption_wh = ch2_wh + ch3_wh + ch4_wh + ch5_wh + ch6_wh + ch7_wh + ch8_wh + ch9_wh + ch10_wh + ch11_wh + ch12_wh + ch13_wh + ch14_wh + ch15_wh + ch16_wh + ch17_wh +ch18_wh + ch31_wh
and then

Code: Select all

pvo_consumption_channel = consumption
This works OK for me, but it isn't very satisfying. I'd rather have a stack of transformation functions
that all run before the output processors. However, I'm not a "native" python programmer so I'm
not confident I could come up with an acceptable implementation of this approach.

Thanks for the script -- very helpful!
mark
tomtoth
Posts: 2
Joined: Thu Jun 14, 2012 7:26 am

Re: btmon guide

Post by tomtoth » Thu Jul 10, 2014 8:11 pm

mwall wrote:thank you mike. this is exactly the kind of feedback i am looking for.

i added a few sections about GEM/ECM configuration. it will need an update after i have a chance to play with the new web-based GEM configuration interface.

the guide for edsmon is in the works...
(Sorry for the thread resurrection)
Did a edsmon guide ever get finished/posted? I'm tinkering with the edsmon.py script for an ow-server and not having any luck (Want to add to my smartenergygroups)... Even if any one has working sample config would be extremely helpful.

Thanks,
Tom
cottoa00@yahoo.com
Posts: 1
Joined: Thu Apr 16, 2015 5:26 pm

Re: btmon guide

Post by cottoa00@yahoo.com » Thu Apr 16, 2015 5:53 pm

Thanks mwall for the very well done btmon guide.

I'm using a raspberrypi to collect from my ecm1240 and then save to mysql at the same time posting to Xively (Pachube).

Everything had been working fine until some things got moved around and I hit a privs issue with mysql. I granted privs on the ecm database from ecmuser@raspberrypi-ecm but the script is failing on no privs for ecmuser@%. The % seems to be a wildcard for ecmuser coming from any host. I just opened up privs for % just to get things collected again. But how can I get btmon to use my raspberrypi-ecm host rather than trying to connect with the % wildcard? There doesn't seem to be a config setting reflecting where you are connecting from... thought it was somehow implicit in the DB calling libraries?

Cheers,
Tony Cotton
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: btmon guide

Post by mwall » Thu Apr 16, 2015 6:19 pm

cottoa00@yahoo.com wrote:I'm using a raspberrypi to collect from my ecm1240 and then save to mysql at the same time posting to Xively (Pachube).

Everything had been working fine until some things got moved around and I hit a privs issue with mysql. I granted privs on the ecm database from ecmuser@raspberrypi-ecm but the script is failing on no privs for ecmuser@%. The % seems to be a wildcard for ecmuser coming from any host. I just opened up privs for % just to get things collected again. But how can I get btmon to use my raspberrypi-ecm host rather than trying to connect with the % wildcard? There doesn't seem to be a config setting reflecting where you are connecting from... thought it was somehow implicit in the DB calling libraries?
tony,

what does 'show grants' tell you? is mysql running on the same host that the ecmuser is trying to connect from? what error do you get when you try to connect to the mysql as ecmuser directly (not using btmon)?

you could try this:

mysql> grant usage on ecm.* to 'ecmuser'@'raspberrypi-ecm' identified by 'password_goes_here';

this will work only if dns is working; the machine that mysql is running on must be able to resolve raspberrypi-ecm, either via dns or /etc/hosts

m
tazman1937
Posts: 3
Joined: Mon Dec 15, 2014 1:39 am

Re: btmon guide

Post by tazman1937 » Fri May 22, 2015 9:25 am

mwall - I love what you've done with btmon.py

I made something similar for my TED1001, it's here at my github:
https://github.com/jmohin/ted1001mon

I'm NOT a programmer or a web developer so this has been hard for me. The serial packet interpreter was written by micah dowty at http://scanlime.org/2008/10/interfacing ... detective/ , and I rolled it into a simple web uploader and mysql database saver, which is rough at best.

Your code seems to be much more elegant, memory-light. and stable. Any chance you could implement a TED1001 version based on the serial interpreter I posted above?
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: btmon guide

Post by mwall » Wed May 27, 2015 6:37 am

tazman1937 wrote:Any chance you could implement a TED1001 version based on the serial interpreter I posted above?
the mtools includes a tedmon.py that works with the ted 5000; i do not have a 1000 on which to test.

http://lancet.mit.edu/mwall/projects/power/

m
Post Reply