Skip to content

Commit 2991ce8

Browse files
committed
Correct naming and injection
1 parent 46c2cd6 commit 2991ce8

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

custom_components/stromer/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
7676
config_entry_id=entry.entry_id,
7777
identifiers={(DOMAIN, str(stromer.bike_id))},
7878
manufacturer="Stromer",
79-
name=f"{stromer.bike_name}",
80-
model=f"{stromer.bike_model}",
79+
name=stromer.bike_name,
80+
model=stromer.bike_model,
8181
)
8282

8383
# Remove non-existing via device
8484
device_registry.async_update_device(
8585
device.id,
86-
via_device_id=None
86+
name=stromer.bike_name,
87+
model=stromer.bike_model,
88+
via_device_id=None,
8789
)
8890

8991
# Set up platforms (i.e. sensors, binary_sensors)

custom_components/stromer/coordinator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async def _async_update_data(self) -> StromerData:
3535
self.stromer.position["rcvts_pos"] = self.stromer.position.pop("rcvts")
3636

3737
bike_data = self.stromer.bike
38+
bike_data.update({"bike_model": self.stromer.bike_model, "bike_name": self.stromer.bike_name})
3839
bike_data.update(self.stromer.status)
3940
bike_data.update(self.stromer.position)
4041

custom_components/stromer/entity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def __init__(
3131
configuration_url=configuration_url,
3232
identifiers={(DOMAIN, str(coordinator.data.bike_id))},
3333
manufacturer="Stromer",
34-
model=data.get("bikemodel"),
35-
name=data.get("nickname"),
34+
model=data.get("bike_model"),
35+
name=data.get("bike_name"),
3636
sw_version=data.get("suiversion"),
3737
hw_version=data.get("tntversion"),
3838
)
3939

4040
self._attr_device_info.update(
4141
{
42-
ATTR_NAME: data.get("nickname"),
42+
ATTR_NAME: data.get("bike_name"),
4343
ATTR_VIA_DEVICE: None,
4444
}
4545
)

0 commit comments

Comments
 (0)