diff --git a/homeassistant/components/landisgyr_heat_meter/__init__.py b/homeassistant/components/landisgyr_heat_meter/__init__.py index 4321f53bed6..3ef235ff8af 100644 --- a/homeassistant/components/landisgyr_heat_meter/__init__.py +++ b/homeassistant/components/landisgyr_heat_meter/__init__.py @@ -31,9 +31,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: _LOGGER.info("Polling on %s", entry.data[CONF_DEVICE]) return await hass.async_add_executor_job(api.read) - # No automatic polling and no initial refresh of data is being done at this point, - # to prevent battery drain. The user will have to do it manually. - + # Polling is only daily to prevent battery drain. coordinator = DataUpdateCoordinator( hass, _LOGGER, diff --git a/homeassistant/components/landisgyr_heat_meter/config_flow.py b/homeassistant/components/landisgyr_heat_meter/config_flow.py index e3dbbb7433b..2e244a9a65f 100644 --- a/homeassistant/components/landisgyr_heat_meter/config_flow.py +++ b/homeassistant/components/landisgyr_heat_meter/config_flow.py @@ -14,7 +14,7 @@ from homeassistant import config_entries from homeassistant.const import CONF_DEVICE from homeassistant.exceptions import HomeAssistantError -from .const import DOMAIN +from .const import DOMAIN, ULTRAHEAT_TIMEOUT _LOGGER = logging.getLogger(__name__) @@ -43,6 +43,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): dev_path = await self.hass.async_add_executor_job( get_serial_by_id, user_input[CONF_DEVICE] ) + _LOGGER.debug("Using this path : %s", dev_path) try: return await self.validate_and_create_entry(dev_path) @@ -76,6 +77,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): """Try to connect to the device path and return an entry.""" model, device_number = await self.validate_ultraheat(dev_path) + _LOGGER.debug("Got model %s and device_number %s", model, device_number) await self.async_set_unique_id(device_number) self._abort_if_unique_id_configured() data = { @@ -94,7 +96,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): reader = UltraheatReader(port) heat_meter = HeatMeterService(reader) try: - async with async_timeout.timeout(10): + async with async_timeout.timeout(ULTRAHEAT_TIMEOUT): # validate and retrieve the model and device number for a unique id data = await self.hass.async_add_executor_job(heat_meter.read) _LOGGER.debug("Got data from Ultraheat API: %s", data) diff --git a/homeassistant/components/landisgyr_heat_meter/const.py b/homeassistant/components/landisgyr_heat_meter/const.py index 70008890d1f..55a6c65892c 100644 --- a/homeassistant/components/landisgyr_heat_meter/const.py +++ b/homeassistant/components/landisgyr_heat_meter/const.py @@ -11,6 +11,7 @@ from homeassistant.helpers.entity import EntityCategory DOMAIN = "landisgyr_heat_meter" GJ_TO_MWH = 0.277778 # conversion factor +ULTRAHEAT_TIMEOUT = 30 # reading the IR port can take some time HEAT_METER_SENSOR_TYPES = ( SensorEntityDescription(