Add tests for Shelly binary_sensor platform (#82367)
* Add tests for Shelly binary_sensor platform * Rename create to register for
This commit is contained in:
parent
e028516939
commit
ea98f0e9e8
6 changed files with 238 additions and 44 deletions
|
@ -268,10 +268,8 @@ class RestBinarySensor(ShellyRestAttributeEntity, BinarySensorEntity):
|
|||
entity_description: RestBinarySensorDescription
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if REST sensor state is on."""
|
||||
if self.attribute_value is None:
|
||||
return None
|
||||
return bool(self.attribute_value)
|
||||
|
||||
|
||||
|
@ -281,10 +279,8 @@ class RpcBinarySensor(ShellyRpcAttributeEntity, BinarySensorEntity):
|
|||
entity_description: RpcBinarySensorDescription
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if RPC sensor state is on."""
|
||||
if self.attribute_value is None:
|
||||
return None
|
||||
return bool(self.attribute_value)
|
||||
|
||||
|
||||
|
@ -308,7 +304,7 @@ class RpcSleepingBinarySensor(ShellySleepingRpcAttributeEntity, BinarySensorEnti
|
|||
entity_description: RpcBinarySensorDescription
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
def is_on(self) -> bool:
|
||||
"""Return true if RPC sensor state is on."""
|
||||
if self.coordinator.device.initialized:
|
||||
return bool(self.attribute_value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue