mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
feat(entity): expose integration version as sw_version in device info
Read the version field from manifest.json at import time via a new INTEGRATION_VERSION constant in const.py. Pass it as sw_version to DeviceInfo in TibberPricesEntity so the current integration version is visible in the HA device registry. Impact: Device page in HA now shows the installed integration version under firmware/software version.
This commit is contained in:
parent
e01cc5d447
commit
2d2873f75f
2 changed files with 5 additions and 1 deletions
|
|
@ -20,6 +20,9 @@ if TYPE_CHECKING:
|
|||
DOMAIN = "tibber_prices"
|
||||
LOGGER = logging.getLogger(__package__)
|
||||
|
||||
# Integration version from manifest.json (used for DeviceInfo sw_version)
|
||||
INTEGRATION_VERSION: str = json.loads((Path(__file__).parent / "manifest.json").read_text(encoding="utf-8"))["version"]
|
||||
|
||||
# Data storage keys
|
||||
DATA_CHART_CONFIG = "chart_config" # Key for chart export config in hass.data
|
||||
DATA_CHART_METADATA_CONFIG = "chart_metadata_config" # Key for chart metadata config in hass.data
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import ATTRIBUTION, DOMAIN, get_home_type_translation, get_translation
|
||||
from .const import ATTRIBUTION, DOMAIN, INTEGRATION_VERSION, get_home_type_translation, get_translation
|
||||
from .coordinator import TibberPricesDataUpdateCoordinator
|
||||
|
||||
|
||||
|
|
@ -41,6 +41,7 @@ class TibberPricesEntity(CoordinatorEntity[TibberPricesDataUpdateCoordinator]):
|
|||
manufacturer="Tibber",
|
||||
model=translated_model,
|
||||
serial_number=home_id or None,
|
||||
sw_version=INTEGRATION_VERSION,
|
||||
configuration_url="https://developer.tibber.com/explorer",
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue