mirror of
https://github.com/sususweet/midea-meiju-codec.git
synced 2025-09-27 18:22:41 +00:00
feat: refactor code to add more attributes.
This commit is contained in:
@@ -57,18 +57,17 @@ class MideaDeviceStatusSensorEntity(MideaEntity, BinarySensorEntity):
|
||||
device.sn,
|
||||
device.sn8,
|
||||
device.model,
|
||||
entity_key
|
||||
entity_key,
|
||||
device=device,
|
||||
manufacturer=manufacturer,
|
||||
rationale=rationale,
|
||||
config=config,
|
||||
)
|
||||
self._device = device
|
||||
self._manufacturer = manufacturer
|
||||
self._rationale = rationale
|
||||
self._config = config
|
||||
|
||||
@property
|
||||
def entity_id_suffix(self) -> str:
|
||||
"""Return the suffix for entity ID."""
|
||||
return "status"
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the device class."""
|
||||
@@ -102,7 +101,11 @@ class MideaBinarySensorEntity(MideaEntity, BinarySensorEntity):
|
||||
device.sn,
|
||||
device.sn8,
|
||||
device.model,
|
||||
entity_key
|
||||
entity_key,
|
||||
device=device,
|
||||
manufacturer=manufacturer,
|
||||
rationale=rationale,
|
||||
config=config,
|
||||
)
|
||||
self._device = device
|
||||
self._manufacturer = manufacturer
|
||||
@@ -110,11 +113,6 @@ class MideaBinarySensorEntity(MideaEntity, BinarySensorEntity):
|
||||
self._entity_key = entity_key
|
||||
self._config = config
|
||||
|
||||
@property
|
||||
def entity_id_suffix(self) -> str:
|
||||
"""Return the suffix for entity ID."""
|
||||
return f"binary_sensor_{self._entity_key}"
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return if the binary sensor is on."""
|
||||
|
Reference in New Issue
Block a user