New Module: SmartMeterP1. Read your DSMR electric/gas meter via P1 interface

Begonnen von fhemmiv, 19 November 2015, 07:29:02

Vorheriges Thema - Nächstes Thema

fhemmiv

About a year ago I received a SmartMeter, Landys+Gyr E350, for my gas and electric system. This system has a so called P1 port (rj11) which sends out the measured values every 10 seconds in DSMR protocol.
After some investigation and reading I created attached module. Currently it is only tested with the latest DSMR 4.x protocol.

It can store the read values into a MySQL database so you can use it at a later time.
It has been up and running for almost a year and I finally had time to finish the code and the explanation.

kroonen

Hi,

I'm trying to get its work, with an iskra me382, smart meter. The output should be the same only the speed is 9600

I get no values, but telegrams start stays at 0?? Also autocreate nothing happens. Any idea how to get it to work


I the this in them log

2015.12.19 12:47:32 3: Setting SmartMeterP1 serial parameters to 9600,8,N,1
2015.12.19 12:47:32 3: Opening SmartMeterP1 device /dev/p1usb
Possible unintended interpolation of @115200 in string at ./FHEM/00_SmartMeterP1.pm line 58, <$fh> line 13.

I have this in my fhem.cfg

define SmartMeterP1 SmartMeterP1 /dev/p1usb@9600
attr SmartMeterP1 write2db 0



Internals
DBH
DEF   
/dev/p1usb@9600
DeviceName
/dev/p1usb@9600
FD
6
NAME
SmartMeterP1
NR
3
PARTIAL
STATE
Initialized
TYPE
SmartMeterP1
TelegramStart
0
Readings
state
Initialized
2015-12-19 12:43:26



kroonen


kroonen

Found the solution, change the baudrate and parity, and it works

So for the ISKRA you need this

define SmartMeterP1 SmartMeterP1 /dev/p1usb@9600,7,E,1

regards Richard

kroonen

The gas is not working, the value is on different place

On Landis & Gyr (dsmr4.x)

0-1:24.2.1(140815220000S)(00017.692*m3)

On other like de ISKRA

0-1:24.3.0(151219220000)(00)(60)(1)(0-1:24.2.1)(m3)
(01825.614)


any idea how to modify to get the right value (01825.614)

regards Richard

Ening idee hoe aan te passen in de module?

gr Richard

fhemmiv

Richard,

Please try attached new version and let me know. Save it and rename to 00_SmartMeterP1.pm and overwrite your current one.

Also try with global verbose set to 4 to get more debug info.

Regards Michel.

kroonen


fhemmiv

Small fix so GasDeliveredTime is converted to right format. Is important for saving into DB.

Ed66

Hi Michel,

got it working, even managed to add the production counters, but got stuck in my attempts to remove the units from the readings.
Can you change the module in such a way that it produces output like this: 

2015-12-23_23:58:50 SmartMeterP1 ElectricityProducedLowTariff: 01055.423 kWh

instead of 

2015-12-23_23:58:50 SmartMeterP1 ElectricityProducedLowTariff: 01055.423*kWh

Thanks in advance,
Ed
 

fhemmiv

Ed,

See attached new version 1.3.
It has a new attribute which can be configured called "removeUnitSeparator". When set to true it will replace the asterisk (*) by a space character.
Hope this works for you.

For me it looks like this in the fhem event log:
2015-12-24 14:45:46 SmartMeterP1 elktragas ElectricityDeliveredNormalTariff: 002479.443 kWh
2015-12-24 14:45:46 SmartMeterP1 elktragas ElectricityPowerDelivered: 00.551 kW
2015-12-24 14:45:56 SmartMeterP1 elktragas TelegramTime: 2015-12-24 14:45:57

Ed66

Hi Michel,

almost perfect, thanks. The gas reading is still showing it, the rest shows up as expected. I can already start to create some plots under the Christmas tree...

I added the power production variables and changed some readings for cosmetic reasons.

Ed

kroonen

here the same the gas reading has still the asterisk.

1.3 solved the issue with GasDeliveredTime format.


fhemmiv

New version 1.4 which removes asterisk for Iskra meters and also added produced energie values.
Let me know if it works alright?

fhemmiv

Version 1.5
Added some extra other values delivered in telegram.
And for all values now only when the value changes it is updated in fhem (event generated) and send to the database.

kroonen

Hi

Looks very good,good job. The asterisk is away.

The help function, you can change the ISKRA is dmsr3.0. De port define don't but there /dev/p1usb but /dev/ttyUSB0 , I made a specific port because I have moet ttyUSB ports, and they change on boot sometimes.

One additional option should ben nice. The

ElectricityPowerDelivered   0000.27 kW

Is this possible to have it formatted as:

ElectricityPowerDelivered 0.27 kW

So some 0 away. For me only required for ElectricityPowerDelivered