mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Parse features only during updates (#527)
Every time emeter functions were called features had to be re-parsed. For power strips, thats a lot of re-parses. Only parse them when we update.
This commit is contained in:
@@ -37,6 +37,7 @@ async def test_invalid_connection(dev):
|
||||
async def test_initial_update_emeter(dev, mocker):
|
||||
"""Test that the initial update performs second query if emeter is available."""
|
||||
dev._last_update = None
|
||||
dev._features = set()
|
||||
spy = mocker.spy(dev.protocol, "query")
|
||||
await dev.update()
|
||||
# Devices with small buffers may require 3 queries
|
||||
@@ -48,6 +49,7 @@ async def test_initial_update_emeter(dev, mocker):
|
||||
async def test_initial_update_no_emeter(dev, mocker):
|
||||
"""Test that the initial update performs second query if emeter is available."""
|
||||
dev._last_update = None
|
||||
dev._features = set()
|
||||
spy = mocker.spy(dev.protocol, "query")
|
||||
await dev.update()
|
||||
# 2 calls are necessary as some devices crash on unexpected modules
|
||||
|
Reference in New Issue
Block a user