diff --git a/custom_components/phyn/devices/base.py b/custom_components/phyn/devices/base.py index c5d6660..ddcf635 100644 --- a/custom_components/phyn/devices/base.py +++ b/custom_components/phyn/devices/base.py @@ -86,6 +86,9 @@ def rssi(self) -> float: def serial_number(self) -> str: """Return the serial number for the device.""" return self._device_state["serial_number"] + + async def async_setup(self): + pass async def _update_firmware_information(self, *_) -> None: self._firmware_info.update( diff --git a/custom_components/phyn/devices/pw.py b/custom_components/phyn/devices/pw.py index f39aea7..8fce235 100644 --- a/custom_components/phyn/devices/pw.py +++ b/custom_components/phyn/devices/pw.py @@ -121,9 +121,9 @@ async def async_update_data(self): async def _update_device(self, *_) -> None: """Update the device state from the API.""" to_ts = int(datetime.timestamp(datetime.now()) * 1000) - from_ts = to_ts - (3600 * 24 * 1000) + from_ts = to_ts - (3600 * 72 * 1000) data = await self._coordinator.api_client.device.get_water_statistics(self._phyn_device_id, from_ts, to_ts) - LOGGER.debug("PW1 data: %s", data) + LOGGER.debug("PW1 data (%s): %s", (self._phyn_device_id, data)) item = None for entry in data: @@ -136,7 +136,7 @@ async def _update_device(self, *_) -> None: if item: self._water_statistics.update(item) - LOGGER.debug("Phyn Water device state: %s", self._device_state) + LOGGER.debug("Phyn Water device state (%s): %s", (self._phyn_device_id, self._device_state)) async def async_setup(self): """Async setup not needed""" diff --git a/custom_components/phyn/entities/base.py b/custom_components/phyn/entities/base.py index 2e0be7d..61d24fd 100644 --- a/custom_components/phyn/entities/base.py +++ b/custom_components/phyn/entities/base.py @@ -4,6 +4,7 @@ from typing import Any from homeassistant.helpers.entity import DeviceInfo, Entity +from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, @@ -61,6 +62,8 @@ def device_info(self) -> DeviceInfo: model=self._device.model, name=self._device.device_name.capitalize(), sw_version=self._device.firmware_version, + connections={(CONNECTION_NETWORK_MAC, self._device.id)}, + serial_number=self._device.serial_number ) @property