Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions custom_components/boiler_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions custom_components/boiler_controller/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .const import (
DOMAIN,
VERSION,
CALIBRATION_START_PERCENTAGE,
CALIBRATION_END_PERCENTAGE,
CALIBRATION_STEP_PERCENTAGE,
Expand All @@ -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),
}


Expand Down
10 changes: 9 additions & 1 deletion custom_components/boiler_controller/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/boiler_controller/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOMAIN = "boiler_controller"
VERSION = "0.1.0"
VERSION = "1.0.0"

PLATFORMS = ["sensor", "select", "number", "button"]

Expand Down
4 changes: 3 additions & 1 deletion custom_components/boiler_controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/boiler_controller/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
4 changes: 3 additions & 1 deletion custom_components/boiler_controller/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
4 changes: 3 additions & 1 deletion custom_components/boiler_controller/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
6 changes: 4 additions & 2 deletions custom_components/boiler_controller/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/boiler_controller/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion custom_components/boiler_controller/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down