mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix post update hook for iot child devices (#1011)
`_post_update_hook` not being called on child `iot` devices, causing missing emeter features for children
This commit is contained in:
parent
0f5bafaa43
commit
07fa0d7a7b
@ -361,6 +361,9 @@ class IotStripPlug(IotPlug):
|
|||||||
Needed for properties that are decorated with `requires_update`.
|
Needed for properties that are decorated with `requires_update`.
|
||||||
"""
|
"""
|
||||||
await self._modular_update({})
|
await self._modular_update({})
|
||||||
|
for module in self._modules.values():
|
||||||
|
module._post_update_hook()
|
||||||
|
|
||||||
if not self._features:
|
if not self._features:
|
||||||
await self._initialize_features()
|
await self._initialize_features()
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ from datetime import datetime
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from kasa import KasaException
|
from kasa import Device, KasaException, Module
|
||||||
from kasa.iot import IotStrip
|
from kasa.iot import IotStrip
|
||||||
|
|
||||||
from .conftest import handle_turn_on, strip, turn_on
|
from .conftest import handle_turn_on, strip, strip_iot, turn_on
|
||||||
|
|
||||||
|
|
||||||
@strip
|
@strip
|
||||||
@ -147,3 +147,16 @@ def test_children_api(dev):
|
|||||||
first = dev.children[0]
|
first = dev.children[0]
|
||||||
first_by_get_child_device = dev.get_child_device(first.device_id)
|
first_by_get_child_device = dev.get_child_device(first.device_id)
|
||||||
assert first == first_by_get_child_device
|
assert first == first_by_get_child_device
|
||||||
|
|
||||||
|
|
||||||
|
@strip_iot
|
||||||
|
async def test_children_energy(dev: Device):
|
||||||
|
if Module.Energy not in dev.modules:
|
||||||
|
pytest.skip(f"skipping device {dev.model} does not support energy")
|
||||||
|
|
||||||
|
for plug in dev.children:
|
||||||
|
# For now all known strips with energy support these
|
||||||
|
energy = plug.modules[Module.Energy]
|
||||||
|
assert "voltage" in energy._module_features
|
||||||
|
assert "current" in energy._module_features
|
||||||
|
assert "current_consumption" in energy._module_features
|
||||||
|
Loading…
Reference in New Issue
Block a user