Add explicit support for Luxembourg Smarty meter in dsmr integration (#43975)
* Add support for Luxembourg Smarty meter * Add config flow test * Add sensor tests
This commit is contained in:
parent
1f27fb4644
commit
9531b08f2a
5 changed files with 140 additions and 13 deletions
|
@ -2,7 +2,11 @@
|
|||
import asyncio
|
||||
|
||||
from dsmr_parser.clients.protocol import DSMRProtocol
|
||||
from dsmr_parser.obis_references import EQUIPMENT_IDENTIFIER, EQUIPMENT_IDENTIFIER_GAS
|
||||
from dsmr_parser.obis_references import (
|
||||
EQUIPMENT_IDENTIFIER,
|
||||
EQUIPMENT_IDENTIFIER_GAS,
|
||||
LUXEMBOURG_EQUIPMENT_IDENTIFIER,
|
||||
)
|
||||
from dsmr_parser.objects import CosemObject
|
||||
import pytest
|
||||
|
||||
|
@ -38,17 +42,27 @@ async def dsmr_connection_send_validate_fixture(hass):
|
|||
transport = MagicMock(spec=asyncio.Transport)
|
||||
protocol = MagicMock(spec=DSMRProtocol)
|
||||
|
||||
async def connection_factory(*args, **kwargs):
|
||||
"""Return mocked out Asyncio classes."""
|
||||
return (transport, protocol)
|
||||
|
||||
connection_factory = MagicMock(wraps=connection_factory)
|
||||
|
||||
protocol.telegram = {
|
||||
EQUIPMENT_IDENTIFIER: CosemObject([{"value": "12345678", "unit": ""}]),
|
||||
EQUIPMENT_IDENTIFIER_GAS: CosemObject([{"value": "123456789", "unit": ""}]),
|
||||
}
|
||||
|
||||
async def connection_factory(*args, **kwargs):
|
||||
"""Return mocked out Asyncio classes."""
|
||||
if args[1] == "5L":
|
||||
protocol.telegram = {
|
||||
LUXEMBOURG_EQUIPMENT_IDENTIFIER: CosemObject(
|
||||
[{"value": "12345678", "unit": ""}]
|
||||
),
|
||||
EQUIPMENT_IDENTIFIER_GAS: CosemObject(
|
||||
[{"value": "123456789", "unit": ""}]
|
||||
),
|
||||
}
|
||||
|
||||
return (transport, protocol)
|
||||
|
||||
connection_factory = MagicMock(wraps=connection_factory)
|
||||
|
||||
async def wait_closed():
|
||||
if isinstance(connection_factory.call_args_list[0][0][2], str):
|
||||
# TCP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue