Skip to content

Commit

Permalink
support NightlyBuilds on version check
Browse files Browse the repository at this point in the history
  • Loading branch information
marq24 committed Feb 21, 2025
1 parent 1d393e1 commit aafe1d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions custom_components/evcc_intg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ async def read_evcc_config_on_startup(self, hass: HomeAssistant):
if self._currency == "EUR":
self._currency = "€"

_version_info = None
if Tag.VERSION.key in initdata:
_version_info = initdata[Tag.VERSION.key]
# we need to check for possible NightlyBuild tags in the Version key
if " (" in _version_info:
_version_info = _version_info.split(" (")[0].strip()

# here we have an issue, when there is no grid data
# available (or is no object) at system start....
if "grid" in initdata and initdata["grid"] is not None and isinstance(initdata["grid"], (dict, list)):
Expand All @@ -233,14 +240,14 @@ async def read_evcc_config_on_startup(self, hass: HomeAssistant):
"energy" in initdata["grid"] or
"powers" in initdata["grid"] ):
self._grid_data_as_object = True
elif Tag.VERSION.key in initdata:
if Version(initdata[Tag.VERSION.key]) >= Version("0.133.0"):
elif _version_info is not None:
if Version(_version_info) >= Version("0.133.0"):
self._grid_data_as_object = True

# enable the additional tariff endpoints...
if Tag.VERSION.key in initdata:
_LOGGER.debug(f"check for tariff endpoints... {initdata[Tag.VERSION.key]} - {Version(initdata[Tag.VERSION.key]) >= Version("0.200.0")}")
if Version(initdata[Tag.VERSION.key]) >= Version("0.200.0"):
if _version_info is not None:
_LOGGER.debug(f"check for tariff endpoints... {_version_info} - {Version(_version_info) >= Version("0.200.0")} - {initdata[Tag.VERSION.key]}")
if Version(_version_info) >= Version("0.200.0"):
request_tariff_keys = []

# we must check, if the tariff entities are enabled...
Expand Down
2 changes: 1 addition & 1 deletion custom_components/evcc_intg/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/marq24/ha-evcc/issues",
"requirements": [],
"version": "2025.2.2"
"version": "2025.2.3"
}

0 comments on commit aafe1d4

Please # to comment.