mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Remove energy attributes from switch platform in devolo Home Control (#53335)
This commit is contained in:
parent
009f34bfed
commit
ff781583fc
@ -54,25 +54,12 @@ class DevoloSwitch(DevoloDeviceEntity, SwitchEntity):
|
|||||||
self._unique_id
|
self._unique_id
|
||||||
)
|
)
|
||||||
self._is_on: bool = self._binary_switch_property.state
|
self._is_on: bool = self._binary_switch_property.state
|
||||||
self._consumption: float | None
|
|
||||||
|
|
||||||
if hasattr(self._device_instance, "consumption_property"):
|
|
||||||
self._consumption = self._device_instance.consumption_property.get(
|
|
||||||
self._unique_id.replace("BinarySwitch", "Meter")
|
|
||||||
).current
|
|
||||||
else:
|
|
||||||
self._consumption = None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return the state."""
|
"""Return the state."""
|
||||||
return self._is_on
|
return self._is_on
|
||||||
|
|
||||||
@property
|
|
||||||
def current_power_w(self) -> float | None:
|
|
||||||
"""Return the current consumption."""
|
|
||||||
return self._consumption
|
|
||||||
|
|
||||||
def turn_on(self, **kwargs: Any) -> None:
|
def turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Switch on the device."""
|
"""Switch on the device."""
|
||||||
self._is_on = True
|
self._is_on = True
|
||||||
@ -87,10 +74,6 @@ class DevoloSwitch(DevoloDeviceEntity, SwitchEntity):
|
|||||||
"""Update the binary switch state and consumption."""
|
"""Update the binary switch state and consumption."""
|
||||||
if message[0].startswith("devolo.BinarySwitch"):
|
if message[0].startswith("devolo.BinarySwitch"):
|
||||||
self._is_on = self._device_instance.binary_switch_property[message[0]].state
|
self._is_on = self._device_instance.binary_switch_property[message[0]].state
|
||||||
elif message[0].startswith("devolo.Meter"):
|
|
||||||
self._consumption = self._device_instance.consumption_property[
|
|
||||||
message[0]
|
|
||||||
].current
|
|
||||||
else:
|
else:
|
||||||
self._generic_message(message)
|
self._generic_message(message)
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user