Setup with EMREAD/BTMON Problem

Post any 3rd party software here.
crsherman
Posts: 4
Joined: Sun Jun 26, 2011 5:51 pm

Setup with EMREAD/BTMON Problem

Post by crsherman » Sun Oct 14, 2012 9:15 am

Matt,
Looking for some help in getting btmon up and running so that I can use RRDtool.

Here is my setup:

Win 7 machine.
1 single Brultech monitor with Zigbee module.
mysql installed. No database setup.
Data forwarding to the following: 127.0.0.1 port 5000 - status says connected.
Brultech dashboard connects and everything looks fine.

When I run the the following:

btmon.py --ip --ip-mode client --ip-host 127.0.0.1 --print

I receive the following error:

File "C:\Program Files\ecmread\bin\btmon.py", line 798
except Exception, e:

Syntax Error: invalid syntax

Tried different parameters and have tried with a config file to no avail.

any suggestions or help would be appreciated.
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Sun Oct 14, 2012 10:31 am

which version of python is installed?
are you using an ecm-1240 or gem?
if it is a gem, which firmware is it running?

if your brultech device is pushing data, then you should run btmon in server mode, not client mode:

Code: Select all

btmon.py --ip --ip-mode server --print
btmon defaults to localhost in server mode, but you can tell it to bind to a specific address with the --ip-host option.

this should print out data from the brultech device as it is pushed.

you can also use the --debug option to get more details about what is happening.

once you confirm that is working, the next step is to add services one by one, verifying that each works before adding another.

for rrd, you will need to add these command line arguments:

Code: Select all

--rrd --rrd-dir c:/rrd
once you have everything working via command line, put the parameters into a configuration file then invoke btmon like this:

Code: Select all

btmon.py -c /path/to/config.txt
i am not sure why you get 'invalid syntax' error. when i run btmon.py as you invoked it on windows 7 with python 2.7, i see the following:

Code: Select all

C:\Users\mwall\btmon-3.0.0\bin>btmon.py --ip --ip-mode client --ip-host 127.0.0.1 --print
2012/10/14 11:17:44 packet format is ecm1240bin
2012/10/14 11:17:44 schema is counters
2012/10/14 11:17:44 SOCKET: server host: 127.0.0.1
2012/10/14 11:17:44 SOCKET: server port: 5000
2012/10/14 11:17:44 SOCKET: poll interval: 0
2012/10/14 11:17:44 SOCKET: timeout: 60
2012/10/14 11:17:45 [Errno 10061] No connection could be made because the target machine actively refused it
2012/10/14 11:17:47 [Errno 10061] No connection could be made because the target machine actively refused it
2012/10/14 11:17:48 [Errno 10061] No connection could be made because the target machine actively refused it
Here is sample output when I run btmon on windows 7 with a GEM at 192.168.32.152 set to emit GEM binary packets with timestamp. I specify a polling interval because the GEM is not in real-time mode - btmon polls it for data.

Code: Select all

C:\Users\mwall\btmon-3.0.0\bin>btmon.py --ip --ip-mode client --ip-host 192.168.32.152 --ip-poll-interval 10 --packet-format gem48ptbin --print

2012/10/14 11:22:26 packet format is gem48ptbin
2012/10/14 11:22:26 schema is counters
2012/10/14 11:22:26 SOCKET: server host: 192.168.32.152
2012/10/14 11:22:26 SOCKET: server port: 5000
2012/10/14 11:22:26 SOCKET: poll interval: 10
2012/10/14 11:22:26 SOCKET: timeout: 60

