Fix smart energy polling for Tuya plugs (#74640)
* Add PolledSmartEnergySummation to poll summation_delivered for some ZHA plugs * Remove PolledSmartEnergyMetering, add stop_on_match_group to summation sensors
This commit is contained in:
parent
ac85a3ce64
commit
b9b6ed33ee
1 changed files with 20 additions and 17 deletions
|
@ -472,25 +472,8 @@ class SmartEnergyMetering(Sensor):
|
|||
|
||||
@MULTI_MATCH(
|
||||
channel_names=CHANNEL_SMARTENERGY_METERING,
|
||||
models={"TS011F"},
|
||||
stop_on_match_group=CHANNEL_SMARTENERGY_METERING,
|
||||
)
|
||||
class PolledSmartEnergyMetering(SmartEnergyMetering):
|
||||
"""Polled metering sensor."""
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Poll the entity for current state."""
|
||||
return True
|
||||
|
||||
async def async_update(self) -> None:
|
||||
"""Retrieve latest state."""
|
||||
if not self.available:
|
||||
return
|
||||
await self._channel.async_force_update()
|
||||
|
||||
|
||||
@MULTI_MATCH(channel_names=CHANNEL_SMARTENERGY_METERING)
|
||||
class SmartEnergySummation(SmartEnergyMetering, id_suffix="summation_delivered"):
|
||||
"""Smart Energy Metering summation sensor."""
|
||||
|
||||
|
@ -523,6 +506,26 @@ class SmartEnergySummation(SmartEnergyMetering, id_suffix="summation_delivered")
|
|||
return round(cooked, 3)
|
||||
|
||||
|
||||
@MULTI_MATCH(
|
||||
channel_names=CHANNEL_SMARTENERGY_METERING,
|
||||
models={"TS011F"},
|
||||
stop_on_match_group=CHANNEL_SMARTENERGY_METERING,
|
||||
)
|
||||
class PolledSmartEnergySummation(SmartEnergySummation):
|
||||
"""Polled Smart Energy Metering summation sensor."""
|
||||
|
||||
@property
|
||||
def should_poll(self) -> bool:
|
||||
"""Poll the entity for current state."""
|
||||
return True
|
||||
|
||||
async def async_update(self) -> None:
|
||||
"""Retrieve latest state."""
|
||||
if not self.available:
|
||||
return
|
||||
await self._channel.async_force_update()
|
||||
|
||||
|
||||
@MULTI_MATCH(channel_names=CHANNEL_PRESSURE)
|
||||
class Pressure(Sensor):
|
||||
"""Pressure sensor."""
|
||||
|
|
Loading…
Add table
Reference in a new issue