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.
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
Below the output
(http://smartmeterp1.tiff)
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
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
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.
It works
(http://smartmeterp1.png)
Small fix so GasDeliveredTime is converted to right format. Is important for saving into DB.
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
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
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
here the same the gas reading has still the asterisk.
1.3 solved the issue with GasDeliveredTime format.
New version 1.4 which removes asterisk for Iskra meters and also added produced energie values.
Let me know if it works alright?
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.
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
Richard,
Try version 1.7. It has a new attribute called "removeLeadingZero". When set to 'true' it will remove the leading zero of values.
Greetings Michel.
(Added documentation)
Hi Michel,
the removeLeadingZero works great. Thanx.
regards Richard
Nice job Michel, thanks. Smashed out my Cacti scripts immediately. With the help of the Statistics module and some userReadings the family's daily energy spend is now visible in FTUI. The WAF is 100% ;)
Best regards,
Ed
Hi Michel,
I haar another feature request. If it goes form normal tarif to low tarif, the values of the normal tarif don't update in the log. I know that there are the same values for the time, but for my logging it thou be nice to still have them. I use this line to get not too much logging
attr SmartMeterP1 event-min-interval *:120
I use a script for the log to get my graphs.
regards Richard
Hi
Is this module in the development version of FHEM yet? If so, what is its name. I couldn't find it.
{HT}
Sounds like the same thing as my 47_OBIS-Module.
Currently it only supports Electricity-Readings since I havent found somebody with a Gas-Meter until now.
I would be willing to include the Gasmeter also to my module, if somebody can provide me with the correct Data.
At the moment, i'm merging the 70_SMLUSB and my OBIS-Module, since both are the same, only different encoded.
Think, that will be done by about the end of the week. Then I could start including the Gasmeters.
Nice evening,
Stefan
Hi community, using the SmartmeterP1 module and now looking into a way to do a daily upload of my gasmeter reading to mindergas.nl, for which the following code should be executed. Any proposal how to do that from within fhem? Use an AT?
curl -v -H "Content-Type:application/json" -H "AUTH-TOKEN:<jouw authenticatietoken>"
-d '{ "date": "<jjjj-mm-dd>", "reading": <meterstand> }' https://www.mindergas.nl/api/gas_meter_readings
Kind regards,
Ed
According to
http://fhem.de/commandref.html#command
you can execute Shell commands by putting them in "".
To make things more tidy, I would put the curl command with parameters in a shell/batch file, and test that first.
Hi
Is there any reason why I don't see your module after an update and in the documentation?
{HT}
Hi
The module works fine, but the readings include kW and m3. This way you have to remove this text before you can use the readings to compute etc. Is it possible to remove kW and m3 from the readings?
{HT}
For those interested in a daily upload to Mindergas.nl
Define at_Mindergas at *23:59:00 { my $Gas = sprintf('%d',ReadingsVal('SmartMeterP1','GasDelivered',0));; my $date = strftime "%Y-%m-%d", localtime;; system ("curl -v -H 'Content-Type:application/json' -H 'AUTH-TOKEN:mytokenhere' -d '{ \"date\": \"$date\", \"reading\": $Gas }' https://www.mindergas.nl/api/gas_meter_readings") }
Kind regards,
Ed
Hi,
Could somebody look into that question with regards to myStr2Date usage?
https://forum.fhem.de/index.php?topic=75844.msg677042#msg677042
Regards, Arnd
Hi Harry,
You asked
Zitat von: HarryT am 15 Mai 2016, 14:09:37
The module works fine, but the readings include kW and m3. This way you have to remove this text before you can use the readings to compute etc. Is it possible to remove kW and m3 from the readings?
See what I did:
attr SmartMeter removeLeadingZero true
attr SmartMeter removeUnitSeparator true
attr SmartMeter userReadings ElectricityPowerDeliveredW { ReadingsNum ("SmartMeter","ElectricityPowerDelivered",0) * 1000 ;;;; }
ElectricityPowerDeliveredW is now only a number.
Paul
Hi Everyone,
Does any one of you know if the ElectricityPowerDelivered reading can be in 1 Watt resolution? The Dutch Smart Meter Requirements (https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf (https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf)) state on page 20 that the telegram should include "Actual electricity power delivered (+P) in 1 Watt resolution".
If it can, does any one of you know the fault tolerance on the measured Actual electricity power delivered ? Can I find that in the documentation online?
Greetings,
Paul
Hi Michel,
In my log I see the warning: "Possible unintended interpolation of @115200 in string at ./FHEM/00_SmartMeterP1.pm line 88."
I guess that means more to you than to me ;-) It doesn't seem the cause of another problem I'm dealing with.
Regards,
Paul
Hello everyone,
I have a huge problem with my SmartMeterP1 device, and would appreciate any help.
I have an ISKRA MT382 smart meter (see photo), and FHEM running on a Raspberry Pi 2B. In FHEM my SmartMeter is defined: defmod SmartMeter SmartMeterP1 /dev/ttyUSB1@9600,7,E,1.
At start everything worked as expected. Yesterday, out of the blue, an internal called PARTIAL started showing all kind of jibberish and the readings stopped updating.
Trying to solve the problem I removed the P1 plug for 10 seconds and re-installed the SmartMeter device in FHEM.
The SmartMeter log shows the start of the mayhem at 10:25:15:
2017-10-29_10:25:05 SmartMeter ElectricityDeliveredLowTariff: 10353.847 kWh
2017-10-29_10:25:05 SmartMeter ElectricityPowerDeliveredW: 1590
2017-10-29_10:25:05 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:05 SmartMeter ElectricityPowerDelivered: 1.64 kW
2017-10-29_10:25:05 SmartMeter ElectricityPowerDeliveredW: 1640
2017-10-29_10:25:05 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:15 SmartMeter ElectricityDeliveredLowTariff: 10353.852 kWh
2017-10-29_10:25:15 SmartMeter ElectricityPowerDeliveredW: 1640
2017-10-29_10:25:15 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:25 SmartMeter ElectricityDeliveredLowTariff: 10353.854 kWh
2017-10-29_10:25:25 SmartMeter ElectricityPowerDeliveredW: 1640
2017-10-29_10:25:25 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:25 SmartMeter ElectricityPowerDelivered: 0.77 kW
2017-10-29_10:25:25 SmartMeter ElectricityPowerDeliveredW: 770
2017-10-29_10:25:25 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:35 SmartMeter ElectricityDeliveredLowTariff: 10353.855 kWh
2017-10-29_10:25:35 SmartMeter ElectricityPowerDeliveredW: 770
2017-10-29_10:25:35 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:35 SmartMeter ElectricityPowerDelivered: 0.23 kW
2017-10-29_10:25:35 SmartMeter ElectricityPowerDeliveredW: 230
2017-10-29_10:25:35 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:45 SmartMeter ElectricityPowerDelivered: 0.24 kW
2017-10-29_10:25:45 SmartMeter ElectricityPowerDeliveredW: 240
2017-10-29_10:25:45 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:25:55 SmartMeter ElectricityDeliveredLowTariff: 10353.856 kWh
2017-10-29_10:25:55 SmartMeter ElectricityPowerDeliveredW: 240
2017-10-29_10:25:55 SmartMeter ElectricityPowerProducedW: 0
2017-10-29_10:26:05 SmartMeter ElectricityDeliveredLowTariff: 10353.857 kWh
2017-10-29_10:26:05 SmartMeter ElectricityPowerDeliveredW: 240
2017-10-29_10:26:05 SmartMeter ElectricityPowerProducedW: 0
FHEM was down at that time, so had nothing logged. Syslog didn't show anything useful around that time. Kernlog documents about the USB ports:
Oct 29 10:37:46 pcg kernel: [ 1.266492] usb 1-1: new high-speed USB device number 2 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 1.268748] Indeed it is in host mode hprt0 = 00001101
Oct 29 10:37:46 pcg kernel: [ 1.496920] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
Oct 29 10:37:46 pcg kernel: [ 1.499122] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Oct 29 10:37:46 pcg kernel: [ 1.502393] hub 1-1:1.0: USB hub found
Oct 29 10:37:46 pcg kernel: [ 1.504654] hub 1-1:1.0: 5 ports detected
Oct 29 10:37:46 pcg kernel: [ 1.826518] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 1.957278] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
Oct 29 10:37:46 pcg kernel: [ 1.959858] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Oct 29 10:37:46 pcg kernel: [ 1.968631] smsc95xx v1.0.5
Oct 29 10:37:46 pcg kernel: [ 2.061387] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:df:65:28
Oct 29 10:37:46 pcg kernel: [ 2.166563] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 2.324260] usb 1-1.2: New USB device found, idVendor=0403, idProduct=6001
Oct 29 10:37:46 pcg kernel: [ 2.326544] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 29 10:37:46 pcg kernel: [ 2.330764] usb 1-1.2: Product: FT232R USB UART
Oct 29 10:37:46 pcg kernel: [ 2.332957] usb 1-1.2: Manufacturer: FTDI
Oct 29 10:37:46 pcg kernel: [ 2.335102] usb 1-1.2: SerialNumber: AI1TNY7K
Oct 29 10:37:46 pcg kernel: [ 2.446514] usb 1-1.3: new full-speed USB device number 5 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 2.601382] usb 1-1.3: New USB device found, idVendor=0403, idProduct=6001
Oct 29 10:37:46 pcg kernel: [ 2.603555] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Oct 29 10:37:46 pcg kernel: [ 2.607650] usb 1-1.3: Product: RFXtrx433
Oct 29 10:37:46 pcg kernel: [ 2.609644] usb 1-1.3: Manufacturer: RFXCOM
Oct 29 10:37:46 pcg kernel: [ 2.611591] usb 1-1.3: SerialNumber: A1XGP0AV
Oct 29 10:37:46 pcg kernel: [ 2.726509] usb 1-1.5: new full-speed USB device number 6 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 2.874876] usb 1-1.5: New USB device found, idVendor=03eb, idProduct=204b
Oct 29 10:37:46 pcg kernel: [ 2.876936] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 29 10:37:46 pcg kernel: [ 2.880760] usb 1-1.5: Product: CUL433
Oct 29 10:37:46 pcg kernel: [ 2.882658] usb 1-1.5: Manufacturer: busware.de
Oct 29 10:37:46 pcg kernel: [ 3.135789] i2c /dev entries driver
Oct 29 10:37:46 pcg kernel: [ 3.556548] usb 1-1.4: new full-speed USB device number 7 using dwc_otg
Oct 29 10:37:46 pcg kernel: [ 3.693357] usb 1-1.4: New USB device found, idVendor=1b1f, idProduct=c00f
Oct 29 10:37:46 pcg kernel: [ 3.693379] usb 1-1.4: New USB device strings: Mfr=4, Product=14, SerialNumber=36
Oct 29 10:37:46 pcg kernel: [ 3.693389] usb 1-1.4: Product: HM-CFG-USB
Oct 29 10:37:46 pcg kernel: [ 3.693399] usb 1-1.4: Manufacturer: eQ-3
Oct 29 10:37:46 pcg kernel: [ 3.693408] usb 1-1.4: SerialNumber: MEQ0231478
Oct 29 10:37:46 pcg kernel: [ 3.709887] hid-generic 0003:1B1F:C00F.0001: hiddev0,hidraw0: USB HID v1.10 Device [eQ-3 HM-CFG-USB] on usb-3f980000.usb-1.4/input0
Oct 29 10:37:46 pcg kernel: [ 31.809108] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
Oct 29 10:37:46 pcg kernel: [ 32.090078] cdc_acm 1-1.5:1.0: ttyACM0: USB ACM device
Oct 29 10:37:46 pcg kernel: [ 32.097268] usbcore: registered new interface driver cdc_acm
Oct 29 10:37:46 pcg kernel: [ 32.097286] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
Oct 29 10:37:46 pcg kernel: [ 32.185925] usbcore: registered new interface driver usbserial
Oct 29 10:37:46 pcg kernel: [ 32.186067] usbcore: registered new interface driver usbserial_generic
Oct 29 10:37:46 pcg kernel: [ 32.186180] usbserial: USB Serial support registered for generic
Oct 29 10:37:46 pcg kernel: [ 32.251420] usbcore: registered new interface driver ftdi_sio
Oct 29 10:37:46 pcg kernel: [ 32.251547] usbserial: USB Serial support registered for FTDI USB Serial Device
Oct 29 10:37:46 pcg kernel: [ 32.251894] ftdi_sio 1-1.2:1.0: FTDI USB Serial Device converter detected
Oct 29 10:37:46 pcg kernel: [ 32.252152] usb 1-1.2: Detected FT232RL
Oct 29 10:37:46 pcg kernel: [ 32.264024] usb 1-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
Oct 29 10:37:46 pcg kernel: [ 32.264254] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
Oct 29 10:37:46 pcg kernel: [ 32.264515] usb 1-1.3: Detected FT232RL
Oct 29 10:37:46 pcg kernel: [ 32.287892] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB1
As we all think occasionally: what could possibly go wrong??
Again: any help is highly appreciated!
Paul
I had the usb port wrong...
Zitat von: Ed66 am 30 Dezember 2015, 18:40:44
Nice job Michel, thanks. Smashed out my Cacti scripts immediately. With the help of the Statistics module and some userReadings the family's daily energy spend is now visible in FTUI. The WAF is 100% ;)
Best regards,
Ed
Hi Ed,
I am really interested how you set this up. Can you attach your configuration?
Thanks in advance.
Joost
Hi there,
a few days ago my smartmeter has been exchanged. The old one was read out without problem and the new one works fine for the electricity values.
However, the gas data is not read out anymore. It only reads a constant (wrong) value. I saw that the gas meter can have channel 1, 2, 3 or 4 according to OBIS reference and that in the .pm module only channel 1 is read out. My guess is that my new smartmeter is now using not channel 1 like the old one but channel 2, 3, or 4 instead. Would it be possible to update the smartmeterP1 module such that it becomes possible to choose the channel?
That would be truly great!
Thanks,
Kirin
Hi,
The low & normal tariff are switched in FHEM compared to what is set up in my belgian meter.
Any way to switch them within FHEM ?
Thanks !