Page 1 of 2

btmon patch for emoncms 8.4

Posted: Fri Feb 06, 2015 10:41 am
by gtallan
Don't know if anyone here is using emoncms, I just threw together a lighting self-hosted install, to "kick the tires" relative to SEG, and I found that btmon.py doesn't work correctly with the latest version out of git - the inputs get massively duplicated. It seems that a node ID has to be sent now - the problem is described here:

http://openenergymonitor.org/emon/node/6315

This probably doesn't affect the main emoncms site, just self-hosted ones running the latest version. Here's my trivial patch to btmon 3.0.7:

# diff btmon.py.orig btmon.py
3600c3600
< url = '%s?apikey=%s&time=%s&json={%s}' % (
---
> url = '%s?node=1&apikey=%s&time=%s&json={%s}' % (

Had a bit of trouble finding an email address for mwall but hope I managed to send it to him.

Graham

Re: btmon patch for emoncms 8.4

Posted: Fri Mar 06, 2015 8:43 am
by pjb01
Hi,

I spent an hour or so trying to figure out why the upgrade to emoncms 8.4.0 (from 8.3.6) had caused my setup to stop working (before I saw your post!)

I implemented your btmon fix, and everything is back up and running.

Thanks!
Peter

Re: btmon patch for emoncms 8.4

Posted: Fri May 29, 2015 10:31 am
by sub3marathonman
OK, I've been trying to reinvent the wheel now for two days.

I'd be happy to be able to use emoncms 8.4, although right now I'm trying with emoncms 8.5, which they say is the one to get if I'm starting out now. I am using my computer, as opposed to their website for this, as was mentioned by the OP gtallon.

Maybe somebody can explain things real slow, as the only Python I know is Monty. :lol: (Couldn't resist, first time anybody's heard that??) And I have no idea what the patch mentioned is, how it works or where it goes inside the original btmon.py script.

I have the WAMPSERVER installed, possibly even done correctly. I can go to the localhost and see "Your Projects" but it doesn't go to the project correctly. I have a "project" test that somehow seemed to be able to get some data sent to it using the instruction guide mentioned at
http://lancet.mit.edu/mwall/projects/po ... howto.html

I have the Python 2.7.01 installed on the computer, and have copied the btmon.py 3.0.6-b3 version to my computer. I can get it to run with the -h showing the help commands.

Bill Lortz has a guide for his GEM at

https://smartenergygroups.com/forums/14 ... -collector

but that is for the SEG website. He had a configuration file there too, which I copied just as a test to see what it would do.

And that is the progress into the brick wall now. I don't know why compiling a string of data repeating every x seconds would be so incredibly complex. I can see that you would have to set the GEM to output the correct version of the data, as there are now different options for different situations.

I'd be happy enough with the "Stand Alone Dashboard" if this can't work, but I'm guessing that I'd be happier in the long-term with the emoncms as there seems to be more enthusiasm for it.

I'm also a bit surprised that there isn't more focus on running this on the home computer as opposed to uploading to a website, as it seems it is a bit of a security breach putting all this data on a website.

Thanks for any/all help!

Re: btmon patch for emoncms 8.4

Posted: Fri May 29, 2015 3:56 pm
by ben
Is your configuration file as follows:

[oem]
oem_out = false
oem_url=http://localhost/input/post
oem_token = XXXXXX

Token is defined in the EmonCMS interface.

Re: btmon patch for emoncms 8.4

Posted: Sat May 30, 2015 7:26 am
by sub3marathonman
ben wrote:Is your configuration file as follows:

[oem]
oem_out = false
oem_url=http://localhost/input/post
oem_token = XXXXXX

Token is defined in the EmonCMS interface.
OK, a fair part of that I can copy. I can probably figure out the "oem_url=" part if it is different on my computer.

But maybe I've become a true Luddite, because I have no idea what an "oem_token" is, or where it is defined in the EmonCMS interface, or even find out any information by searching. Somehow it seems if you're using their online service it will give you the token, but what about when I'm trying to set it up on my computer?And while it therefore seems to be the responsibility of EmonCMS to have adequate instructions, still it would be greatly helpful if Brultech supplemented things with helpful step-by-step instructions so users of their excellent hardware would be able to set up the software choices out there.

Re: btmon patch for emoncms 8.4

Posted: Sat May 30, 2015 9:01 am
by Teken
I think you're finally seeing why so many people have gravitated to buying a dedicated hardware solution like the Dash Box.

For me it was having a opportunity to try out something new. Next it was knowing I would be getting something that was very much plug & play. Next, it was having the ability to get updates to features not available in other platforms.

There is a place for learning, trial and error along with knowing you did something on your own.

Nothing wrong with that path. But for me I have 12 on going alpha / beta projects in various states. I don't need another make work project in my life sucking away limited time I have now.

Coupled with the simple fact I enjoy Brultech doing all the heavy lifting while I sit back and provide feed back about how to make the product better, flexible, and powerful!

Unless you have a keen interest in learning how to program some of these software platforms. You will need lots of time and patience, as you clearly see.

I'll pass for now.

Re: btmon patch for emoncms 8.4

Posted: Mon Jun 01, 2015 9:50 am
by ben
sub3marathonman wrote:
ben wrote:Is your configuration file as follows:

[oem]
oem_out = false
oem_url=http://localhost/input/post
oem_token = XXXXXX

Token is defined in the EmonCMS interface.
OK, a fair part of that I can copy. I can probably figure out the "oem_url=" part if it is different on my computer.

But maybe I've become a true Luddite, because I have no idea what an "oem_token" is, or where it is defined in the EmonCMS interface, or even find out any information by searching. Somehow it seems if you're using their online service it will give you the token, but what about when I'm trying to set it up on my computer?And while it therefore seems to be the responsibility of EmonCMS to have adequate instructions, still it would be greatly helpful if Brultech supplemented things with helpful step-by-step instructions so users of their excellent hardware would be able to set up the software choices out there.
I just registered to their site as it's been awhile since I looked at it, it looks like the token is now called "API Key".

Re: btmon patch for emoncms 8.4

Posted: Mon Jun 01, 2015 12:34 pm
by sub3marathonman
ben wrote: I just registered to their site as it's been awhile since I looked at it, it looks like the token is now called "API Key".
Thank you so much for taking the time to check into this ben, it is greatly appreciated.

Now, if only I could figure out how to "In the feedsettings section uncomment the datadir defenitions" as instructed at

https://github.com/emoncms/emoncms/blob ... Install.md

I guess everybody except me knows how to do that!! :oops:

I'll be trying to make progress again!!

Re: btmon patch for emoncms 8.4

Posted: Mon Jun 01, 2015 3:35 pm
by ben
sub3marathonman wrote:
ben wrote: I just registered to their site as it's been awhile since I looked at it, it looks like the token is now called "API Key".
Thank you so much for taking the time to check into this ben, it is greatly appreciated.

Now, if only I could figure out how to "In the feedsettings section uncomment the datadir defenitions" as instructed at

https://github.com/emoncms/emoncms/blob ... Install.md

I guess everybody except me knows how to do that!! :oops:

I'll be trying to make progress again!!
There'll be a file called default.settings.php. Change that files name to settings.php.

Open it up in Notepad and find these lines:

'phpfiwa'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phpfiwa\\"
),
'phpfina'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phpfina\\"
),
'phptimeseries'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phptimeseries\\"
)

