Open niclas0219 opened 3 years ago
Ok.. found the same issue here: https://github.com/esphome/issues/issues/313#issue-444213571
I guess ill try some other code to actually see the garbage I get in RX and go from there.
Slow progress.. I added a print statement in the python code of esphome just where it crashes. This is my readings from the power meter that I have repeated eight times. It looks like nonsense to me but at least it is somewhat consistent. Any ideas what i am seeing? This is just the first line as the program crashes after this, how can I make the script go on even though it throws an exception?
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\x864\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\x864\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\x06\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=F\x1a\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
b'\x08\x05\x1aM\x1b[0;36m[D][data:275]: hV\x15+e\x143YV)f\xc6\xc6\x8a\x1e=y=gif1\xc6c\xc6\xe3\x8c\x8d\x193ky=\x86i\xc6\x8c\xc6\xe3\xc6\xe3\xc6\x8d3g\xc6\x19F\x8c3\n\x1b[0m'
Ok.. I give up for today. I did check the serial coming in from the meter and it sends ascii. There is some garbage on the oscilloscope as well and I wonder if it is just the serial decoder of the oscilloscope having problems or if there is some kind of timing issue?. Any tip is appreciated.
Hi!
Installed and wired according to the instructions. When starting the "esphome p1reader.yaml logs" I always get the following:
INFO Reading configuration p1reader.yaml... INFO Starting log output from electricity_meter.local using esphome API INFO Connecting to electricity_meter.local:6053 (192.168.100.59) INFO Successfully connected to electricity_meter.local [21:17:33][I][app:105]: ESPHome version 1.16.2 compiled on Apr 8 2021, 14:17:57
[21:17:33][C][wifi:304]: IP Address: 192.168.100.59 [21:17:33][C][wifi:306]: BSSID: 74:83:C2:DA:2E:49
[21:17:33][C][wifi:311]: Signal strength: -59 dB ▂▄▆█ [21:17:33][C][wifi:315]: Channel: 11 [21:17:33][C][wifi:316]: Subnet: 255.255.255.0 [21:17:33][C][wifi:317]: Gateway: 192.168.100.1 [21:17:33][C][wifi:318]: DNS1: 192.168.100.100 [21:17:33][C][wifi:319]: DNS2: 1.1.1.1 Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner self.run() File "/usr/lib/python3.9/site-packages/esphome/api/client.py", line 391, in run self._run_once() File "/usr/lib/python3.9/site-packages/esphome/api/client.py", line 381, in _run_once msg.ParseFromString(raw_msg) File "/usr/lib/python3.9/site-packages/google/protobuf/message.py", line 199, in ParseFromString return self.MergeFromString(serialized) File "/usr/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 1145, in MergeFromString if self._InternalParse(serialized, 0, length) != length: File "/usr/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 1212, in InternalParse pos = field_decoder(buffer, new_pos, end, self, field_dict) File "/usr/lib/python3.9/site-packages/google/protobuf/internal/decoder.py", line 619, in DecodeField field_dict[key] = _ConvertToUnicode(buffer[pos:new_pos]) File "/usr/lib/python3.9/site-packages/google/protobuf/internal/decoder.py", line 572, in _ConvertToUnicode value = local_unicode(byte_str, 'utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc6 in position 33: 'utf-8' codec can't decode byte 0xc6 in position 33: invalid continuation byte in field: SubscribeLogsResponse.message WARNING Disconnected from API: Timeout while waiting for message response! INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 2 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 3 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 5 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 7 seconds INFO Connecting to electricity_meter.local:6053 (192.168.100.59) WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 11 seconds
I wired the transistor incorrectly the first time which means that the signal inverter was not working and I didn't get any data on the RX-pin at all. When I checked the logs it was just idle so this leads me to suspect that I am getting some kind of garbage data "0xc6" that the python script doesn't like. Any suggestions?
My meter: https://brittedal.se/a/manual-till-elmatare-star
Please help!