|
4 | 4 | from datetime import timedelta
|
5 | 5 |
|
6 | 6 | import voluptuous as vol
|
| 7 | +from smllib import SmlStreamReader |
| 8 | +from smllib.const import UNITS |
| 9 | +from smllib.errors import CrcError |
| 10 | +from smllib.sml import SmlListEntry, ObisCode |
| 11 | + |
7 | 12 | from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
8 | 13 | from homeassistant.const import CONF_ID, CONF_HOST, CONF_SCAN_INTERVAL, CONF_PASSWORD, CONF_MODE
|
9 | 14 | from homeassistant.core import HomeAssistant
|
10 | 15 | from homeassistant.exceptions import ConfigEntryNotReady
|
11 | 16 | from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
12 | 17 | from homeassistant.helpers.entity import EntityDescription, Entity
|
13 | 18 | from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
14 |
| -from smllib import SmlStreamReader |
15 |
| -from smllib.const import UNITS |
16 |
| -from smllib.errors import CrcError |
17 |
| -from smllib.sml import SmlListEntry, ObisCode |
18 |
| - |
19 | 19 | from .const import (
|
20 | 20 | DOMAIN,
|
21 | 21 | MANUFACTURE,
|
@@ -350,6 +350,12 @@ async def read_plaintext(self, plaintext: str, retry: bool, log_payload: bool):
|
350 | 350 | # a patch for invalid reading?!
|
351 | 351 | # a_line = a_line.replace('."55*', '.255*')
|
352 | 352 |
|
| 353 | + # looks like that in the format 'IEC-62056-21' there are the '1-0:' is missing ?! [this is really |
| 354 | + # a very DUMP implementation] |
| 355 | + if a_line[1] != '-' and a_line[3] != ':' and '*' in a_line and '(' in a_line and ')' in a_line: |
| 356 | + a_line = '1-0:' + a_line |
| 357 | + pass |
| 358 | + |
353 | 359 | # obis pattern is 'a-b:c.d.e*f'
|
354 | 360 | parts = re.split(self.PLAIN_TEXT_LINE, a_line)
|
355 | 361 | if len(parts) == 9:
|
|
0 commit comments