Skip to content

Commit

Permalink
fix invalid DeviceInfo for HA 2023.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hekmon committed Sep 7, 2023
1 parent 19b0b4f commit 1b70be0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
11 changes: 5 additions & 6 deletions custom_components/linkytic/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import (
DID_CONNECTION_TYPE,
DID_CONSTRUCTOR,
DID_DEFAULT_MANUFACTURER,
DID_DEFAULT_MODEL,
DID_DEFAULT_NAME,
DID_REGNUMBER,
DID_TYPE,
DOMAIN,
)
Expand Down Expand Up @@ -96,12 +96,11 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return DeviceInfo(
default_manufacturer=DID_DEFAULT_MANUFACTURER,
default_model=DID_DEFAULT_MODEL,
default_name=DID_DEFAULT_NAME,
identifiers={(DOMAIN, self._device_uniq_id)},
# connections={(DID_CONNECTION_TYPE, self._serial_controller._port)},
identifiers={(DOMAIN, self._serial_controller.device_identification[DID_REGNUMBER])},
manufacturer=self._serial_controller.device_identification[DID_CONSTRUCTOR],
model=self._serial_controller.device_identification[DID_TYPE],
name=DID_DEFAULT_NAME,
)

@property
Expand Down
2 changes: 2 additions & 0 deletions custom_components/linkytic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
DID_DEFAULT_MODEL = "Compteur communiquant Linky"
DID_DEFAULT_NAME = "Linky"

DID_CONNECTION_TYPE = "serial"

# # https://euridis.org/wp-content/uploads/IdentifiantsEuridisListeCCTTV304A_143027.pdf (V3.04A du 27/03/2019)
CONSTRUCTORS_CODES = {
"01": "CROUZET / MONETEL",
Expand Down
31 changes: 13 additions & 18 deletions custom_components/linkytic/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
from .const import (
CONSTRUCTORS_CODES,
DEVICE_TYPES,
DID_CONNECTION_TYPE,
DID_CONSTRUCTOR,
DID_DEFAULT_MANUFACTURER,
DID_DEFAULT_MODEL,
DID_DEFAULT_NAME,
DID_REGNUMBER,
DID_TYPE,
Expand Down Expand Up @@ -458,12 +457,11 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return DeviceInfo(
default_manufacturer=DID_DEFAULT_MANUFACTURER,
default_model=DID_DEFAULT_MODEL,
default_name=DID_DEFAULT_NAME,
identifiers={(DOMAIN, self._config_uniq_id)},
# connections={(DID_CONNECTION_TYPE, self._serial_controller._port)},
identifiers={(DOMAIN, self._serial_controller.device_identification[DID_REGNUMBER])},
manufacturer=self._serial_controller.device_identification[DID_CONSTRUCTOR],
model=self._serial_controller.device_identification[DID_TYPE],
name=DID_DEFAULT_NAME,
)

@property
Expand Down Expand Up @@ -621,12 +619,11 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return DeviceInfo(
default_manufacturer=DID_DEFAULT_MANUFACTURER,
default_model=DID_DEFAULT_MODEL,
default_name=DID_DEFAULT_NAME,
identifiers={(DOMAIN, self._config_uniq_id)},
# connections={(DID_CONNECTION_TYPE, self._serial_controller._port)},
identifiers={(DOMAIN, self._serial_controller.device_identification[DID_REGNUMBER])},
manufacturer=self._serial_controller.device_identification[DID_CONSTRUCTOR],
model=self._serial_controller.device_identification[DID_TYPE],
name=DID_DEFAULT_NAME,
)

@property
Expand Down Expand Up @@ -729,12 +726,11 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return DeviceInfo(
default_manufacturer=DID_DEFAULT_MANUFACTURER,
default_model=DID_DEFAULT_MODEL,
default_name=DID_DEFAULT_NAME,
identifiers={(DOMAIN, self._config_uniq_id)},
# connections={(DID_CONNECTION_TYPE, self._serial_controller._port)},
identifiers={(DOMAIN, self._serial_controller.device_identification[DID_REGNUMBER])},
manufacturer=self._serial_controller.device_identification[DID_CONSTRUCTOR],
model=self._serial_controller.device_identification[DID_TYPE],
name=DID_DEFAULT_NAME,
)

@property
Expand Down Expand Up @@ -865,12 +861,11 @@ def __init__(
def device_info(self) -> DeviceInfo:
"""Return the device info."""
return DeviceInfo(
default_manufacturer=DID_DEFAULT_MANUFACTURER,
default_model=DID_DEFAULT_MODEL,
default_name=DID_DEFAULT_NAME,
identifiers={(DOMAIN, self._config_uniq_id)},
# connections={(DID_CONNECTION_TYPE, self._serial_controller._port)},
identifiers={(DOMAIN, self._serial_controller.device_identification[DID_REGNUMBER])},
manufacturer=self._serial_controller.device_identification[DID_CONSTRUCTOR],
model=self._serial_controller.device_identification[DID_TYPE],
name=DID_DEFAULT_NAME,
)

@property
Expand Down

0 comments on commit 1b70be0

Please sign in to comment.