Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Hello, and obviously my first post here.  I thought it was straightforward, Emoncms but on my home computer, getting data from a Brultech GEM.

The instructions here https://github.com/emoncms/emoncms/blob/master/docs/WindowsInstall.md are fairly straightforward.  I managed to get the WAMP installed, I think I got it to accept mod rewrite and the gettext was already enabled.  I created the database, and downloaded version 8.5 of the Emoncms.  I did manage to set the emoncms settings.php, but it didn't explain how to see what a comment was in the file (yes, basic knowledge and I eventually guessed correctly) and in reality it wasn't necessary to delete any comments in the version I downloaded.  It was subtle having to change a ' (single quote) to " (double quote) for the locations of the folders on the computer, but I caught that.

And yes, that works!!  I have the "Test" database, I can send the data to it.  I don't know what the csv=100,200,300 means, but it will graph at least the first data point if I vary it to 50 or 120 and then back to 100.  It gives an error warning that I'm not sure about, but hopefully at some point it will be fixed once I learn something more about this.  At that point the instructions stop, and the next steps are unknown.

So, the next step is getting the Brultech GEM to send data to the database for the Emoncms.  And that's where it all gets confusing.  I think the API key is just "API Key" but I'm not sure.  I've gotten the btmon.py script to somehow do something, but it ends up with "expected START_HEADER0 0fxe, got nothing" so I'm not able to figure out the next step and hopefully one of the knowledgeable people here will take pity and help.

Thanks.

 

Bill Thomson's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Hi Kevin,

Have you had a look at: http://lancet.mit.edu/mwall/projects/power/btmon-howto.html? (btmon.py config guide)

There is some configuration help regarding OEM, inside btmon.py, but it's outdated. e.g. one line with emoncms config info reads OEM_URL = 'https://localhost/emoncms/api/post'

Emoncms now expects to see something like this:
http://localhost/emoncms/input/post.json?node=1&csv=100,200,300

I don't know what the csv=100,200,300 means

CSV means Comma Separated Values. It's one of the data formats emoncms can accept.

You can find your API keys, and examples of how to post your data to emoncms, on the emoncms "Input API Help" screen. There's a link to it in the top right corner of your emoncms "Inputs" page.

I think the API key is just "API Key" but I'm not sure.

The API key is a 32 character string that looks similar to this: 9d37f182446ad5bb767a90e2bee7281f
emoncms generates two of them. A read-only key, and a read-write key.
(The key above isn't real, it's just a string of random characters)

Regards,

Bill

Robert Wall's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

And you must use the read-write key when sending data to emoncms - it's the equivalent of a password to let the data in.

sub3marathonman's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Thank you both Bill and Robert!  I think this will help me make some progress.

The outdated instructions are definitely a problem.  And while I did see those strings of numbers and letters, I really didn't pay any attention to them at all since I didn't know what to look for. So the help is appreciated.

But, now after trying to substitute the correct key value, I'm still getting "expected START_HEADER0 0fxe, got nothing" so there must be other steps I need to get it working.

 

Bill Thomson's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Have you configured your GEM?

There are three tools for configuring a GEM:

  • web browser directly to GEM (only for GEM with ethernet option)
  • Green-Eye Monitor Setup - this is a Java application from Brultech
  • btcfg.py - Python script

Does your GEM have the built-in ethernet interface?

When communicating via TCP/IP (ethernet), the GEM can be in either client or server mode. When the GEM is in server mode, it responds to requests - the computer running btmon must initiate the request for communication. When the GEM is in client mode, the GEM initiates the communication.

 

Polling vs Blocking (btmon)

btmon can accept real-time packets from the GEM (the GEM must be in real-time (client) mode) or it can poll for data (the GEM must *not* be in real-time mode, i.e it must be in server mode).

In most cases btmon should be in blocking (client) mode, accepting real-time packets from the GEM.

 

Installing on Windows

Install Python 2.6 or 2.7. btmon will not work with Python 3.
http://python.org/download/windows
Create a directory in which to keep btmon and any configuration file(s):
md c:\btmon copy <your download path name here>\btmon.py c:\btmon

That's it! Depending on the configuration, you might have to install other Python modules. If btmon complains about a missing module, install that module using easy_install.

 

Here's a link to a post on the on the Brultech forum about the same error message you're getting:
https://www.brultech.com/community/viewtopic.php?f=11&t=1112

and a link to some posts on the Brultech forum on configuring btmon for use with emoncms 8.4
Only the first two posts are relevant. The rest are dated 2011 and older.

https://www.brultech.com/community/viewtopic.php?f=11&t=1288

sub3marathonman's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Thanks again Bill.

Yes, there is apparently progress!!

For the GEM, real time status is OFF. I think the GEM is set to Client, but I'm not sure if somehow the config.cfg for the btmon.py changes that.

Somehow by looking on the Brultech forum at https://www.brultech.com/community/viewtopic.php?f=11&t=535 mwall gave an example of a btmon.py startup command (12/3/2012 @ 8:33 a.m.) and I modified it into a config.cfg file for the btmon.py.

Here is the config.cfg file:

[source]
device_type = gem
ip_read = true
ip_mode = client
ip_host=192.168.X.Y (the address of the GEM)

ip_port = xxxx (the port of the GEM)
ip_poll_interval = 10
packet_format = gem48ptbin

[openenergymonitor]
oem_url = http://localhost/emoncms/input/post.json
oem_out = true
oem_token = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
oem_node = 1

And I can now see this data in the Inputs for the emoncms "Test" file I have. It looks like everything is on Node 1, each channel/data from the GEM gets a "key" and then ... that's it.

Now somehow with this data in the "Test" file, I'll hopefully start being able to learn how to graph a channel and do a "dashboard" at some point.

Bill Thomson's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

For the GEM, real time status is OFF. I think the GEM is set to Client

Real-time mode on is client mode, so if you have it set to OFF, your GEM is in server mode...

But, that being said, it's good to hear you're making progress!

Sounds like your inputs are working correctly. Clicking on the wrench icon on the Inputs screen will enable you to set up your feeds, and configure emoncms to do things like make kWh and kWh per day calculations that you can then use to drive the various graphs and widgets on your dashboard.

 

sub3marathonman's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

Thanks, I didn't know that the real time choice influenced the client/server choice, but I do remember that there seemed to be an emphasis on having real time status set to OFF.

I think I've got enough now to at least gather some data, maybe an entire day, and then start to learn about displaying the data.

 

Bill Thomson's picture

Re: Emoncms version 8.5 on localhost with Windows 8 Newbie Help Needed

The btmon.py config page says: In most cases btmon should be in blocking (client) mode, accepting real-time packets from the GEM, which makes sense as you normally would want your GEM to be sending data to emoncms. (which, in that respect, mimics emonTX operation)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.