Script for Dutch Smart meter "Kaifa ma105" integration with emoncms

Hi all,

Since I am a user of Emoncms for a long time. I would like to contribute my own developed script to you.

This summer I recieved a smartmeter (kaifa ma105) of eneco and I would like to integrate this with my already excisting local emoncms setup (monitoring 12 power lines, water- and gasusage ). All i needed to do was get a cheap chinese rs232 to usb converter and connect it between the pi and my kaifa meter.

The script has been developed in python. And a shell script as a watchdog, in case something (the script) fails.

Please have look at the script if you are using a dutch smartmeter. The scripts are running stable for one month now.

Sources can be downloaded at:

Have fun!

Best regards,

Edwin Bontenbal

Great. Does this also work for emoncms.org (rather than own emoncms instance)?

Yes, it should work. I do not have any experience with emoncms.org since I am running my own emoncms instance. The only thing you have to do (i quess) is change the url and credentials.

Script is running already for a long time without any issues. :wink:

Edwin

Thanks. Not sure how to include the credentials for emoncms.org in the script. Any thoughts on this?

Possible to also share example script for reading from S0 port KWh meter (for solar panels)?

Yes. Maybe naming credentials was not correct. You should put your api key (provided by emoncms.org) in the script.

I don’t have any experience with S0 ports and KWh for solar panels. This discussion is offtopic. Maybe you can search this forum to find some more info on this topic. Although i am working on enphase integration (solar panel inverters) with emoncms.

Edwin

OK clear.

Still getting an error message when running the script though. Related to reading the data from the smart meter; "sys.exit (“error opening port…” I updated ser.port in the script (according to the instructions).

Any thoughts?

Can you show me your:
ls -l /dev/serial/by-id/

Should be something like:
lrwxrwxrwx 1 root root 13 Jan 1 1970 usb-FTDI_USB__-__Serial-if00-port0 → …/…/ttyUSB1

Add “usb-FTDI_USB__-Serial-if00-port0" to the script so it looks like:
ser.port = "/dev/serial/by-id/usb-FTDI_USB
-__Serial-if00-port0”

Thanks. I already identified the root cause. Python was not able to read from the serial port. There is a need to have pyserial installed (easy_install -U pyserial). Maybe something to add to the readme?

Do you also have scripts available to read from other sources (e.g. kWh meter or Solar Panel invertor)?

One more question :slight_smile:: Gas consumption does not seem to work. Maybe because I have a different smart meter? Any views on how to get this right?

:innocent:

Can you post a part of the DSMR2Emoncms logging? Log files are written in : /var/log.

Thanks again. Gas usage seems to be included as follows: 0-1:24.2.1(170430211009S)(00669.800*m3).

Any thoughts?

It should look like:

1-3:0.2.8(42)
0-0:1.0.0(170430215529S)
0-0:96.1.1(4530303235313030303632393435363136)
1-0:1.8.1(001462.897kWh)
1-0:1.8.2(001107.432
kWh)
1-0:2.8.1(000072.419kWh)
1-0:2.8.2(000119.292
kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.954kW)
1-0:2.7.0(00.000
kW)
0-0:96.7.21(00000)
0-0:96.7.9(00000)
1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647s)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(004
A)
1-0:21.7.0(00.954kW)
1-0:22.7.0(00.000
kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303139333430333133363939363136)
0-1:24.2.1(170430210000S)(00350.338*m3)
!BE42

2017-04-30 19:55:26,453 ok checksum. Calculated checksum: BE42 checksum telegram: BE42
2017-04-30 19:55:26,456 Item found : 1-0:1.8.1
2017-04-30 19:55:26,458 Item found : 1-0:1.8.2
2017-04-30 19:55:26,460 Item found : 1-0:2.8.1
2017-04-30 19:55:26,463 Item found : 1-0:2.8.2
2017-04-30 19:55:26,465 Item found : 0-1:24.2.1(\d+\w)
2017-04-30 19:55:26,467 Item found : 0-0:96.14.0
2017-04-30 19:55:26,473 Item found : 1-0:1.7.0
2017-04-30 19:55:26,475 Item found : 1-0:2.7.0

I just put a new version on github. Can you try this? Make sure you store you private data like api keys etc. It will be overwritten. In the nearby future i’ll create a separate file for the configuration.This makes upgrading the script a lot easier!

I created another script for read out of a watermeter icw a raspberry pi! I’ll publish this somewhere this week.

Works! Thanks. Looking forward to the script on water usage.

Good to hear in works! I’ll put this watermeter usage in a separate forum
threat.

Somewhere this week i’ll put a new improved script on github with a
separate config file. It will be easier to update the script.

I am learning programming the hard way!

Best regards,

Edwin

2017-05-03 10:16 GMT+02:00 Emil Kwaaitaal <
[email protected]>:

Check github for added separate config files!

Check github for added 3 phase monitoring