Grafana Dashboard now working... very quick

Working on a home project? Post it here.
mminehan
Posts: 33
Joined: Wed Oct 14, 2015 1:08 am

Re: Grafana Dashboard now working... very quick

Post by mminehan » Fri Jun 08, 2018 2:42 pm

So...I reinstalled the python InfluxDB client using PIP (pip install influxdb). Had to intsall the PIP package first, not the python3 version.
Then installed Pandas (pip install pandas).
Rebooted....and woohoo.....it seems to be working!
Thanks for all you help. I will spend the day tinkering.
Marty.
eric512
Posts: 19
Joined: Fri Feb 24, 2012 1:16 am

Re: Grafana Dashboard now working... very quick

Post by eric512 » Mon May 20, 2019 3:12 am

I've just stumbled onto this Influxdb/Grafana thread and thought I would give it a try. I have emoncms working fine for years with btmon.py.

I added a separate dir for a new version of btmon.py v3.3.1 on my Ubuntu box and got it running, sort of. No data is getting to my influxdb box.

Getting an error in btmon - Exception in InfluxDBProcessor: 'ch1_whd'

I installed influx from both PIP and apt-get, same results.

btmon.cfg:

[source]
device_type = ecm1240
serial_read = true
serial_port = /dev/ttyUSB0
serial_baud = 19200
serial_poll_interval = 30
device_list = fc,fd
[influxdb]
influxdb_out = true
influxdb_host = 192.168.1.121
influxdb_port = 8086
influxdb_upload_period = 60
influxdb_database = ecm1240
influxdb_measurement = energy
influxdb_mode = row
influxdb_db_schema = ecmreadext


Influxdb has the database of "ecm1240", but Show Measurements is blank, Success! (no results to display)

Any ideas?

Added --debug info

2019/05/20 22:02:00 Exception in InfluxDBProcessor: 'ch1_whd'
Traceback (most recent call last):
File "btmon.py", line 2246, in process
p.process_compiled(self.packet_collector.packet_buffer)
File "btmon.py", line 2835, in process_compiled
self.process_calculated(packets)
File "btmon.py", line 4296, in process_calculated
values['fields'][value_name] = p[c] * 1.0
KeyError: 'ch1_whd'
ben
Site Admin
Posts: 4262
Joined: Fri Jun 04, 2010 9:39 am

Re: Grafana Dashboard now working... very quick

Post by ben » Tue May 21, 2019 9:45 am

eric512 wrote:I've just stumbled onto this Influxdb/Grafana thread and thought I would give it a try. I have emoncms working fine for years with btmon.py.

I added a separate dir for a new version of btmon.py v3.3.1 on my Ubuntu box and got it running, sort of. No data is getting to my influxdb box.

Getting an error in btmon - Exception in InfluxDBProcessor: 'ch1_whd'
...

Added --debug info

2019/05/20 22:02:00 Exception in InfluxDBProcessor: 'ch1_whd'
Traceback (most recent call last):
File "btmon.py", line 2246, in process
p.process_compiled(self.packet_collector.packet_buffer)
File "btmon.py", line 2835, in process_compiled
self.process_calculated(packets)
File "btmon.py", line 4296, in process_calculated
values['fields'][value_name] = p[c] * 1.0
KeyError: 'ch1_whd'
Any chance the database was created using a different schema then ecmreadext? Can you try deleting the database and having btmon.py recreate it?
Ben
Brultech Research Inc.
E: ben(at)brultech.com
eric512
Posts: 19
Joined: Fri Feb 24, 2012 1:16 am

Re: Grafana Dashboard now working... very quick

Post by eric512 » Tue May 21, 2019 12:55 pm

Thanks Ben, I deleted the ecm1240 database just in case, but same error. btmon.py doesn't even get that far to create it in Influx.

btmon ran a little while longer - here is the --debug output.