2012/10/14 11:20:26: Serial: 01000048
2012/10/14 11:20:26: Voltage:  121.50V
2012/10/14 11:20:26: Ch01:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch02:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch03:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch04:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch05:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch06:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch07:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch08:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch09:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch10:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch11:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch12:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch13:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch14:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch15:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch16:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch17:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch18:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch19:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch20:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch21:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch22:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch23:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch24:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch25:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch26:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch27:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch28:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch29:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch30:      0.000000KWh (    0W)
2012/10/14 11:20:26: Ch31:     37.598680KWh (    0W)
2012/10/14 11:20:26: Ch32:     54.026720KWh (  126W)
2012/10/14 11:20:26: p1:               0
2012/10/14 11:20:26: p2:               0
2012/10/14 11:20:26: p3:               0
2012/10/14 11:20:26: p4:               0
2012/10/14 11:20:26: t1:        0.000000
2012/10/14 11:20:26: t2:        0.000000
2012/10/14 11:20:26: t3:        0.000000
2012/10/14 11:20:26: t4:        0.000000
2012/10/14 11:20:26: t5:        0.000000
2012/10/14 11:20:26: t6:        0.000000
2012/10/14 11:20:26: t7:        0.000000
2012/10/14 11:20:26: t8:        0.000000
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Sun Oct 14, 2012 11:10 am

There might be some problems using RRD on windows.

There are a few different bindings to make rrdtool functionality available in python. The most basic is py-rrdtool - this is the lower-level bindings written by Hye-Shik Chang. There is another set of bindings called pyrrd written by Duncan McGreggor, and a third set of bindings released only a month ago for use with python 3.

btmon 3.0.0-b5 uses the py-rrdtool bindings. On debian and ubuntu one can simply 'apt-get install py-rrdtool'. Not so easy on windows.

The py-rrdtool bindings are not available for ActiveState python, and I have not been able to install py-rrdtool manually (yet) as rrdtool has many dependencies.

I have been able to install pyrrd on windows 7 with ActiveState Python, but I have not yet tested it - I doubt that it will work since it seems to depend on py-rrdtool, and I would prefer to keep the btmon dependencies to a minimum.

Please continue testing btmon and let me know what happens. I have a couple of windows VMs in which to test, but there are many different configurations out there, so your feedback is tremendously helpful. I'll see what I can do about rrdtool on windows...

m
crsherman
Posts: 4
Joined: Sun Jun 26, 2011 5:51 pm

Re: Setup with EMREAD/BTMON Problem

Post by crsherman » Sun Oct 14, 2012 11:15 am

Python version 3.3.

No GEM - I am running an ECM 1240.

I just tried to run btmon.py in server mode but received the same message.

I have configured the brultech ecm engine g to forward data to 127.0.0.1 and port 5000 while the actual ehterbee is configured with the server ip set to my computers ip address on the network 192.xxx.x.xxx and port 8083 (and is in client mode).
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Sun Oct 14, 2012 11:57 am

the difference is python 3.3 versus python 2.7 or 2.6
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Sun Oct 14, 2012 12:11 pm

could you install python 2.7?

you can easily have both python 2.7 and 3.3 installed - you can control which is used by setting the PATH

so far ecmread and btmon are both written for python 2.x

converting to python 3.x should not be difficult, but there would be a lot of testing to do and i have not yet had time to do that.
crsherman
Posts: 4
Joined: Sun Jun 26, 2011 5:51 pm

Re: Setup with EMREAD/BTMON Problem

Post by crsherman » Sun Oct 14, 2012 8:37 pm

Installed python 2.7.3 and modified path to C:\python27.

Re-ran the following code:

btmon.py --ip --ip-mode client --ip-host 127.0.0.1 --print

and see the same as you. Success!

So now I need to setup rrdtool and a config file - correct?

I need to do a little bit more research to fully understand installing rrdtool on my win 7 machine. I have looked at the website but still am fumbling. Got any good pointers or websites for me to read?

The following is my first pass at a cfg file:
IP_READ = TRUE
IP_MODE = SERVER
IP_HOST = 127.0.0.1
IP_PORT = 5000
IP_TIMEOUT = 1
IP_BUFFER_SIZE = 2048

RRD_OUT = TRUE
RRD_DIR = RRD

