Skip to content

Commit

Permalink
removed 'local' reading of manifest.json
Browse files Browse the repository at this point in the history
+fix-it
  • Loading branch information
marq24 committed Jun 6, 2024
1 parent 58a906e commit be6e828
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 21 deletions.
15 changes: 0 additions & 15 deletions custom_components/evcc_intg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import json
import logging
from datetime import datetime, timedelta
from typing import Any
Expand Down Expand Up @@ -52,23 +51,9 @@ async def async_setup(hass: HomeAssistant, config: Config): # pylint: disable=u
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
if DOMAIN not in hass.data:
value = "UNKOWN"
try:
basepath = __file__[:-11]
with open(f"{basepath}manifest.json") as f:
manifest = json.load(f)
value = manifest["version"]
except:
pass
_LOGGER.info(STARTUP_MESSAGE)
hass.data.setdefault(DOMAIN, {"manifest_version": value})

# integration = await loader.async_get_integration(hass, DOMAIN)
# xxx = await translation.async_get_translations(hass, hass.config.language, "entity_component")
# _LOGGER.error(f"-> {inspect.getmembers(xxx)}")
# for platform in PLATFORMS:
# platform = await integration.async_get_platform(platform)
# _LOGGER.error(f"-> {inspect.getmembers(platform)}")

coordinator = EvccDataUpdateCoordinator(hass, config_entry)
await coordinator.async_refresh()
if not coordinator.last_update_success:
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": "2024.6.0"
"version": "2024.6.1"
}
2 changes: 1 addition & 1 deletion custom_components/evcc_intg/pyevcc_ha/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def read_all(self) -> dict:
# 1 hour = 60min * 60sec = 3600 sec
# 5 min = 300 sec
if self._LAST_FULL_STATE_UPDATE_TS + 300 < time():
await self.read_all_data();
await self.read_all_data()
else:
new_data = await self.read_frequent_data()
if new_data is not None:
Expand Down
4 changes: 2 additions & 2 deletions custom_components/evcc_intg/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def check_tag(self, is_last: bool = False):

def _check_min_options(self, new_max_option: str):
min_key = self.entity_id.split('.')[1].replace(Tag.MAXCURRENT.snake_case, Tag.MINCURRENT.snake_case)
_LOGGER.warning(f"CHECK_MIN {min_key} {entities_min_max_dict} {MIN_CURRENT_LIST} {entities_min_max_dict[min_key]}")
#_LOGGER.warning(f"CHECK_MIN {min_key} {entities_min_max_dict} {MIN_CURRENT_LIST} {entities_min_max_dict[min_key]}")
if min_key in entities_min_max_dict:
if new_max_option in MIN_CURRENT_LIST:
entities_min_max_dict[min_key].options = MIN_CURRENT_LIST[:MIN_CURRENT_LIST.index(new_max_option) + 1]
Expand All @@ -122,7 +122,7 @@ def _check_min_options(self, new_max_option: str):

def _check_max_options(self, new_min_option: str):
max_key = self.entity_id.split('.')[1].replace(Tag.MINCURRENT.snake_case, Tag.MAXCURRENT.snake_case)
_LOGGER.warning(f"CHECK_MAX {max_key} {entities_min_max_dict} {MAX_CURRENT_LIST} {entities_min_max_dict[max_key]}")
#_LOGGER.warning(f"CHECK_MAX {max_key} {entities_min_max_dict} {MAX_CURRENT_LIST} {entities_min_max_dict[max_key]}")
if max_key in entities_min_max_dict:
if new_min_option in MAX_CURRENT_LIST:
entities_min_max_dict[max_key].options = MAX_CURRENT_LIST[MAX_CURRENT_LIST.index(new_min_option):]
Expand Down
4 changes: 2 additions & 2 deletions custom_components/evcc_intg/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"detectvehicle": {"name": "Fahrzeugerkennung starten"}
},
"number": {
"limitsoc": {"name": "Standard Ladelimit (SOC"},
"limitsoc": {"name": "Standard Ladelimit (SOC)"},
"limitenergy": {"name": "Standard Ladelimit (Energie)"},
"enablethreshold": {"name": "Schwellwert Aktivierung"},
"disablethreshold": {"name": "Schwellwert Deaktivierung"},
Expand Down Expand Up @@ -246,4 +246,4 @@
"batterydischargecontrol": {"name": "Hausbatterie: Entladesperre"}
}
}
}
}

0 comments on commit be6e828

Please sign in to comment.