mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Use shorthand attributes in Mutesync (#99600)
This commit is contained in:
parent
799d0e591c
commit
29664d04d0
@ -36,24 +36,17 @@ class MuteStatus(update_coordinator.CoordinatorEntity, BinarySensorEntity):
|
|||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
self._sensor_type = sensor_type
|
self._sensor_type = sensor_type
|
||||||
self._attr_translation_key = sensor_type
|
self._attr_translation_key = sensor_type
|
||||||
|
user_id = coordinator.data["user-id"]
|
||||||
@property
|
self._attr_unique_id = f"{user_id}-{sensor_type}"
|
||||||
def unique_id(self):
|
self._attr_device_info = DeviceInfo(
|
||||||
"""Return the unique ID of the sensor."""
|
entry_type=DeviceEntryType.SERVICE,
|
||||||
return f"{self.coordinator.data['user-id']}-{self._sensor_type}"
|
identifiers={(DOMAIN, user_id)},
|
||||||
|
manufacturer="mütesync",
|
||||||
|
model="mutesync app",
|
||||||
|
name="mutesync",
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self.coordinator.data[self._sensor_type]
|
return self.coordinator.data[self._sensor_type]
|
||||||
|
|
||||||
@property
|
|
||||||
def device_info(self) -> DeviceInfo:
|
|
||||||
"""Return the device info of the sensor."""
|
|
||||||
return DeviceInfo(
|
|
||||||
entry_type=DeviceEntryType.SERVICE,
|
|
||||||
identifiers={(DOMAIN, self.coordinator.data["user-id"])},
|
|
||||||
manufacturer="mütesync",
|
|
||||||
model="mutesync app",
|
|
||||||
name="mutesync",
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user