diff --git a/homeassistant/components/refoss/bridge.py b/homeassistant/components/refoss/bridge.py index 82cc2540f6c..11e92620fbb 100644 --- a/homeassistant/components/refoss/bridge.py +++ b/homeassistant/components/refoss/bridge.py @@ -9,7 +9,7 @@ from refoss_ha.discovery import Discovery, Listener from homeassistant.core import HomeAssistant from homeassistant.helpers.dispatcher import async_dispatcher_send -from .const import COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DOMAIN +from .const import _LOGGER, COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DOMAIN from .coordinator import RefossDataUpdateCoordinator @@ -36,11 +36,21 @@ class DiscoveryService(Listener): self.hass.data[DOMAIN][COORDINATORS].append(coordo) await coordo.async_refresh() + _LOGGER.debug( + "Discover new device: %s, ip: %s", + device_info.dev_name, + device_info.inner_ip, + ) async_dispatcher_send(self.hass, DISPATCH_DEVICE_DISCOVERED, coordo) async def device_update(self, device_info: DeviceInfo) -> None: """Handle updates in device information, update if ip has changed.""" for coordinator in self.hass.data[DOMAIN][COORDINATORS]: if coordinator.device.device_info.mac == device_info.mac: + _LOGGER.debug( + "Update device %s ip to %s", + device_info.dev_name, + device_info.inner_ip, + ) coordinator.device.device_info.inner_ip = device_info.inner_ip await coordinator.async_refresh() diff --git a/homeassistant/components/refoss/config_flow.py b/homeassistant/components/refoss/config_flow.py index fe33cefc1bd..5b667940731 100644 --- a/homeassistant/components/refoss/config_flow.py +++ b/homeassistant/components/refoss/config_flow.py @@ -5,7 +5,7 @@ from __future__ import annotations from homeassistant.core import HomeAssistant from homeassistant.helpers import config_entry_flow -from .const import DISCOVERY_TIMEOUT, DOMAIN +from .const import _LOGGER, DISCOVERY_TIMEOUT, DOMAIN from .util import refoss_discovery_server @@ -14,6 +14,9 @@ async def _async_has_devices(hass: HomeAssistant) -> bool: refoss_discovery = await refoss_discovery_server(hass) devices = await refoss_discovery.broadcast_msg(wait_for=DISCOVERY_TIMEOUT) + _LOGGER.debug( + "Discovered devices: [%s]", ", ".join([info.dev_name for info in devices]) + ) return len(devices) > 0 diff --git a/homeassistant/components/refoss/const.py b/homeassistant/components/refoss/const.py index 851f8ba8f77..62db733ece5 100644 --- a/homeassistant/components/refoss/const.py +++ b/homeassistant/components/refoss/const.py @@ -11,7 +11,7 @@ COORDINATORS = "coordinators" DATA_DISCOVERY_SERVICE = "refoss_discovery" DISCOVERY_SCAN_INTERVAL = 30 -DISCOVERY_TIMEOUT = 8 +DISCOVERY_TIMEOUT = 20 DISPATCH_DEVICE_DISCOVERED = "refoss_device_discovered" DISPATCHERS = "dispatchers" diff --git a/homeassistant/components/refoss/coordinator.py b/homeassistant/components/refoss/coordinator.py index 8b03313d6d6..929d1b3962b 100644 --- a/homeassistant/components/refoss/coordinator.py +++ b/homeassistant/components/refoss/coordinator.py @@ -34,6 +34,11 @@ class RefossDataUpdateCoordinator(DataUpdateCoordinator[None]): self.last_update_success = True self._error_count = 0 except DeviceTimeoutError: + _LOGGER.debug( + "Update device %s status timeout,ip: %s", + self.device.dev_name, + self.device.inner_ip, + ) self._error_count += 1 if self._error_count >= MAX_ERRORS: diff --git a/homeassistant/components/refoss/entity.py b/homeassistant/components/refoss/entity.py index 502101608ec..662b7c89376 100644 --- a/homeassistant/components/refoss/entity.py +++ b/homeassistant/components/refoss/entity.py @@ -23,5 +23,7 @@ class RefossEntity(CoordinatorEntity[RefossDataUpdateCoordinator]): connections={(CONNECTION_NETWORK_MAC, mac)}, identifiers={(DOMAIN, mac)}, manufacturer="Refoss", + sw_version=coordinator.device.fmware_version, + hw_version=coordinator.device.hdware_version, name=coordinator.device.dev_name, ) diff --git a/homeassistant/components/refoss/manifest.json b/homeassistant/components/refoss/manifest.json index da7050433f3..93ffe5b3f26 100644 --- a/homeassistant/components/refoss/manifest.json +++ b/homeassistant/components/refoss/manifest.json @@ -5,5 +5,6 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/refoss", "iot_class": "local_polling", - "requirements": ["refoss-ha==1.2.5"] + "requirements": ["refoss-ha==1.2.5"], + "single_config_entry": true } diff --git a/homeassistant/components/refoss/sensor.py b/homeassistant/components/refoss/sensor.py index 26454cae48d..7065470657f 100644 --- a/homeassistant/components/refoss/sensor.py +++ b/homeassistant/components/refoss/sensor.py @@ -27,6 +27,7 @@ from homeassistant.helpers.typing import StateType from .bridge import RefossDataUpdateCoordinator from .const import ( + _LOGGER, CHANNEL_DISPLAY_NAME, COORDINATORS, DISPATCH_DEVICE_DISCOVERED, @@ -143,6 +144,7 @@ async def async_setup_entry( for channel in device.channels for description in descriptions ) + _LOGGER.debug("Device %s add sensor entity success", device.dev_name) for coordinator in hass.data[DOMAIN][COORDINATORS]: init_device(coordinator) diff --git a/homeassistant/components/refoss/switch.py b/homeassistant/components/refoss/switch.py index 0f5aba0cfc4..aed132ecc3a 100644 --- a/homeassistant/components/refoss/switch.py +++ b/homeassistant/components/refoss/switch.py @@ -13,7 +13,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback from .bridge import RefossDataUpdateCoordinator -from .const import COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DOMAIN +from .const import _LOGGER, COORDINATORS, DISPATCH_DEVICE_DISCOVERED, DOMAIN from .entity import RefossEntity @@ -37,6 +37,7 @@ async def async_setup_entry( new_entities.append(entity) async_add_entities(new_entities) + _LOGGER.debug("Device %s add switch entity success", device.dev_name) for coordinator in hass.data[DOMAIN][COORDINATORS]: init_device(coordinator) diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 8343b7fde9d..41a20a4e723 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -5149,7 +5149,8 @@ "name": "Refoss", "integration_type": "hub", "config_flow": true, - "iot_class": "local_polling" + "iot_class": "local_polling", + "single_config_entry": true }, "rejseplanen": { "name": "Rejseplanen",