thank again for your help!
paetzold
Posts: 43
Joined: Thu Mar 08, 2012 9:57 am

Re: Setup with EMREAD/BTMON Problem

Post by paetzold » Mon Dec 03, 2012 1:05 am

My setup is as follows:

Win 7
1 Brultech GEM with etherX module. (no wifi and serial is not currently connected)
Firmware: Com v1.59, Eng: v1.35
Currently configured for SEG and it has been working fine but I want the data on my server as well
No database – yet (first things first)


Installed Python 2.7 based on this thread (complete newbie for this programming language)
Downloaded both btmon v3.0.1 and btcfg v0.2.0

I must be pretty dense since I have spent hours trying to figure out how to get the output to look like anything other than errors. One attachment is the screenshot from my etherX for the configuration for SEG.

I don’t have a preference of the btmon running in Server or Client.

Another attachment is from the python shell taking the exact command as stated above by mwall when the GEM is set either client or server operation mode (is “pushing data” the term used when set to Server?) for the first error. I added the “=” sign for mode as is described at http://lancet.mit.edu/mwall/projects/po ... o.html#win although it is directly discussing ecmread.py

I have tried what seems like any possible configuration such as btmon.py --ip --ip-mode client --ip-host 127.0.0.1 –-print also listed in this post. I have not tried setting up a config file yet.

I hate to waste anyone’s precious time in clarifying what is likely extremely basic but I would really appreciate if someone could spell out what needs configuration needs to be set with any of these pieces of software or if I need something else changed.
Attachments
GEM Setup.png
GEM Setup.png (88.06 KiB) Viewed 9562 times
Python Shell.png
Python Shell.png (63.5 KiB) Viewed 9562 times
EtherX Configuration.png
EtherX Configuration.png (46.48 KiB) Viewed 9562 times
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Mon Dec 03, 2012 8:33 am

the 'Syntax Error: invalid syntax' error is because you are trying to invoke the btmon script within python itself. just type 'btmon.py ...' at a windows command prompt. be sure that python is in your PATH - when you type 'python -V' at a windows command prompt you should see the python version number.

this configuration will upload to seg and print out locally:

1) put the gem in server mode, listening on port 5000

2) set the packet type to green-eye binary with date

3) put the gem in real-time mode, emitting a packet every 10 seconds

4) do a quick test by running btmon like this:

Code: Select all

btmon.py --device-type gem --ip --ip-mode client --ip-host 192.168.1.160 --ip-port 5000 --print
5) put this into the file config.cfg:

Code: Select all

[source]
device_type = gem
ip_read = true
ip_host = 192.168.1.160
ip_port = 5000
ip_mode = client
[seg]
smartenergygroups_out = true
seg_upload_period = 60
seg_token = XXXXXXX
6) start btmon like this:

Code: Select all

btmon.py -c config.cfg --print --debug
you will probably have to go to the seg site and put it into discovery mode for a few minutes, since btmon uses a node name different than that in the gem firmware.

if you want btmon to use the same node name (and thus maintain continuity with any existing data you might have) then you will have to modify the btmon.py code slightly. btmon uses the (obfuscated) serial number of the gem as the node name. i think the gem defaults to simply 'greeneye' as the node name.

at this point you can add other services or a local database by adding new sections to the config.cfg file.

once everything works, remove the --debug. add the --quiet option when you make btmon a service or a daemon.
Last edited by mwall on Mon Dec 03, 2012 10:56 am, edited 4 times in total.
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: Setup with EMREAD/BTMON Problem

Post by mwall » Mon Dec 03, 2012 8:48 am

crsherman wrote:I need to do a little bit more research to fully understand installing rrdtool on my win 7 machine. I have looked at the website but still am fumbling. Got any good pointers or websites for me to read?
rrdtool binaries for windows are not as easy to find as those for linux. but here are two sources:

http://www.thebits.info/general/rrdtool ... es-226.htm

http://oss.oetiker.ch/rrdtool/pub/?M=D
Post Reply