Skip to content

Commit

Permalink
const.py, __init__.py: add new API elements MaxCircuit, MaxSumMains, …
Browse files Browse the repository at this point in the history
…LoadBl
  • Loading branch information
dingo35 committed Apr 24, 2024
1 parent 5119ff6 commit a1f8bf2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion custom_components/smartevse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ async def _async_update_data(self) -> dict[str, Any]:
self.response = await self.hass.async_add_executor_job(self.get_data)
try:
self._data["smartevse_fw_version"] = self.response['version']
self._data["smartevse_serialnr"] = self.response['serialnr']
self._data["smartevse_mode"] = self.response['mode']
self._data["smartevse_mode_id"] = self.response['mode_id']
self._data["smartevse_car_connected"] = self.response['car_connected']
Expand Down Expand Up @@ -148,6 +147,13 @@ async def _async_update_data(self) -> dict[str, Any]:
self._data["smartevse_mains_meter"] = self.response['settings']['mains_meter']
except KeyError:
pass
try:
self._data["smartevse_current_max_circuit"] = self.response['settings']['current_max_circuit']
self._data["smartevse_current_max_sum_mains"] = self.response['settings']['current_max_sum_mains']
self._data["smartevse_loadbl"] = self.response['evse']['loadbl']
self._data["smartevse_serialnr"] = self.response['serialnr']
except KeyError:
pass
try:
self._data["smartevse_home_battery_current"] = self.response['home_battery']['current'] / 10
self._data["smartevse_home_battery_last_update"] = self.response['home_battery']['last_update']
Expand Down
16 changes: 16 additions & 0 deletions custom_components/smartevse/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,22 @@
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_current_max_circuit",
name="SmartEVSE Current MaxCircuit",
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_current_max_sum_mains",
name="SmartEVSE Current MaxSumMains",
unit=UnitOfElectricCurrent.AMPERE,
device_class=SensorDeviceClass.CURRENT,
),
SmartEVSESensorEntityDescription(
key="smartevse_loadbl",
name="SmartEVSE LoadBl",
),
SmartEVSESensorEntityDescription(
key="smartevse_solar_stop_time",
name="SmartEVSE Solar Stop Time",
Expand Down

0 comments on commit a1f8bf2

Please sign in to comment.