Change Username to whatever your computers user name is, delete the comments if commented (comments in PHP look like /* and */, or just // for a single line).

Re: btmon patch for emoncms 8.4

Posted: Thu Jun 04, 2015 1:57 pm
by sub3marathonman
ben wrote:
There'll be a file called default.settings.php. Change that files name to settings.php.

Open it up in Notepad and find these lines:

'phpfiwa'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phpfiwa\\"
),
'phpfina'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phpfina\\"
),
'phptimeseries'=>array(
'datadir'=>"C:\\Users\\Username\\emoncmsdata\\phptimeseries\\"
)

Change Username to whatever your computers user name is, delete the comments if commented (comments in PHP look like /* and */, or just // for a single line).
That was a great help. The "if commented" because the instructions at the emoncms site for windows setup states to delete the comments, without mentioning what signifies a comment (although I can see I had figured that out correctly) and the site doesn't mention that they apparently already are not commented, so you really just have to set the correct path. But also, which I did notice, you have to change the ' (single quote mark) from the original settings.php file to a " (double quote mark) which is pretty subtle too if you don't know what to look for.

So now, there is apparently some progress!! Yes, I can see a test database. I can even put some data in!! It will draw a graph!! But somehow, even though the graph seems correct, it gives an error message:
( ! ) Notice: Undefined offset: 2 in C:\wamp\www\emoncms\Modules\vis\vis_controller.php on line 74

So I don't know if that is a real problem or just a problem here with the test database.

One further question though is that apparently in the GEM Packet Format Manual v 2.1 it shows packet choice #10 as undefined but further lists it as "emon packet format." So is #10 going to be implemented for that officially at some point, and can it be used now as unofficial?

Now I'll be trying to set up an actual GEM output with the emoncms at localhost instead of on the website, so that will be a major project at least for me.