2019/05/21 07:49:38 btmon: 3.3.1
2019/05/21 07:49:38 python: 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]
2019/05/21 07:49:38 platform: linux2
2019/05/21 07:49:38 device type: ecm1240
2019/05/21 07:49:38 device list: ['fc', 'fd']
2019/05/21 07:49:38 packet format: ecm1240bin
2019/05/21 07:49:38 schema: counters
2019/05/21 07:49:38 buffer size: 120
2019/05/21 07:49:38 SERIAL: serial port: /dev/ttyUSB0
2019/05/21 07:49:38 SERIAL: baud rate: 19200
2019/05/21 07:49:38 SERIAL: poll interval: 30
2019/05/21 07:49:38 InfluxDB: upload period: 60
2019/05/21 07:49:38 InfluxDB: host: 192.168.1.121
2019/05/21 07:49:38 InfluxDB: port: 8086
2019/05/21 07:49:38 InfluxDB: username:
2019/05/21 07:49:38 InfluxDB: map:
2019/05/21 07:49:38 InfluxDB: schema: ecmreadext
2019/05/21 07:49:38 packet format is ECM1240BinaryPacket
2019/05/21 07:49:38 using collector PollingSerialCollector
2019/05/21 07:49:38 using 1 processors:
2019/05/21 07:49:38 InfluxDBProcessor
2019/05/21 07:49:38 setup PollingSerialCollector
2019/05/21 07:49:38 setup InfluxDBProcessor
2019/05/21 07:49:38 SERIAL: waiting for 30 seconds
2019/05/21 07:50:08 SERIAL: opening connection to /dev/ttyUSB0 at 19200
2019/05/21 07:50:08 sending request 1 to device fc
2019/05/21 07:50:08 SERIAL: sending ▒
2019/05/21 07:50:08 SERIAL: waiting for 1 bytes
2019/05/21 07:50:08 SERIAL: sending SPK
2019/05/21 07:50:08 SERIAL: waiting for 1 bytes
2019/05/21 07:50:08 waiting for data from device fc
2019/05/21 07:50:08 reading 1 of 1 packets
2019/05/21 07:50:08 adding buffer for 404387
2019/05/21 07:50:08 buffering packet ts:1558461008 sn:404387
2019/05/21 07:50:08 sending request 1 to device fd
2019/05/21 07:50:08 SERIAL: sending ▒
2019/05/21 07:50:08 SERIAL: waiting for 1 bytes
2019/05/21 07:50:08 SERIAL: sending SPK
2019/05/21 07:50:08 SERIAL: waiting for 1 bytes
2019/05/21 07:50:08 waiting for data from device fd
2019/05/21 07:50:08 reading 1 of 1 packets
2019/05/21 07:50:09 adding buffer for 404388
2019/05/21 07:50:09 buffering packet ts:1558461009 sn:404388
2019/05/21 07:50:09 SERIAL: closing connection
2019/05/21 07:50:09 buffer info:
2019/05/21 07:50:09 404387: 1 of 120 (1558461008)
2019/05/21 07:50:09 404388: 1 of 120 (1558461009)
2019/05/21 07:50:09 processing with InfluxDBProcessor
2019/05/21 07:50:09 not enough data for 404387
2019/05/21 07:50:09 not enough data for 404388
2019/05/21 07:50:09 SERIAL: waiting for 30 seconds
2019/05/21 07:50:39 SERIAL: opening connection to /dev/ttyUSB0 at 19200
2019/05/21 07:50:39 sending request 1 to device fc
2019/05/21 07:50:39 SERIAL: sending ▒
2019/05/21 07:50:39 SERIAL: waiting for 1 bytes
2019/05/21 07:50:39 SERIAL: sending SPK
2019/05/21 07:50:39 SERIAL: waiting for 1 bytes
2019/05/21 07:50:39 waiting for data from device fc
2019/05/21 07:50:39 reading 1 of 1 packets
2019/05/21 07:50:39 buffering packet ts:1558461039 sn:404387
2019/05/21 07:50:39 sending request 1 to device fd
2019/05/21 07:50:39 SERIAL: sending ▒
2019/05/21 07:50:39 SERIAL: waiting for 1 bytes
2019/05/21 07:50:39 SERIAL: sending SPK
2019/05/21 07:50:39 SERIAL: waiting for 1 bytes
2019/05/21 07:50:39 waiting for data from device fd
2019/05/21 07:50:39 reading 1 of 1 packets
2019/05/21 07:50:40 buffering packet ts:1558461040 sn:404388
2019/05/21 07:50:40 SERIAL: closing connection
2019/05/21 07:50:40 buffer info:
2019/05/21 07:50:40 404387: 2 of 120 (1558461039)
2019/05/21 07:50:40 404388: 2 of 120 (1558461040)
2019/05/21 07:50:40 processing with InfluxDBProcessor
2019/05/21 07:50:40 2 buffered packets sn:404387
2019/05/21 07:50:40 1 calculated packets sn:404387
2019/05/21 07:50:40 Exception in InfluxDBProcessor: 'ch1_whd'
Traceback (most recent call last):
File "btmon.py", line 2246, in process
p.process_compiled(self.packet_collector.packet_buffer)
File "btmon.py", line 2835, in process_compiled
self.process_calculated(packets)
File "btmon.py", line 4296, in process_calculated
values['fields'][value_name] = p[c] * 1.0
KeyError: 'ch1_whd'
2019/05/21 07:50:40 SERIAL: waiting for 30 seconds
ben
Site Admin
Posts: 4262
Joined: Fri Jun 04, 2010 9:39 am

