Open apassler opened 4 years ago
Hi @apassler
Thanks for sharing your findings here.
In order to better understand this issue and to add support for EHz-P to smeterd
I need more information.
1) Does it work with other libraries or scripts you found on the internet?
2) Are you sure all the connection settings are correct for this model (documentation?)
Thank you for your quick respond! I didn't realy expect this so quickly.
I also tested vzlogger with no success.
I read the documentation on https://www.emh-metering.de/produkte/smart-meter/ehz I also tested this script:
import sys import serial import time
port = serial.Serial( port='/dev/ttyUSB0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS )
data = ''
start = '1b1b1b1b01010101' for i in range (0, 1000): char = port.read() data = data + char.encode('HEX') pos = data.find(start) if (pos <> -1): data = data[pos:len(data)]
file = open('sample01', 'w') file.write(data) file.close()
results in sample01:
Hi together,
I have the same issue.
smeterd read-meter -vvv --serial-port /dev/ttyUSB0 --baudrate 9600 --serial-baudrate 9600 --serial-bytesize 8 --serial-parity N --serial-stopbits 1
[2020-02-20 21:37:59,112] DEBUG Open serial connect to /dev/ttyUSB0 with: baudrate=9600, bytesize=8, parity=N, stopbits=1.0, xonxoff=False, timeout=10
[2020-02-20 21:37:59,118] INFO New serial connection opened to /dev/ttyUSB0
[2020-02-20 21:37:59,118] INFO Start reading lines
[2020-02-20 21:37:59,161] ERROR 'ascii' codec can't decode byte 0xe1 in position 5: ordinal not in range(128)
[2020-02-20 21:37:59,161] ERROR Read a total of 0 lines
[2020-02-20 21:37:59,162] INFO Closing connection to /dev/ttyUSB0
.
If I use the Emlog testing software I got a byte string and the information about the baudrate is 9600 8N1.
The datalogger runs in my home automation smartVISU under the following plugin.
[https://github.com/smarthomeNG/plugins/tree/master/smlx]
Maybe it helps for analysis.
Many thanks.
I'm also seeing 'ascii' codec can't decode byte 0xc0 in position 0: ordinal not in range(128)
. From what I'm reading this may indicate the code is made for Python2 and has trouble running on python 3.
//Update: that's not it. I got it working. I was using a virtual serial port to test it. When I switched to an Arduino that emulates a P1 meter, it worked.
@flatsiedatsie Do you mean that you got smeterd read-meter
working?
No, I mean I got it working in an addon for the Mozilla WebThings Gateway, which uses your python module.
May I join the club here?
smeterd read-meter -vvv --serial-port /dev/ttyUSB0 --baudrate 9600 --serial-baudrate 9600 --serial-bytesize 8 --serial-parity N --serial-stopbits 1 [2020-01-04 11:27:59,029] DEBUG Open serial connect to /dev/ttyUSB0 with: parity=N, baudrate=9600, bytesize=8, xonxoff=False, timeout=10, stopbits=1.0 [2020-01-04 11:27:59,035] INFO New serial connection opened to /dev/ttyUSB0 [2020-01-04 11:27:59,037] INFO Start reading lines [2020-01-04 11:27:59,103] ERROR 'ascii' codec can't decode byte 0xb7 in position 1: ordinal not in range(128) [2020-01-04 11:27:59,104] ERROR Read a total of 0 lines [2020-01-04 11:27:59,105] INFO Closing connection to
load_entry_point('smeterd==2.8.1', 'console_scripts', 'smeterd')()
File "build/bdist.linux-armv7l/egg/smeterd/cli/init.py", line 22, in parse_and_run
File "build/bdist.linux-armv7l/egg/smeterd/cli/read_meter.py", line 73, in run
File "build/bdist.linux-armv7l/egg/smeterd/meter.py", line 79, in read_one_packet
smeterd.meter.SmartMeterError: 'ascii' codec can't decode byte 0xb7 in position 1: ordinal not in range(128)
/dev/ttyUSB0
. Traceback (most recent call last): File "/usr/local/bin/smeterd", line 9, in