Skip to content

Commit

Permalink
- don't include loadpoint name in entity names, if only one loadpoint…
Browse files Browse the repository at this point in the history
… is configured in evcc

- code cleanup
  • Loading branch information
marq24 committed May 21, 2024
1 parent ecbfa8a commit 052b8fa
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 826 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Please note, that some of the available sensors are __not__ enabled by default.

Please see the separate document where you can find examples [how to provide your evcc instance with HA sensor data](https://github.com/marq24/ha-evcc/blob/main/HA_AS_EVCC_SOURCE.md).

## Are you are go-eCharger V3 or higher User?
## Are you are go-eCharger V3 (or higher) User?

Do you know, that as owners of a go-eCharger (V3+) there is no need to use evcc for solar surplus charging? Even without any additional hardware! Home Assistant and the __go-eCharger APIv2 Connect__ Integration is all you need. Get all details from [https://github.com/marq24/ha-goecharger-api2](https://github.com/marq24/ha-goecharger-api2).

Expand Down
8 changes: 4 additions & 4 deletions custom_components/evcc_intg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ async def read_evcc_config_on_startup(self):
# c) load point configuration (like 1/3 phase options)

initdata = await self.bridge.read_all_data()
if "version" in initdata:
self._version = initdata["version"]
elif "availableVersion" in initdata:
self._version = initdata["availableVersion"]
if Tag.VERSION.key in initdata:
self._version = initdata[Tag.VERSION.key]
elif Tag.AVAILABLEVERSION.key in initdata:
self._version = initdata[Tag.AVAILABLEVERSION.key]

self._device_info_dict = {
"identifiers": {
Expand Down
3 changes: 2 additions & 1 deletion custom_components/evcc_intg/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, add_
entity = EvccBinarySensor(coordinator, description)
entities.append(entity)

multi_loadpoint_config = len(coordinator._loadpoint) > 1
for a_lp_key in coordinator._loadpoint:
load_point_config = coordinator._loadpoint[a_lp_key]
lp_api_index = int(a_lp_key)
Expand All @@ -33,7 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, add_
idx=lp_api_index,
key=f"{a_stub.tag.key}_{lp_api_index}_{lp_id_addon}",
translation_key=a_stub.tag.key,
name_addon=lp_name_addon,
name_addon=lp_name_addon if multi_loadpoint_config else None,
icon=a_stub.icon,
device_class=a_stub.device_class,
unit_of_measurement=a_stub.unit_of_measurement,
Expand Down
3 changes: 2 additions & 1 deletion custom_components/evcc_intg/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, add_
entity = EvccButton(coordinator, description)
entities.append(entity)

multi_loadpoint_config = len(coordinator._loadpoint) > 1
for a_lp_key in coordinator._loadpoint:
load_point_config = coordinator._loadpoint[a_lp_key]
lp_api_index = int(a_lp_key)
Expand All @@ -32,7 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, add_
idx=lp_api_index,
key=f"{a_stub.tag.key}_{lp_api_index}_{lp_id_addon}",
translation_key=a_stub.tag.key,
name_addon=lp_name_addon,
name_addon=lp_name_addon if multi_loadpoint_config else None,
icon=a_stub.icon,
device_class=a_stub.device_class,
unit_of_measurement=a_stub.unit_of_measurement,
Expand Down
Loading

0 comments on commit 052b8fa

Please sign in to comment.