python-kasa 0.7.0.3__tar.gz → 0.7.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/CHANGELOG.md +12 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/PKG-INFO +1 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/aestransport.py +12 -2
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/exceptions.py +2 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/httpclient.py +19 -4
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/cloud.py +1 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/firmware.py +4 -8
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/led.py +4 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/lighteffect.py +4 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/lightpreset.py +3 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/lightstripeffect.py +3 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/lighttransition.py +5 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/temperaturecontrol.py +22 -21
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/smartchilddevice.py +2 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/smartdevice.py +117 -24
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/smartmodule.py +28 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smartprotocol.py +34 -10
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_temperaturecontrol.py +9 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_smartdevice.py +125 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_smartprotocol.py +1 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/pyproject.toml +1 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/LICENSE +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/README.md +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/cli.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/credentials.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/device.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/device_factory.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/device_type.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/deviceconfig.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/discover.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/emeterstatus.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/feature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/energy.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/led.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/lighteffect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/interfaces/lightpreset.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/effects.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotbulb.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotdimmer.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotlightstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotmodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotplug.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/iotstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/ambientlight.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/antitheft.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/cloud.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/countdown.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/emeter.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/led.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/lighteffect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/lightpreset.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/motion.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/rulemodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/schedule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/time.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iot/modules/usage.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/iotprotocol.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/json.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/klaptransport.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/module.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/modulemapping.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/modulemapping.pyi +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/protocol.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/py.typed +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/effects.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/alarm.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/autooff.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/batterysensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/brightness.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/childdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/color.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/colortemperature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/contactsensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/devicemodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/energy.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/frostprotection.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/humiditysensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/reportmode.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/temperaturesensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/time.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/smart/modules/waterleaksensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/conftest.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/device_fixtures.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/discovery_fixtures.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fakeprotocol_iot.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fakeprotocol_smart.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtureinfo.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/EP10(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/EP40(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS100(US)_1.0_1.2.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS100(US)_2.0_1.5.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS103(US)_1.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS103(US)_2.1_1.1.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS103(US)_2.1_1.1.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS105(US)_1.0_1.5.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS107(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS110(EU)_4.0_1.0.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS110(US)_1.0_1.2.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS200(US)_2.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS200(US)_5.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS210(US)_1.0_1.5.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS300(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS300(US)_1.0_1.0.21.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/HS300(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL110(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL120(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL120(US)_1.0_1.8.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL125(US)_1.20_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL125(US)_2.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL130(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL135(US)_1.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL420L5(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL430(UN)_2.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL430(US)_2.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL430(US)_2.0_1.0.9.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL50(US)_1.0_1.1.13.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL60(UN)_1.0_1.1.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KL60(US)_1.0_1.1.13.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP100(US)_3.0_1.0.1.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP115(EU)_1.0_1.0.16.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP115(US)_1.0_1.0.17.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP125(US)_1.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP200(US)_3.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP303(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP400(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP400(US)_2.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP401(US)_1.0_1.0.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KP405(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KS200M(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KS220M(US)_1.0_1.0.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/KS230(US)_1.0_1.0.14.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/LB110(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.1.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.2.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KH100(UK)_1.0_1.5.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KP125M(US)_1.0_1.1.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KS205(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KS225(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L510E(US)_3.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L510E(US)_3.0_1.1.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L900-10(US)_1.0_1.0.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.0.17.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L920-5(EU)_1.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/L930-5(US)_1.0_1.1.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P100_1.0.0_1.1.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P100_1.0.0_1.3.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P100_1.0.0_1.4.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P110(EU)_1.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P110(EU)_1.0_1.2.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P115(EU)_1.0_1.2.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P135(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.13.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.15.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/S500D(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/S505(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/S505D(US)_1.0_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/TP15(US)_1.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/TP25(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.4.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.8.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/KE100(UK)_1.0_2.8.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/T110(EU)_1.0_1.8.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/features/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/features/test_brightness.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/features/test_colortemp.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_autooff.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_contact.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_firmware.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_humidity.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_light_effect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_light_strip_effect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_lighttransition.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_temperature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/smart/modules/test_waterleak.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_aestransport.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_bulb.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_childdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_cli.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_common_modules.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_device.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_device_factory.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_device_type.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_deviceconfig.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_dimmer.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_discovery.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_emeter.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_feature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_httpclient.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_iotdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_klapprotocol.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_lightstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_plug.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_protocol.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_readme_examples.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_strip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/tests/test_usage.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.4}/kasa/xortransport.py +0 -0
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0.4](https://github.com/python-kasa/python-kasa/tree/0.7.0.4) (2024-07-011)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.3...0.7.0.4)
|
|
6
|
+
|
|
7
|
+
Critical bugfixes for issues with P100s and thermostats.
|
|
8
|
+
|
|
9
|
+
**Fixed bugs:**
|
|
10
|
+
|
|
11
|
+
- Use first known thermostat state as main state (pick #1054) [\#1057](https://github.com/python-kasa/python-kasa/pull/1057)
|
|
12
|
+
- Defer module updates for less volatile modules (pick 1052) [\#1056](https://github.com/python-kasa/python-kasa/pull/1056)
|
|
13
|
+
|
|
3
14
|
## [0.7.0.3](https://github.com/python-kasa/python-kasa/tree/0.7.0.3) (2024-07-04)
|
|
4
15
|
|
|
5
16
|
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.2...0.7.0.3)
|
|
@@ -9,7 +20,7 @@ Partially fixes light preset module errors with L920 and L930.
|
|
|
9
20
|
|
|
10
21
|
**Fixed bugs:**
|
|
11
22
|
|
|
12
|
-
Handle module errors more robustly and add query params to light preset and transition [\#1043](https://github.com/python-kasa/python-kasa/pull/1043)
|
|
23
|
+
- Handle module errors more robustly and add query params to light preset and transition [\#1043](https://github.com/python-kasa/python-kasa/pull/1043)
|
|
13
24
|
|
|
14
25
|
## [0.7.0.2](https://github.com/python-kasa/python-kasa/tree/0.7.0.2) (2024-07-01)
|
|
15
26
|
|
|
@@ -144,7 +144,9 @@ class AesTransport(BaseTransport):
|
|
|
144
144
|
try:
|
|
145
145
|
error_code = SmartErrorCode.from_int(error_code_raw)
|
|
146
146
|
except ValueError:
|
|
147
|
-
_LOGGER.warning(
|
|
147
|
+
_LOGGER.warning(
|
|
148
|
+
"Device %s received unknown error code: %s", self._host, error_code_raw
|
|
149
|
+
)
|
|
148
150
|
error_code = SmartErrorCode.INTERNAL_UNKNOWN_ERROR
|
|
149
151
|
if error_code is SmartErrorCode.SUCCESS:
|
|
150
152
|
return
|
|
@@ -214,10 +216,18 @@ class AesTransport(BaseTransport):
|
|
|
214
216
|
"""Login to the device."""
|
|
215
217
|
try:
|
|
216
218
|
await self.try_login(self._login_params)
|
|
219
|
+
_LOGGER.debug(
|
|
220
|
+
"%s: logged in with provided credentials",
|
|
221
|
+
self._host,
|
|
222
|
+
)
|
|
217
223
|
except AuthenticationError as aex:
|
|
218
224
|
try:
|
|
219
225
|
if aex.error_code is not SmartErrorCode.LOGIN_ERROR:
|
|
220
226
|
raise aex
|
|
227
|
+
_LOGGER.debug(
|
|
228
|
+
"%s: trying login with default TAPO credentials",
|
|
229
|
+
self._host,
|
|
230
|
+
)
|
|
221
231
|
if self._default_credentials is None:
|
|
222
232
|
self._default_credentials = get_default_credentials(
|
|
223
233
|
DEFAULT_CREDENTIALS["TAPO"]
|
|
@@ -225,7 +235,7 @@ class AesTransport(BaseTransport):
|
|
|
225
235
|
await self.perform_handshake()
|
|
226
236
|
await self.try_login(self._get_login_params(self._default_credentials))
|
|
227
237
|
_LOGGER.debug(
|
|
228
|
-
"%s: logged in with default credentials",
|
|
238
|
+
"%s: logged in with default TAPO credentials",
|
|
229
239
|
self._host,
|
|
230
240
|
)
|
|
231
241
|
except (AuthenticationError, _ConnectionError, TimeoutError):
|
|
@@ -75,13 +75,21 @@ class HttpClient:
|
|
|
75
75
|
now = time.time()
|
|
76
76
|
gap = now - self._last_request_time
|
|
77
77
|
if gap < self._wait_between_requests:
|
|
78
|
-
|
|
78
|
+
sleep = self._wait_between_requests - gap
|
|
79
|
+
_LOGGER.debug(
|
|
80
|
+
"Device %s waiting %s seconds to send request",
|
|
81
|
+
self._config.host,
|
|
82
|
+
sleep,
|
|
83
|
+
)
|
|
84
|
+
await asyncio.sleep(sleep)
|
|
79
85
|
|
|
80
86
|
_LOGGER.debug("Posting to %s", url)
|
|
81
87
|
response_data = None
|
|
82
88
|
self._last_url = url
|
|
83
89
|
self.client.cookie_jar.clear()
|
|
84
90
|
return_json = bool(json)
|
|
91
|
+
client_timeout = aiohttp.ClientTimeout(total=self._config.timeout)
|
|
92
|
+
|
|
85
93
|
# If json is not a dict send as data.
|
|
86
94
|
# This allows the json parameter to be used to pass other
|
|
87
95
|
# types of data such as async_generator and still have json
|
|
@@ -95,9 +103,10 @@ class HttpClient:
|
|
|
95
103
|
params=params,
|
|
96
104
|
data=data,
|
|
97
105
|
json=json,
|
|
98
|
-
timeout=
|
|
106
|
+
timeout=client_timeout,
|
|
99
107
|
cookies=cookies_dict,
|
|
100
108
|
headers=headers,
|
|
109
|
+
ssl=False,
|
|
101
110
|
)
|
|
102
111
|
async with resp:
|
|
103
112
|
if resp.status == 200:
|
|
@@ -106,9 +115,15 @@ class HttpClient:
|
|
|
106
115
|
response_data = json_loads(response_data.decode())
|
|
107
116
|
|
|
108
117
|
except (aiohttp.ServerDisconnectedError, aiohttp.ClientOSError) as ex:
|
|
109
|
-
if
|
|
118
|
+
if not self._wait_between_requests:
|
|
119
|
+
_LOGGER.debug(
|
|
120
|
+
"Device %s received an os error, "
|
|
121
|
+
"enabling sequential request delay: %s",
|
|
122
|
+
self._config.host,
|
|
123
|
+
ex,
|
|
124
|
+
)
|
|
110
125
|
self._wait_between_requests = self.WAIT_BETWEEN_REQUESTS_ON_OSERROR
|
|
111
|
-
|
|
126
|
+
self._last_request_time = time.time()
|
|
112
127
|
raise _ConnectionError(
|
|
113
128
|
f"Device connection error: {self._config.host}: {ex}", ex
|
|
114
129
|
) from ex
|
|
@@ -14,7 +14,7 @@ from async_timeout import timeout as asyncio_timeout
|
|
|
14
14
|
from pydantic.v1 import BaseModel, Field, validator
|
|
15
15
|
|
|
16
16
|
from ...feature import Feature
|
|
17
|
-
from ..smartmodule import SmartModule
|
|
17
|
+
from ..smartmodule import SmartModule, allow_update_after
|
|
18
18
|
|
|
19
19
|
if TYPE_CHECKING:
|
|
20
20
|
from ..smartdevice import SmartDevice
|
|
@@ -66,6 +66,7 @@ class Firmware(SmartModule):
|
|
|
66
66
|
"""Implementation of firmware module."""
|
|
67
67
|
|
|
68
68
|
REQUIRED_COMPONENT = "firmware"
|
|
69
|
+
MINIMUM_UPDATE_INTERVAL_SECS = 60 * 60 * 24
|
|
69
70
|
|
|
70
71
|
def __init__(self, device: SmartDevice, module: str):
|
|
71
72
|
super().__init__(device, module)
|
|
@@ -122,13 +123,6 @@ class Firmware(SmartModule):
|
|
|
122
123
|
req["get_auto_update_info"] = None
|
|
123
124
|
return req
|
|
124
125
|
|
|
125
|
-
def _post_update_hook(self):
|
|
126
|
-
"""Perform actions after a device update.
|
|
127
|
-
|
|
128
|
-
Overrides the default behaviour to disable a module if the query returns
|
|
129
|
-
an error because some of the module still functions.
|
|
130
|
-
"""
|
|
131
|
-
|
|
132
126
|
@property
|
|
133
127
|
def current_firmware(self) -> str:
|
|
134
128
|
"""Return the current firmware version."""
|
|
@@ -162,6 +156,7 @@ class Firmware(SmartModule):
|
|
|
162
156
|
state = resp["get_fw_download_state"]
|
|
163
157
|
return DownloadState(**state)
|
|
164
158
|
|
|
159
|
+
@allow_update_after
|
|
165
160
|
async def update(
|
|
166
161
|
self, progress_cb: Callable[[DownloadState], Coroutine] | None = None
|
|
167
162
|
):
|
|
@@ -219,6 +214,7 @@ class Firmware(SmartModule):
|
|
|
219
214
|
and self.data["get_auto_update_info"]["enable"]
|
|
220
215
|
)
|
|
221
216
|
|
|
217
|
+
@allow_update_after
|
|
222
218
|
async def set_auto_update_enabled(self, enabled: bool):
|
|
223
219
|
"""Change autoupdate setting."""
|
|
224
220
|
data = {**self.data["get_auto_update_info"], "enable": enabled}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from ...interfaces.led import Led as LedInterface
|
|
6
|
-
from ..smartmodule import SmartModule
|
|
6
|
+
from ..smartmodule import SmartModule, allow_update_after
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class Led(SmartModule, LedInterface):
|
|
@@ -11,6 +11,8 @@ class Led(SmartModule, LedInterface):
|
|
|
11
11
|
|
|
12
12
|
REQUIRED_COMPONENT = "led"
|
|
13
13
|
QUERY_GETTER_NAME = "get_led_info"
|
|
14
|
+
# Led queries can cause device to crash on P100
|
|
15
|
+
MINIMUM_UPDATE_INTERVAL_SECS = 60 * 60
|
|
14
16
|
|
|
15
17
|
def query(self) -> dict:
|
|
16
18
|
"""Query to execute during the update cycle."""
|
|
@@ -29,6 +31,7 @@ class Led(SmartModule, LedInterface):
|
|
|
29
31
|
"""Return current led status."""
|
|
30
32
|
return self.data["led_rule"] != "never"
|
|
31
33
|
|
|
34
|
+
@allow_update_after
|
|
32
35
|
async def set_led(self, enable: bool):
|
|
33
36
|
"""Set led.
|
|
34
37
|
|
|
@@ -9,7 +9,7 @@ import copy
|
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
11
|
from ..effects import SmartLightEffect
|
|
12
|
-
from ..smartmodule import Module, SmartModule
|
|
12
|
+
from ..smartmodule import Module, SmartModule, allow_update_after
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class LightEffect(SmartModule, SmartLightEffect):
|
|
@@ -17,6 +17,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
17
17
|
|
|
18
18
|
REQUIRED_COMPONENT = "light_effect"
|
|
19
19
|
QUERY_GETTER_NAME = "get_dynamic_light_effect_rules"
|
|
20
|
+
MINIMUM_UPDATE_INTERVAL_SECS = 60
|
|
20
21
|
AVAILABLE_BULB_EFFECTS = {
|
|
21
22
|
"L1": "Party",
|
|
22
23
|
"L2": "Relax",
|
|
@@ -130,6 +131,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
130
131
|
|
|
131
132
|
return brightness
|
|
132
133
|
|
|
134
|
+
@allow_update_after
|
|
133
135
|
async def set_brightness(
|
|
134
136
|
self,
|
|
135
137
|
brightness: int,
|
|
@@ -156,6 +158,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
156
158
|
|
|
157
159
|
return await self.call("edit_dynamic_light_effect_rule", new_effect)
|
|
158
160
|
|
|
161
|
+
@allow_update_after
|
|
159
162
|
async def set_custom_effect(
|
|
160
163
|
self,
|
|
161
164
|
effect_dict: dict,
|
|
@@ -8,7 +8,7 @@ from typing import TYPE_CHECKING
|
|
|
8
8
|
|
|
9
9
|
from ...interfaces import LightPreset as LightPresetInterface
|
|
10
10
|
from ...interfaces import LightState
|
|
11
|
-
from ..smartmodule import SmartModule
|
|
11
|
+
from ..smartmodule import SmartModule, allow_update_after
|
|
12
12
|
|
|
13
13
|
if TYPE_CHECKING:
|
|
14
14
|
from ..smartdevice import SmartDevice
|
|
@@ -19,6 +19,7 @@ class LightPreset(SmartModule, LightPresetInterface):
|
|
|
19
19
|
|
|
20
20
|
REQUIRED_COMPONENT = "preset"
|
|
21
21
|
QUERY_GETTER_NAME = "get_preset_rules"
|
|
22
|
+
MINIMUM_UPDATE_INTERVAL_SECS = 60
|
|
22
23
|
|
|
23
24
|
SYS_INFO_STATE_KEY = "preset_state"
|
|
24
25
|
|
|
@@ -113,6 +114,7 @@ class LightPreset(SmartModule, LightPresetInterface):
|
|
|
113
114
|
raise ValueError(f"{preset_name} is not a valid preset: {self.preset_list}")
|
|
114
115
|
await self._device.modules[SmartModule.Light].set_state(preset)
|
|
115
116
|
|
|
117
|
+
@allow_update_after
|
|
116
118
|
async def save_preset(
|
|
117
119
|
self,
|
|
118
120
|
preset_name: str,
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from ..effects import EFFECT_MAPPING, EFFECT_NAMES, SmartLightEffect
|
|
8
|
-
from ..smartmodule import Module, SmartModule
|
|
8
|
+
from ..smartmodule import Module, SmartModule, allow_update_after
|
|
9
9
|
|
|
10
10
|
if TYPE_CHECKING:
|
|
11
11
|
from ..smartdevice import SmartDevice
|
|
@@ -84,6 +84,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
|
|
|
84
84
|
"""
|
|
85
85
|
return self._effect_list
|
|
86
86
|
|
|
87
|
+
@allow_update_after
|
|
87
88
|
async def set_effect(
|
|
88
89
|
self,
|
|
89
90
|
effect: str,
|
|
@@ -126,6 +127,7 @@ class LightStripEffect(SmartModule, SmartLightEffect):
|
|
|
126
127
|
|
|
127
128
|
await self.set_custom_effect(effect_dict)
|
|
128
129
|
|
|
130
|
+
@allow_update_after
|
|
129
131
|
async def set_custom_effect(
|
|
130
132
|
self,
|
|
131
133
|
effect_dict: dict,
|
|
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, TypedDict
|
|
|
6
6
|
|
|
7
7
|
from ...exceptions import KasaException
|
|
8
8
|
from ...feature import Feature
|
|
9
|
-
from ..smartmodule import SmartModule
|
|
9
|
+
from ..smartmodule import SmartModule, allow_update_after
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from ..smartdevice import SmartDevice
|
|
@@ -23,6 +23,7 @@ class LightTransition(SmartModule):
|
|
|
23
23
|
|
|
24
24
|
REQUIRED_COMPONENT = "on_off_gradually"
|
|
25
25
|
QUERY_GETTER_NAME = "get_on_off_gradually_info"
|
|
26
|
+
MINIMUM_UPDATE_INTERVAL_SECS = 60
|
|
26
27
|
MAXIMUM_DURATION = 60
|
|
27
28
|
|
|
28
29
|
# Key in sysinfo that indicates state can be retrieved from there.
|
|
@@ -136,6 +137,7 @@ class LightTransition(SmartModule):
|
|
|
136
137
|
"max_duration": off_max,
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
@allow_update_after
|
|
139
141
|
async def set_enabled(self, enable: bool):
|
|
140
142
|
"""Enable gradual on/off."""
|
|
141
143
|
if not self._supports_on_and_off:
|
|
@@ -168,6 +170,7 @@ class LightTransition(SmartModule):
|
|
|
168
170
|
# v3 added max_duration, we default to 60 when it's not available
|
|
169
171
|
return self._on_state["max_duration"]
|
|
170
172
|
|
|
173
|
+
@allow_update_after
|
|
171
174
|
async def set_turn_on_transition(self, seconds: int):
|
|
172
175
|
"""Set turn on transition in seconds.
|
|
173
176
|
|
|
@@ -203,6 +206,7 @@ class LightTransition(SmartModule):
|
|
|
203
206
|
# v3 added max_duration, we default to 60 when it's not available
|
|
204
207
|
return self._off_state["max_duration"]
|
|
205
208
|
|
|
209
|
+
@allow_update_after
|
|
206
210
|
async def set_turn_off_transition(self, seconds: int):
|
|
207
211
|
"""Set turn on transition in seconds.
|
|
208
212
|
|
|
@@ -4,15 +4,10 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
from enum import Enum
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
8
7
|
|
|
9
8
|
from ...feature import Feature
|
|
10
9
|
from ..smartmodule import SmartModule
|
|
11
10
|
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from ..smartdevice import SmartDevice
|
|
14
|
-
|
|
15
|
-
|
|
16
11
|
_LOGGER = logging.getLogger(__name__)
|
|
17
12
|
|
|
18
13
|
|
|
@@ -31,11 +26,11 @@ class TemperatureControl(SmartModule):
|
|
|
31
26
|
|
|
32
27
|
REQUIRED_COMPONENT = "temp_control"
|
|
33
28
|
|
|
34
|
-
def
|
|
35
|
-
|
|
29
|
+
def _initialize_features(self):
|
|
30
|
+
"""Initialize features after the initial update."""
|
|
36
31
|
self._add_feature(
|
|
37
32
|
Feature(
|
|
38
|
-
|
|
33
|
+
self._device,
|
|
39
34
|
id="target_temperature",
|
|
40
35
|
name="Target temperature",
|
|
41
36
|
container=self,
|
|
@@ -50,7 +45,7 @@ class TemperatureControl(SmartModule):
|
|
|
50
45
|
# TODO: this might belong into its own module, temperature_correction?
|
|
51
46
|
self._add_feature(
|
|
52
47
|
Feature(
|
|
53
|
-
|
|
48
|
+
self._device,
|
|
54
49
|
id="temperature_offset",
|
|
55
50
|
name="Temperature offset",
|
|
56
51
|
container=self,
|
|
@@ -65,7 +60,7 @@ class TemperatureControl(SmartModule):
|
|
|
65
60
|
|
|
66
61
|
self._add_feature(
|
|
67
62
|
Feature(
|
|
68
|
-
|
|
63
|
+
self._device,
|
|
69
64
|
id="state",
|
|
70
65
|
name="State",
|
|
71
66
|
container=self,
|
|
@@ -78,7 +73,7 @@ class TemperatureControl(SmartModule):
|
|
|
78
73
|
|
|
79
74
|
self._add_feature(
|
|
80
75
|
Feature(
|
|
81
|
-
|
|
76
|
+
self._device,
|
|
82
77
|
id="thermostat_mode",
|
|
83
78
|
name="Thermostat mode",
|
|
84
79
|
container=self,
|
|
@@ -109,23 +104,24 @@ class TemperatureControl(SmartModule):
|
|
|
109
104
|
if self._device.sys_info.get("frost_protection_on", False):
|
|
110
105
|
return ThermostatState.Off
|
|
111
106
|
|
|
112
|
-
states = self.
|
|
107
|
+
states = self.states
|
|
113
108
|
|
|
114
109
|
# If the states is empty, the device is idling
|
|
115
110
|
if not states:
|
|
116
111
|
return ThermostatState.Idle
|
|
117
112
|
|
|
113
|
+
# Discard known extra states, and report on unknown extra states
|
|
114
|
+
states.discard("low_battery")
|
|
118
115
|
if len(states) > 1:
|
|
119
|
-
_LOGGER.warning(
|
|
120
|
-
"Got multiple states (%s), using the first one: %s", states, states[0]
|
|
121
|
-
)
|
|
116
|
+
_LOGGER.warning("Got multiple states: %s", states)
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
118
|
+
# Return the first known state
|
|
119
|
+
for state in ThermostatState:
|
|
120
|
+
if state.value in states:
|
|
121
|
+
return state
|
|
122
|
+
|
|
123
|
+
_LOGGER.warning("Got unknown state: %s", states)
|
|
124
|
+
return ThermostatState.Unknown
|
|
129
125
|
|
|
130
126
|
@property
|
|
131
127
|
def allowed_temperature_range(self) -> tuple[int, int]:
|
|
@@ -147,6 +143,11 @@ class TemperatureControl(SmartModule):
|
|
|
147
143
|
"""Return target temperature."""
|
|
148
144
|
return self._device.sys_info["target_temp"]
|
|
149
145
|
|
|
146
|
+
@property
|
|
147
|
+
def states(self) -> set:
|
|
148
|
+
"""Return thermostat states."""
|
|
149
|
+
return set(self._device.sys_info["trv_states"])
|
|
150
|
+
|
|
150
151
|
async def set_target_temperature(self, target: float):
|
|
151
152
|
"""Set target temperature."""
|
|
152
153
|
if (
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
|
+
import time
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
8
9
|
from ..device_type import DeviceType
|
|
@@ -46,6 +47,7 @@ class SmartChildDevice(SmartDevice):
|
|
|
46
47
|
req.update(mod_query)
|
|
47
48
|
if req:
|
|
48
49
|
self._last_update = await self.protocol.query(req)
|
|
50
|
+
self._last_update_time = time.time()
|
|
49
51
|
|
|
50
52
|
@classmethod
|
|
51
53
|
async def create(cls, parent: SmartDevice, child_info, child_components):
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import base64
|
|
6
6
|
import logging
|
|
7
|
+
import time
|
|
7
8
|
from collections.abc import Mapping, Sequence
|
|
8
9
|
from datetime import datetime, timedelta, timezone
|
|
9
10
|
from typing import Any, cast
|
|
@@ -18,6 +19,7 @@ from ..module import Module
|
|
|
18
19
|
from ..modulemapping import ModuleMapping, ModuleName
|
|
19
20
|
from ..smartprotocol import SmartProtocol
|
|
20
21
|
from .modules import (
|
|
22
|
+
ChildDevice,
|
|
21
23
|
Cloud,
|
|
22
24
|
DeviceModule,
|
|
23
25
|
Firmware,
|
|
@@ -35,6 +37,9 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
35
37
|
# same issue, homekit perhaps?
|
|
36
38
|
NON_HUB_PARENT_ONLY_MODULES = [DeviceModule, Time, Firmware, Cloud]
|
|
37
39
|
|
|
40
|
+
# Modules that are called as part of the init procedure on first update
|
|
41
|
+
FIRST_UPDATE_MODULES = {DeviceModule, ChildDevice, Cloud}
|
|
42
|
+
|
|
38
43
|
|
|
39
44
|
# Device must go last as the other interfaces also inherit Device
|
|
40
45
|
# and python needs a consistent method resolution order.
|
|
@@ -60,6 +65,7 @@ class SmartDevice(Device):
|
|
|
60
65
|
self._parent: SmartDevice | None = None
|
|
61
66
|
self._children: Mapping[str, SmartDevice] = {}
|
|
62
67
|
self._last_update = {}
|
|
68
|
+
self._last_update_time: float | None = None
|
|
63
69
|
|
|
64
70
|
async def _initialize_children(self):
|
|
65
71
|
"""Initialize children for power strips."""
|
|
@@ -152,19 +158,15 @@ class SmartDevice(Device):
|
|
|
152
158
|
if self.credentials is None and self.credentials_hash is None:
|
|
153
159
|
raise AuthenticationError("Tapo plug requires authentication.")
|
|
154
160
|
|
|
155
|
-
|
|
161
|
+
first_update = self._last_update_time is None
|
|
162
|
+
now = time.time()
|
|
163
|
+
self._last_update_time = now
|
|
164
|
+
|
|
165
|
+
if first_update:
|
|
156
166
|
await self._negotiate()
|
|
157
167
|
await self._initialize_modules()
|
|
158
168
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# TODO: this could be optimized by constructing the query only once
|
|
162
|
-
for module in self._modules.values():
|
|
163
|
-
req.update(module.query())
|
|
164
|
-
|
|
165
|
-
self._last_update = resp = await self.protocol.query(req)
|
|
166
|
-
|
|
167
|
-
self._info = self._try_get_response(resp, "get_device_info")
|
|
169
|
+
resp = await self._modular_update(first_update, now)
|
|
168
170
|
|
|
169
171
|
# Call child update which will only update module calls, info is updated
|
|
170
172
|
# from get_child_device_list. update_children only affects hub devices, other
|
|
@@ -172,18 +174,12 @@ class SmartDevice(Device):
|
|
|
172
174
|
if update_children or self.device_type != DeviceType.Hub:
|
|
173
175
|
for child in self._children.values():
|
|
174
176
|
await child.update()
|
|
175
|
-
if child_info := self._try_get_response(
|
|
177
|
+
if child_info := self._try_get_response(
|
|
178
|
+
self._last_update, "get_child_device_list", {}
|
|
179
|
+
):
|
|
176
180
|
for info in child_info["child_device_list"]:
|
|
177
181
|
self._children[info["device_id"]]._update_internal_state(info)
|
|
178
182
|
|
|
179
|
-
# Call handle update for modules that want to update internal data
|
|
180
|
-
errors = []
|
|
181
|
-
for module_name, module in self._modules.items():
|
|
182
|
-
if not self._handle_module_post_update_hook(module):
|
|
183
|
-
errors.append(module_name)
|
|
184
|
-
for error in errors:
|
|
185
|
-
self._modules.pop(error)
|
|
186
|
-
|
|
187
183
|
for child in self._children.values():
|
|
188
184
|
errors = []
|
|
189
185
|
for child_module_name, child_module in child._modules.items():
|
|
@@ -197,14 +193,18 @@ class SmartDevice(Device):
|
|
|
197
193
|
if not self._features:
|
|
198
194
|
await self._initialize_features()
|
|
199
195
|
|
|
200
|
-
_LOGGER.debug(
|
|
196
|
+
_LOGGER.debug(
|
|
197
|
+
"Update completed %s: %s",
|
|
198
|
+
self.host,
|
|
199
|
+
self._last_update if first_update else resp,
|
|
200
|
+
)
|
|
201
201
|
|
|
202
202
|
def _handle_module_post_update_hook(self, module: SmartModule) -> bool:
|
|
203
203
|
try:
|
|
204
204
|
module._post_update_hook()
|
|
205
205
|
return True
|
|
206
206
|
except Exception as ex:
|
|
207
|
-
_LOGGER.
|
|
207
|
+
_LOGGER.warning(
|
|
208
208
|
"Error processing %s for device %s, module will be unavailable: %s",
|
|
209
209
|
module.name,
|
|
210
210
|
self.host,
|
|
@@ -212,6 +212,100 @@ class SmartDevice(Device):
|
|
|
212
212
|
)
|
|
213
213
|
return False
|
|
214
214
|
|
|
215
|
+
async def _modular_update(
|
|
216
|
+
self, first_update: bool, update_time: float
|
|
217
|
+
) -> dict[str, Any]:
|
|
218
|
+
"""Update the device with via the module queries."""
|
|
219
|
+
req: dict[str, Any] = {}
|
|
220
|
+
# Keep a track of actual module queries so we can track the time for
|
|
221
|
+
# modules that do not need to be updated frequently
|
|
222
|
+
module_queries: list[SmartModule] = []
|
|
223
|
+
mq = {
|
|
224
|
+
module: query
|
|
225
|
+
for module in self._modules.values()
|
|
226
|
+
if (query := module.query())
|
|
227
|
+
}
|
|
228
|
+
for module, query in mq.items():
|
|
229
|
+
if first_update and module.__class__ in FIRST_UPDATE_MODULES:
|
|
230
|
+
module._last_update_time = update_time
|
|
231
|
+
continue
|
|
232
|
+
if (
|
|
233
|
+
not module.MINIMUM_UPDATE_INTERVAL_SECS
|
|
234
|
+
or not module._last_update_time
|
|
235
|
+
or (update_time - module._last_update_time)
|
|
236
|
+
>= module.MINIMUM_UPDATE_INTERVAL_SECS
|
|
237
|
+
):
|
|
238
|
+
module_queries.append(module)
|
|
239
|
+
req.update(query)
|
|
240
|
+
|
|
241
|
+
_LOGGER.debug(
|
|
242
|
+
"Querying %s for modules: %s",
|
|
243
|
+
self.host,
|
|
244
|
+
", ".join(mod.name for mod in module_queries),
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
try:
|
|
248
|
+
resp = await self.protocol.query(req)
|
|
249
|
+
except Exception as ex:
|
|
250
|
+
resp = await self._handle_modular_update_error(
|
|
251
|
+
ex, first_update, ", ".join(mod.name for mod in module_queries), req
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
info_resp = self._last_update if first_update else resp
|
|
255
|
+
self._last_update.update(**resp)
|
|
256
|
+
self._info = self._try_get_response(info_resp, "get_device_info")
|
|
257
|
+
|
|
258
|
+
# Call handle update for modules that want to update internal data
|
|
259
|
+
errors = []
|
|
260
|
+
for module_name, module in self._modules.items():
|
|
261
|
+
if not self._handle_module_post_update_hook(module):
|
|
262
|
+
errors.append(module_name)
|
|
263
|
+
for error in errors:
|
|
264
|
+
self._modules.pop(error)
|
|
265
|
+
|
|
266
|
+
# Set the last update time for modules that had queries made.
|
|
267
|
+
for module in module_queries:
|
|
268
|
+
module._last_update_time = update_time
|
|
269
|
+
|
|
270
|
+
return resp
|
|
271
|
+
|
|
272
|
+
async def _handle_modular_update_error(
|
|
273
|
+
self,
|
|
274
|
+
ex: Exception,
|
|
275
|
+
first_update: bool,
|
|
276
|
+
module_names: str,
|
|
277
|
+
requests: dict[str, Any],
|
|
278
|
+
) -> dict[str, Any]:
|
|
279
|
+
"""Handle an error on calling module update.
|
|
280
|
+
|
|
281
|
+
Will try to call all modules individually
|
|
282
|
+
and any errors such as timeouts will be set as a SmartErrorCode.
|
|
283
|
+
"""
|
|
284
|
+
msg_part = "on first update" if first_update else "after first update"
|
|
285
|
+
|
|
286
|
+
_LOGGER.error(
|
|
287
|
+
"Error querying %s for modules '%s' %s: %s",
|
|
288
|
+
self.host,
|
|
289
|
+
module_names,
|
|
290
|
+
msg_part,
|
|
291
|
+
ex,
|
|
292
|
+
)
|
|
293
|
+
responses = {}
|
|
294
|
+
for meth, params in requests.items():
|
|
295
|
+
try:
|
|
296
|
+
resp = await self.protocol.query({meth: params})
|
|
297
|
+
responses[meth] = resp[meth]
|
|
298
|
+
except Exception as iex:
|
|
299
|
+
_LOGGER.error(
|
|
300
|
+
"Error querying %s individually for module query '%s' %s: %s",
|
|
301
|
+
self.host,
|
|
302
|
+
meth,
|
|
303
|
+
msg_part,
|
|
304
|
+
iex,
|
|
305
|
+
)
|
|
306
|
+
responses[meth] = SmartErrorCode.INTERNAL_QUERY_ERROR
|
|
307
|
+
return responses
|
|
308
|
+
|
|
215
309
|
async def _initialize_modules(self):
|
|
216
310
|
"""Initialize modules based on component negotiation response."""
|
|
217
311
|
from .smartmodule import SmartModule
|
|
@@ -229,8 +323,6 @@ class SmartDevice(Device):
|
|
|
229
323
|
skip_parent_only_modules = True
|
|
230
324
|
|
|
231
325
|
for mod in SmartModule.REGISTERED_MODULES.values():
|
|
232
|
-
_LOGGER.debug("%s requires %s", mod, mod.REQUIRED_COMPONENT)
|
|
233
|
-
|
|
234
326
|
if (
|
|
235
327
|
skip_parent_only_modules and mod in NON_HUB_PARENT_ONLY_MODULES
|
|
236
328
|
) or mod.__name__ in child_modules_to_skip:
|
|
@@ -240,7 +332,8 @@ class SmartDevice(Device):
|
|
|
240
332
|
or self.sys_info.get(mod.REQUIRED_KEY_ON_PARENT) is not None
|
|
241
333
|
):
|
|
242
334
|
_LOGGER.debug(
|
|
243
|
-
"
|
|
335
|
+
"Device %s, found required %s, adding %s to modules.",
|
|
336
|
+
self.host,
|
|
244
337
|
mod.REQUIRED_COMPONENT,
|
|
245
338
|
mod.__name__,
|
|
246
339
|
)
|