Multiple Dashboxes with GEM and ECM-1240, btmon success!

Post Reply
baxter
Posts: 9
Joined: Sat Apr 08, 2017 2:26 pm

Multiple Dashboxes with GEM and ECM-1240, btmon success!

Post by baxter » Tue Jul 06, 2021 11:32 am

I've been working on this for a while with Ben, and we finally found a solution, so I promised I'd document it so he doesn't have to go through this with the next guy. :D

Three Dashboxes in three different buildings. One has a single GEM, one has two GEMs, and one has two ECM-1240. I wanted to hook everything up so I could use btmon to bring everything to a single instance of Emoncms on a Raspberry Pi.

The confusion came with the port numbers. The Dashbox ports are defaulted to 8001 and 8002 for RS-232#1 and RS-232#2. The instructions for btmon also use 8001 and 8002 as default ports. I was totally confused and couldn't see how these were related. Ben would send me instructions that just didn't make any sense. Until I realized...

Dashbox 8001/8002 ports have nothing to do with btmon 8001/8002 ports.

Once I figured that out, I changed the btmon ports to 8003/8004. You can use 8001/8002 on btmon, since they are in a different address space, but changing them to anything else leads to less confusion. My layout is shown in the attachment.

The trick is the packet forwarding. Port 8003 is used to forward to the btmon instance decoding GEM, and 8004 is used to forward to the btmon instance decoding ECM-1240 packets. On the Pi, I have two configuration files, and so run two instances of btmon. I add these two lines to /etc/rc.local so they run at startup:

Code: Select all

python /home/pi/btmon.py -c /home/pi/btmon-gem.cfg --verbose>>/home/pi/btmon-gem.log&
python /home/pi/btmon.py -c /home/pi/btmon-ecm1240.cfg --verbose>>/home/pi/btmon-ecm1240.log&
If I want to take a look at the log files to make sure everything is working, I just use tail:

Code: Select all

tail -f btmon-gem.log
The -f flag follows the tail. That is, when the log file is appended, you see the output right away. ^C to exit. The logs are appended, so they should be purged every once in a while. Better yet, probably replace the >> with > so the log is overwritten each time.

Here are the two btmon configuration files:

btmon-gem.cfg

Code: Select all

[source]
device_type = gem
ip_read = true
ip_port = 8003
ip_mode = server
[oem]
oem_out = true
oem_token = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxabb3
oem_url = http://localhost/emoncms/input/post.json
oem_node = GEM
btmon-ecm1240.cfg

Code: Select all

[source]
device_type = ecm1240
ip_read = true
ip_port = 8004
ip_mode = server
[oem]
oem_out = true
oem_token = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxabb3
oem_url = http://localhost/emoncms/input/post.json
oem_node = ECM-1240
Attachments
2021-07-06 12_13_09-Trash Fairy.pptx - PowerPoint.png
2021-07-06 12_13_09-Trash Fairy.pptx - PowerPoint.png (145.25 KiB) Viewed 22973 times
Post Reply