diff --git a/custom_components/boiler_controller/__init__.py b/custom_components/boiler_controller/__init__.py index 62ab448..835e957 100644 --- a/custom_components/boiler_controller/__init__.py +++ b/custom_components/boiler_controller/__init__.py @@ -37,8 +37,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Boiler Controller from a config entry.""" _LOGGER.info("Setting up Boiler Controller") - integration = await async_get_integration(hass, DOMAIN) - integration_version = integration.version + from .const import VERSION + + try: + integration = await async_get_integration(hass, DOMAIN) + integration_version = integration.version + except Exception as err: # pylint: disable=broad-except + _LOGGER.warning("Could not get integration version: %s, using fallback", err) + integration_version = None + + # Ensure we always have a valid version string + integration_version = str(integration_version) if integration_version else VERSION # Create the controller controller = BoilerController(hass, entry, integration_version) diff --git a/custom_components/boiler_controller/button.py b/custom_components/boiler_controller/button.py index aaa3bd2..49c5077 100644 --- a/custom_components/boiler_controller/button.py +++ b/custom_components/boiler_controller/button.py @@ -13,6 +13,7 @@ from .const import ( DOMAIN, + VERSION, CALIBRATION_START_PERCENTAGE, CALIBRATION_END_PERCENTAGE, CALIBRATION_STEP_PERCENTAGE, @@ -23,13 +24,14 @@ def _device_info(config_entry: ConfigEntry, controller) -> Dict[str, Any]: - version = controller.integration_version or str(config_entry.version) + from .const import VERSION + version = controller.integration_version if controller.integration_version else VERSION return { "identifiers": {(DOMAIN, config_entry.entry_id)}, "name": config_entry.title, "manufacturer": "Boiler Controller", "model": "P1 to Shelly Controller", - "sw_version": version, + "sw_version": str(version), } diff --git a/custom_components/boiler_controller/config_flow.py b/custom_components/boiler_controller/config_flow.py index 13b81d5..3ec15da 100644 --- a/custom_components/boiler_controller/config_flow.py +++ b/custom_components/boiler_controller/config_flow.py @@ -270,7 +270,11 @@ async def async_step_shelly_config(self, user_input=None): return self.async_show_form( step_id="shelly_config", data_schema=schema, - errors=errors + errors=errors, + description_placeholders={ + "example_url1": "http://shelly0110dimg3-xxxx.local", + "example_url2": "http://shellyplusdimg3-xxxx.local" + } ) async def _get_power_sensors(self): @@ -420,6 +424,10 @@ async def async_step_shelly_config(self, user_input=None): step_id="shelly_config", data_schema=schema, errors=errors, + description_placeholders={ + "example_url1": "http://shelly0110dimg3-xxxx.local", + "example_url2": "http://shellyplusdimg3-xxxx.local" + } ) async def _get_power_sensors(self): diff --git a/custom_components/boiler_controller/const.py b/custom_components/boiler_controller/const.py index 8d7b85a..e92b95e 100644 --- a/custom_components/boiler_controller/const.py +++ b/custom_components/boiler_controller/const.py @@ -1,5 +1,5 @@ DOMAIN = "boiler_controller" -VERSION = "0.1.0" +VERSION = "1.0.0" PLATFORMS = ["sensor", "select", "number", "button"] diff --git a/custom_components/boiler_controller/controller.py b/custom_components/boiler_controller/controller.py index c8d25b8..b155bf4 100644 --- a/custom_components/boiler_controller/controller.py +++ b/custom_components/boiler_controller/controller.py @@ -365,12 +365,14 @@ async def _set_dimmer_percentage(self, percentage: int, *, source: str = DIMMER_ @property def device_info(self): """Return device information.""" + from .const import VERSION as DEFAULT_VERSION + version = self.integration_version if self.integration_version else DEFAULT_VERSION return { "identifiers": {(DOMAIN, self.config_entry.entry_id)}, "name": self.config_entry.title, "manufacturer": "Boiler Controller", "model": "P1 to Dimmer Controller", - "sw_version": self.integration_version or str(self.config_entry.version), + "sw_version": str(version), } def get_status(self): diff --git a/custom_components/boiler_controller/manifest.json b/custom_components/boiler_controller/manifest.json index dea0833..3739182 100644 --- a/custom_components/boiler_controller/manifest.json +++ b/custom_components/boiler_controller/manifest.json @@ -8,11 +8,11 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/BoilerController/boiler-controller-ha/issues", "requirements": [], + "version": "1.0.0", "zeroconf": [ { "type": "_http._tcp.local.", "name": "shelly0110dimg3-*" }, { "type": "_http._tcp.local.", "name": "shellyplusdimg3-*" }, { "type": "_shelly._tcp.local.", "name": "shelly0110dimg3-*" }, { "type": "_shelly._tcp.local.", "name": "shellyplusdimg3-*" } - ], - "version": "0.1.0" + ] } diff --git a/custom_components/boiler_controller/number.py b/custom_components/boiler_controller/number.py index 71906e6..6fd9497 100644 --- a/custom_components/boiler_controller/number.py +++ b/custom_components/boiler_controller/number.py @@ -84,10 +84,12 @@ def available(self) -> bool: @property def device_info(self): + from .const import VERSION as DEFAULT_VERSION + version = self.controller.integration_version if self.controller.integration_version else DEFAULT_VERSION return { "identifiers": {(DOMAIN, self.config_entry.entry_id)}, "name": self.config_entry.title, "manufacturer": "Boiler Controller", "model": "P1 to Shelly Controller", - "sw_version": self.controller.integration_version or str(self.config_entry.version), + "sw_version": str(version), } diff --git a/custom_components/boiler_controller/select.py b/custom_components/boiler_controller/select.py index fe5c7db..2a40afc 100644 --- a/custom_components/boiler_controller/select.py +++ b/custom_components/boiler_controller/select.py @@ -81,10 +81,12 @@ def available(self) -> bool: @property def device_info(self): + from .const import VERSION as DEFAULT_VERSION + version = self.controller.integration_version if self.controller.integration_version else DEFAULT_VERSION return { "identifiers": {(DOMAIN, self.config_entry.entry_id)}, "name": self.config_entry.title, "manufacturer": "Boiler Controller", "model": "P1 to Shelly Controller", - "sw_version": self.controller.integration_version or str(self.config_entry.version), + "sw_version": str(version), } diff --git a/custom_components/boiler_controller/sensor.py b/custom_components/boiler_controller/sensor.py index 31f9bd7..64efe54 100644 --- a/custom_components/boiler_controller/sensor.py +++ b/custom_components/boiler_controller/sensor.py @@ -38,13 +38,15 @@ UNIT_TEMP = "°C" UNIT_ENERGY = "kWh" -from .const import DOMAIN +from .const import DOMAIN, VERSION _LOGGER = logging.getLogger(__name__) def _integration_version(controller, config_entry: ConfigEntry) -> str: - return controller.integration_version or str(config_entry.version) + from .const import VERSION as DEFAULT_VERSION + version = controller.integration_version if controller.integration_version else DEFAULT_VERSION + return str(version) def _device_info(config_entry: ConfigEntry, controller) -> Dict[str, Any]: diff --git a/custom_components/boiler_controller/translations/en.json b/custom_components/boiler_controller/translations/en.json index 4c64189..7b33a23 100644 --- a/custom_components/boiler_controller/translations/en.json +++ b/custom_components/boiler_controller/translations/en.json @@ -17,7 +17,7 @@ }, "shelly_config": { "title": "Configure Shelly Device", - "description": "Enter the Shelly URL or IP address. If you started this flow from a discovered device we will pre-fill the field for you (e.g. http://shelly0110dimg3-xxxx.local or http://shellyplusdimg3-xxxx.local).", + "description": "Enter the Shelly URL or IP address. If you started this flow from a discovered device we will pre-fill the field for you (e.g. {example_url1} or {example_url2}).", "data": { "shelly_url": "Shelly Base URL" } diff --git a/custom_components/boiler_controller/translations/nl.json b/custom_components/boiler_controller/translations/nl.json index 003bc96..eab4344 100644 --- a/custom_components/boiler_controller/translations/nl.json +++ b/custom_components/boiler_controller/translations/nl.json @@ -17,7 +17,7 @@ }, "shelly_config": { "title": "Shelly Configureren", - "description": "Vul de Shelly RPC basis URL in. Startte je deze flow vanuit een gevonden apparaat? Dan vullen we dit veld alvast voor je in (bijv. http://shelly0110dimg3-xxxx.local of http://shellyplusdimg3-xxxx.local).", + "description": "Vul de Shelly URL of IP adres in. Startte je deze flow vanuit een gevonden apparaat? Dan vullen we dit veld alvast voor je in (bijv. {example_url1} of {example_url2}).", "data": { "shelly_url": "Shelly Basis URL" }