Re: Grafana Dashboard now working... very quick

Post by ben » Wed May 22, 2019 10:54 am

Are you using/have you tried my fork?

https://github.com/BenK22/mtools/blob/i ... n/btmon.py

The original influxdb implementation didn't support ecmreadext.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
eric512
Posts: 19
Joined: Fri Feb 24, 2012 1:16 am

Re: Grafana Dashboard now working... very quick

Post by eric512 » Wed May 22, 2019 2:08 pm

Yes - using your fork, also tried changing to just "ecmread" schema - same problem.

I'm running btmon on this box in another dir and it works fine going to emoncms. Not sure why there is some type of incompatibility.

2019/05/22 09:08:22 1 calculated packets sn:404387
2019/05/22 09:08:22 Exception in InfluxDBProcessor: 'ch1_amps'
Traceback (most recent call last):
File "btmonben.py", line 2246, in process
p.process_compiled(self.packet_collector.packet_buffer)
File "btmonben.py", line 2835, in process_compiled
self.process_calculated(packets)
File "btmonben.py", line 4296, in process_calculated
values['fields'][value_name] = p[c] * 1.0
KeyError: 'ch1_amps'
2019/05/22 09:08:22 SERIAL: waiting for 30 seconds
^C2019/05/22 09:08:26 cleanup InfluxDBProcessor
2019/05/22 09:08:26 cleanup PollingSerialCollector
ben
Site Admin
Posts: 4262
Joined: Fri Jun 04, 2010 9:39 am

Re: Grafana Dashboard now working... very quick

Post by ben » Thu May 23, 2019 11:08 am

On line 1818, change whd to dwh:

Code: Select all

c = ['volts', 'ch1_a', 'ch2_a', 'ch1_w', 'ch2_w', 'aux1_w', 'aux2_w', 'aux3_w', 'aux4_w', 'aux5_w', 'ch1_wh', 'ch2_wh', 'aux1_wh', 'aux2_wh', 'aux3_wh', 'aux4_wh', 'aux5_wh', 'ch1_dwh', 'ch2_dwh', 'aux1_dwh', 'aux2_dwh', 'aux3_dwh', 'aux4_dwh', 'aux5_dwh', 'ch1_pw', 'ch1_nw', 'ch2_pw', 'ch2_nw', 'ch1_pwh', 'ch1_nwh', 'ch2_pwh', 'ch2_nwh']
I'm not sure if this affects any of the other processors.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
eric512
Posts: 19
Joined: Fri Feb 24, 2012 1:16 am

Re: Grafana Dashboard now working... very quick

Post by eric512 » Thu May 23, 2019 2:19 pm

Yeah - data!! That did it.

I do see a class called db2pkt in the ecmreadext schema which replaces whd with dwh, but not sure if it gets processed - haven't traced it.......

On to building a dashboard.

Many thanks Ben!
eric512
Posts: 19
Joined: Fri Feb 24, 2012 1:16 am

Re: Grafana Dashboard now working... very quick

Post by eric512 » Thu Jun 06, 2019 4:03 pm

Ok btmon.py with InfluxDB and Grafana are working great.

I've just migrated to "col" mode instead of "row" in btmon.cfg to help with Grafana setup, I'm using a "variable" to allow channel selection on a graph.

I'm having trouble with the mapping of channels. I have two ECM-1240's muxed together, so btmon reads both of them with a device list setting.

How can I map a XXX388 and ch1_w with btmon/influx ??

I've tried influxdb_map = XXX388_ch1_a,Mains - but that didn't seem to work.
ben
Site Admin
Posts: 4262
Joined: Fri Jun 04, 2010 9:39 am

Re: Grafana Dashboard now working... very quick

Post by ben » Fri Jun 07, 2019 9:32 am

eric512 wrote:Ok btmon.py with InfluxDB and Grafana are working great.

I've just migrated to "col" mode instead of "row" in btmon.cfg to help with Grafana setup, I'm using a "variable" to allow channel selection on a graph.

I'm having trouble with the mapping of channels. I have two ECM-1240's muxed together, so btmon reads both of them with a device list setting.

How can I map a XXX388 and ch1_w with btmon/influx ??

I've tried influxdb_map = XXX388_ch1_a,Mains - but that didn't seem to work.
I didn't get around to messing around with mappings but can you try the whole serial number (instead of the XXX) and see if that does it?
Ben
Brultech Research Inc.
E: ben(at)brultech.com
Post Reply