Fix translation of status binary sensor in PI-Hole (#90719)

pull/90725/head
Michael 2023-04-03 16:38:54 +02:00 committed by GitHub
parent 4456557a02
commit aeeadb570a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -122,10 +122,6 @@ class PiHoleBinarySensor(PiHoleEntity, BinarySensorEntity):
"""Initialize a Pi-hole sensor.""" """Initialize a Pi-hole sensor."""
super().__init__(api, coordinator, name, server_unique_id) super().__init__(api, coordinator, name, server_unique_id)
self.entity_description = description self.entity_description = description
if description.key == "status":
self._attr_has_entity_name = False
self._attr_name = f"{name}"
self._attr_unique_id = f"{self._server_unique_id}/{description.key}" self._attr_unique_id = f"{self._server_unique_id}/{description.key}"
@property @property

View File

@ -71,8 +71,8 @@ async def test_setup_with_defaults(hass: HomeAssistant) -> None:
assert state.name == "Pi-Hole Seen clients" assert state.name == "Pi-Hole Seen clients"
assert state.state == "0" assert state.state == "0"
state = hass.states.get("binary_sensor.pi_hole") state = hass.states.get("binary_sensor.pi_hole_status")
assert state.name == "Pi-Hole" assert state.name == "Pi-Hole Status"
assert state.state == "off" assert state.state == "off"