python-kasa 0.7.0.3__tar.gz → 0.7.0.5__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.5}/CHANGELOG.md +26 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/PKG-INFO +1 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/aestransport.py +12 -2
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/discover.py +34 -6
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/exceptions.py +2 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/httpclient.py +19 -4
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iotprotocol.py +37 -2
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/klaptransport.py +2 -7
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/protocol.py +41 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/cloud.py +1 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/firmware.py +4 -8
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/led.py +4 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/lighteffect.py +5 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/lightpreset.py +3 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/lightstripeffect.py +3 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/lighttransition.py +5 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/temperaturecontrol.py +22 -21
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/smartchilddevice.py +2 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/smartdevice.py +115 -24
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/smartmodule.py +28 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smartprotocol.py +63 -13
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/discovery_fixtures.py +12 -10
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_temperaturecontrol.py +9 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_discovery.py +36 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_protocol.py +67 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_smartdevice.py +125 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_smartprotocol.py +36 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/xortransport.py +4 -6
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/pyproject.toml +1 -1
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/LICENSE +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/README.md +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/cli.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/credentials.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/device.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/device_factory.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/device_type.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/deviceconfig.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/emeterstatus.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/feature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/energy.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/led.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/lighteffect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/interfaces/lightpreset.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/effects.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotbulb.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotdimmer.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotlightstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotmodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotplug.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/iotstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/ambientlight.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/antitheft.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/cloud.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/countdown.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/emeter.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/led.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/lighteffect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/lightpreset.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/motion.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/rulemodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/schedule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/time.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/iot/modules/usage.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/json.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/module.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/modulemapping.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/modulemapping.pyi +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/py.typed +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/effects.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/alarm.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/autooff.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/batterysensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/brightness.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/childdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/color.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/colortemperature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/contactsensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/devicemodule.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/energy.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/frostprotection.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/humiditysensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/light.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/reportmode.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/temperaturesensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/time.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/smart/modules/waterleaksensor.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/conftest.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/device_fixtures.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fakeprotocol_iot.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fakeprotocol_smart.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtureinfo.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/EP10(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/EP40(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS100(US)_1.0_1.2.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS100(US)_2.0_1.5.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS103(US)_1.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS103(US)_2.1_1.1.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS103(US)_2.1_1.1.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS105(US)_1.0_1.5.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS107(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS110(EU)_4.0_1.0.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS110(US)_1.0_1.2.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS200(US)_2.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS200(US)_5.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS210(US)_1.0_1.5.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS300(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS300(US)_1.0_1.0.21.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/HS300(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL110(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL120(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL120(US)_1.0_1.8.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL125(US)_1.20_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL125(US)_2.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL130(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL135(US)_1.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL420L5(US)_1.0_1.0.2.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL430(UN)_2.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL430(US)_2.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL430(US)_2.0_1.0.9.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL50(US)_1.0_1.1.13.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL60(UN)_1.0_1.1.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KL60(US)_1.0_1.1.13.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP100(US)_3.0_1.0.1.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP115(EU)_1.0_1.0.16.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP115(US)_1.0_1.0.17.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP125(US)_1.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP200(US)_3.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP303(US)_2.0_1.0.3.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP400(US)_1.0_1.0.10.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP400(US)_2.0_1.0.6.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP401(US)_1.0_1.0.0.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KP405(US)_1.0_1.0.5.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KS200M(US)_1.0_1.0.8.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KS220M(US)_1.0_1.0.4.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/KS230(US)_1.0_1.0.14.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/fixtures/LB110(US)_1.0_1.8.11.json +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/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.5}/kasa/tests/smart/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/features/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/features/test_brightness.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/features/test_colortemp.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/__init__.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_autooff.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_contact.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_fan.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_firmware.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_humidity.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_light_effect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_light_strip_effect.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_lighttransition.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_temperature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/smart/modules/test_waterleak.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_aestransport.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_bulb.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_childdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_cli.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_common_modules.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_device.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_device_factory.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_device_type.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_deviceconfig.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_dimmer.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_emeter.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_feature.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_httpclient.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_iotdevice.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_klapprotocol.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_lightstrip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_plug.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_readme_examples.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_strip.py +0 -0
- {python_kasa-0.7.0.3 → python_kasa-0.7.0.5}/kasa/tests/test_usage.py +0 -0
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.0.5](https://github.com/python-kasa/python-kasa/tree/0.7.0.5) (2024-07-18)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.4...0.7.0.5)
|
|
6
|
+
|
|
7
|
+
A critical bugfix for an issue with some L530 Series devices and a redactor for sensitive info from debug logs.
|
|
8
|
+
|
|
9
|
+
**Fixed bugs:**
|
|
10
|
+
|
|
11
|
+
- Only refresh smart LightEffect module daily [\#1064](https://github.com/python-kasa/python-kasa/pull/1064)
|
|
12
|
+
|
|
13
|
+
**Project maintenance:**
|
|
14
|
+
|
|
15
|
+
- Redact sensitive info from debug logs [\#1069](https://github.com/python-kasa/python-kasa/pull/1069)
|
|
16
|
+
|
|
17
|
+
## [0.7.0.4](https://github.com/python-kasa/python-kasa/tree/0.7.0.4) (2024-07-11)
|
|
18
|
+
|
|
19
|
+
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.3...0.7.0.4)
|
|
20
|
+
|
|
21
|
+
Critical bugfixes for issues with P100s and thermostats.
|
|
22
|
+
|
|
23
|
+
**Fixed bugs:**
|
|
24
|
+
|
|
25
|
+
- Use first known thermostat state as main state (pick #1054) [\#1057](https://github.com/python-kasa/python-kasa/pull/1057)
|
|
26
|
+
- Defer module updates for less volatile modules (pick 1052) [\#1056](https://github.com/python-kasa/python-kasa/pull/1056)
|
|
27
|
+
|
|
3
28
|
## [0.7.0.3](https://github.com/python-kasa/python-kasa/tree/0.7.0.3) (2024-07-04)
|
|
4
29
|
|
|
5
30
|
[Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.2...0.7.0.3)
|
|
@@ -9,7 +34,7 @@ Partially fixes light preset module errors with L920 and L930.
|
|
|
9
34
|
|
|
10
35
|
**Fixed bugs:**
|
|
11
36
|
|
|
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)
|
|
37
|
+
- 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
38
|
|
|
14
39
|
## [0.7.0.2](https://github.com/python-kasa/python-kasa/tree/0.7.0.2) (2024-07-01)
|
|
15
40
|
|
|
@@ -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):
|
|
@@ -87,7 +87,8 @@ import ipaddress
|
|
|
87
87
|
import logging
|
|
88
88
|
import socket
|
|
89
89
|
from collections.abc import Awaitable
|
|
90
|
-
from
|
|
90
|
+
from pprint import pformat as pf
|
|
91
|
+
from typing import Any, Callable, Dict, Optional, Type, cast
|
|
91
92
|
|
|
92
93
|
# When support for cpython older than 3.11 is dropped
|
|
93
94
|
# async_timeout can be replaced with asyncio.timeout
|
|
@@ -112,8 +113,10 @@ from kasa.exceptions import (
|
|
|
112
113
|
UnsupportedDeviceError,
|
|
113
114
|
)
|
|
114
115
|
from kasa.iot.iotdevice import IotDevice
|
|
116
|
+
from kasa.iotprotocol import REDACTORS as IOT_REDACTORS
|
|
115
117
|
from kasa.json import dumps as json_dumps
|
|
116
118
|
from kasa.json import loads as json_loads
|
|
119
|
+
from kasa.protocol import mask_mac, redact_data
|
|
117
120
|
from kasa.xortransport import XorEncryption
|
|
118
121
|
|
|
119
122
|
_LOGGER = logging.getLogger(__name__)
|
|
@@ -123,6 +126,12 @@ OnDiscoveredCallable = Callable[[Device], Awaitable[None]]
|
|
|
123
126
|
OnUnsupportedCallable = Callable[[UnsupportedDeviceError], Awaitable[None]]
|
|
124
127
|
DeviceDict = Dict[str, Device]
|
|
125
128
|
|
|
129
|
+
NEW_DISCOVERY_REDACTORS: dict[str, Callable[[Any], Any] | None] = {
|
|
130
|
+
"device_id": lambda x: "REDACTED_" + x[9::],
|
|
131
|
+
"owner": lambda x: "REDACTED_" + x[9::],
|
|
132
|
+
"mac": mask_mac,
|
|
133
|
+
}
|
|
134
|
+
|
|
126
135
|
|
|
127
136
|
class _DiscoverProtocol(asyncio.DatagramProtocol):
|
|
128
137
|
"""Implementation of the discovery protocol handler.
|
|
@@ -293,6 +302,8 @@ class Discover:
|
|
|
293
302
|
DISCOVERY_PORT_2 = 20002
|
|
294
303
|
DISCOVERY_QUERY_2 = binascii.unhexlify("020000010000000000000000463cb5d3")
|
|
295
304
|
|
|
305
|
+
_redact_data = True
|
|
306
|
+
|
|
296
307
|
@staticmethod
|
|
297
308
|
async def discover(
|
|
298
309
|
*,
|
|
@@ -484,7 +495,9 @@ class Discover:
|
|
|
484
495
|
f"Unable to read response from device: {config.host}: {ex}"
|
|
485
496
|
) from ex
|
|
486
497
|
|
|
487
|
-
_LOGGER.
|
|
498
|
+
if _LOGGER.isEnabledFor(logging.DEBUG):
|
|
499
|
+
data = redact_data(info, IOT_REDACTORS) if Discover._redact_data else info
|
|
500
|
+
_LOGGER.debug("[DISCOVERY] %s << %s", config.host, pf(data))
|
|
488
501
|
|
|
489
502
|
device_class = cast(Type[IotDevice], Discover._get_device_class(info))
|
|
490
503
|
device = device_class(config.host, config=config)
|
|
@@ -504,6 +517,7 @@ class Discover:
|
|
|
504
517
|
config: DeviceConfig,
|
|
505
518
|
) -> Device:
|
|
506
519
|
"""Get SmartDevice from the new 20002 response."""
|
|
520
|
+
debug_enabled = _LOGGER.isEnabledFor(logging.DEBUG)
|
|
507
521
|
try:
|
|
508
522
|
info = json_loads(data[16:])
|
|
509
523
|
except Exception as ex:
|
|
@@ -514,9 +528,17 @@ class Discover:
|
|
|
514
528
|
try:
|
|
515
529
|
discovery_result = DiscoveryResult(**info["result"])
|
|
516
530
|
except ValidationError as ex:
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
531
|
+
if debug_enabled:
|
|
532
|
+
data = (
|
|
533
|
+
redact_data(info, NEW_DISCOVERY_REDACTORS)
|
|
534
|
+
if Discover._redact_data
|
|
535
|
+
else info
|
|
536
|
+
)
|
|
537
|
+
_LOGGER.debug(
|
|
538
|
+
"Unable to parse discovery from device %s: %s",
|
|
539
|
+
config.host,
|
|
540
|
+
pf(data),
|
|
541
|
+
)
|
|
520
542
|
raise UnsupportedDeviceError(
|
|
521
543
|
f"Unable to parse discovery from device: {config.host}: {ex}"
|
|
522
544
|
) from ex
|
|
@@ -551,7 +573,13 @@ class Discover:
|
|
|
551
573
|
discovery_result=discovery_result.get_dict(),
|
|
552
574
|
)
|
|
553
575
|
|
|
554
|
-
|
|
576
|
+
if debug_enabled:
|
|
577
|
+
data = (
|
|
578
|
+
redact_data(info, NEW_DISCOVERY_REDACTORS)
|
|
579
|
+
if Discover._redact_data
|
|
580
|
+
else info
|
|
581
|
+
)
|
|
582
|
+
_LOGGER.debug("[DISCOVERY] %s << %s", config.host, pf(data))
|
|
555
583
|
device = device_class(config.host, protocol=protocol)
|
|
556
584
|
|
|
557
585
|
di = discovery_result.get_dict()
|
|
@@ -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
|
|
@@ -4,6 +4,8 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import logging
|
|
7
|
+
from pprint import pformat as pf
|
|
8
|
+
from typing import Any, Callable
|
|
7
9
|
|
|
8
10
|
from .deviceconfig import DeviceConfig
|
|
9
11
|
from .exceptions import (
|
|
@@ -14,11 +16,26 @@ from .exceptions import (
|
|
|
14
16
|
_RetryableError,
|
|
15
17
|
)
|
|
16
18
|
from .json import dumps as json_dumps
|
|
17
|
-
from .protocol import BaseProtocol, BaseTransport
|
|
19
|
+
from .protocol import BaseProtocol, BaseTransport, mask_mac, redact_data
|
|
18
20
|
from .xortransport import XorEncryption, XorTransport
|
|
19
21
|
|
|
20
22
|
_LOGGER = logging.getLogger(__name__)
|
|
21
23
|
|
|
24
|
+
REDACTORS: dict[str, Callable[[Any], Any] | None] = {
|
|
25
|
+
"latitude": lambda x: 0,
|
|
26
|
+
"longitude": lambda x: 0,
|
|
27
|
+
"latitude_i": lambda x: 0,
|
|
28
|
+
"longitude_i": lambda x: 0,
|
|
29
|
+
"deviceId": lambda x: "REDACTED_" + x[9::],
|
|
30
|
+
"id": lambda x: "REDACTED_" + x[9::],
|
|
31
|
+
"alias": lambda x: "#MASKED_NAME#" if x else "",
|
|
32
|
+
"mac": mask_mac,
|
|
33
|
+
"mic_mac": mask_mac,
|
|
34
|
+
"ssid": lambda x: "#MASKED_SSID#" if x else "",
|
|
35
|
+
"oemId": lambda x: "REDACTED_" + x[9::],
|
|
36
|
+
"username": lambda _: "user@example.com", # cnCloud
|
|
37
|
+
}
|
|
38
|
+
|
|
22
39
|
|
|
23
40
|
class IotProtocol(BaseProtocol):
|
|
24
41
|
"""Class for the legacy TPLink IOT KASA Protocol."""
|
|
@@ -34,6 +51,7 @@ class IotProtocol(BaseProtocol):
|
|
|
34
51
|
super().__init__(transport=transport)
|
|
35
52
|
|
|
36
53
|
self._query_lock = asyncio.Lock()
|
|
54
|
+
self._redact_data = True
|
|
37
55
|
|
|
38
56
|
async def query(self, request: str | dict, retry_count: int = 3) -> dict:
|
|
39
57
|
"""Query the device retrying for retry_count on failure."""
|
|
@@ -85,7 +103,24 @@ class IotProtocol(BaseProtocol):
|
|
|
85
103
|
raise KasaException("Query reached somehow to unreachable")
|
|
86
104
|
|
|
87
105
|
async def _execute_query(self, request: str, retry_count: int) -> dict:
|
|
88
|
-
|
|
106
|
+
debug_enabled = _LOGGER.isEnabledFor(logging.DEBUG)
|
|
107
|
+
|
|
108
|
+
if debug_enabled:
|
|
109
|
+
_LOGGER.debug(
|
|
110
|
+
"%s >> %s",
|
|
111
|
+
self._host,
|
|
112
|
+
request,
|
|
113
|
+
)
|
|
114
|
+
resp = await self._transport.send(request)
|
|
115
|
+
|
|
116
|
+
if debug_enabled:
|
|
117
|
+
data = redact_data(resp, REDACTORS) if self._redact_data else resp
|
|
118
|
+
_LOGGER.debug(
|
|
119
|
+
"%s << %s",
|
|
120
|
+
self._host,
|
|
121
|
+
pf(data),
|
|
122
|
+
)
|
|
123
|
+
return resp
|
|
89
124
|
|
|
90
125
|
async def close(self) -> None:
|
|
91
126
|
"""Close the underlying transport."""
|
|
@@ -50,7 +50,6 @@ import logging
|
|
|
50
50
|
import secrets
|
|
51
51
|
import struct
|
|
52
52
|
import time
|
|
53
|
-
from pprint import pformat as pf
|
|
54
53
|
from typing import Any, cast
|
|
55
54
|
|
|
56
55
|
from cryptography.hazmat.primitives import padding
|
|
@@ -349,7 +348,7 @@ class KlapTransport(BaseTransport):
|
|
|
349
348
|
+ f"request with seq {seq}"
|
|
350
349
|
)
|
|
351
350
|
else:
|
|
352
|
-
_LOGGER.debug("
|
|
351
|
+
_LOGGER.debug("Device %s query posted %s", self._host, msg)
|
|
353
352
|
|
|
354
353
|
# Check for mypy
|
|
355
354
|
if self._encryption_session is not None:
|
|
@@ -357,11 +356,7 @@ class KlapTransport(BaseTransport):
|
|
|
357
356
|
|
|
358
357
|
json_payload = json_loads(decrypted_response)
|
|
359
358
|
|
|
360
|
-
_LOGGER.debug(
|
|
361
|
-
"%s << %s",
|
|
362
|
-
self._host,
|
|
363
|
-
_LOGGER.isEnabledFor(logging.DEBUG) and pf(json_payload),
|
|
364
|
-
)
|
|
359
|
+
_LOGGER.debug("Device %s query response received", self._host)
|
|
365
360
|
|
|
366
361
|
return json_payload
|
|
367
362
|
|
|
@@ -18,6 +18,7 @@ import hashlib
|
|
|
18
18
|
import logging
|
|
19
19
|
import struct
|
|
20
20
|
from abc import ABC, abstractmethod
|
|
21
|
+
from typing import Any, Callable, TypeVar, cast
|
|
21
22
|
|
|
22
23
|
# When support for cpython older than 3.11 is dropped
|
|
23
24
|
# async_timeout can be replaced with asyncio.timeout
|
|
@@ -28,6 +29,46 @@ _LOGGER = logging.getLogger(__name__)
|
|
|
28
29
|
_NO_RETRY_ERRORS = {errno.EHOSTDOWN, errno.EHOSTUNREACH, errno.ECONNREFUSED}
|
|
29
30
|
_UNSIGNED_INT_NETWORK_ORDER = struct.Struct(">I")
|
|
30
31
|
|
|
32
|
+
_T = TypeVar("_T")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def redact_data(data: _T, redactors: dict[str, Callable[[Any], Any] | None]) -> _T:
|
|
36
|
+
"""Redact sensitive data for logging."""
|
|
37
|
+
if not isinstance(data, (dict, list)):
|
|
38
|
+
return data
|
|
39
|
+
|
|
40
|
+
if isinstance(data, list):
|
|
41
|
+
return cast(_T, [redact_data(val, redactors) for val in data])
|
|
42
|
+
|
|
43
|
+
redacted = {**data}
|
|
44
|
+
|
|
45
|
+
for key, value in redacted.items():
|
|
46
|
+
if value is None:
|
|
47
|
+
continue
|
|
48
|
+
if isinstance(value, str) and not value:
|
|
49
|
+
continue
|
|
50
|
+
if key in redactors:
|
|
51
|
+
if redactor := redactors[key]:
|
|
52
|
+
try:
|
|
53
|
+
redacted[key] = redactor(value)
|
|
54
|
+
except: # noqa: E722
|
|
55
|
+
redacted[key] = "**REDACTEX**"
|
|
56
|
+
else:
|
|
57
|
+
redacted[key] = "**REDACTED**"
|
|
58
|
+
elif isinstance(value, dict):
|
|
59
|
+
redacted[key] = redact_data(value, redactors)
|
|
60
|
+
elif isinstance(value, list):
|
|
61
|
+
redacted[key] = [redact_data(item, redactors) for item in value]
|
|
62
|
+
|
|
63
|
+
return cast(_T, redacted)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def mask_mac(mac: str) -> str:
|
|
67
|
+
"""Return mac address with last two octects blanked."""
|
|
68
|
+
delim = ":" if ":" in mac else "-"
|
|
69
|
+
rest = delim.join(format(s, "02x") for s in bytes.fromhex("000000"))
|
|
70
|
+
return f"{mac[:8]}{delim}{rest}"
|
|
71
|
+
|
|
31
72
|
|
|
32
73
|
def md5(payload: bytes) -> bytes:
|
|
33
74
|
"""Return the MD5 hash of the payload."""
|
|
@@ -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 * 60 * 24
|
|
20
21
|
AVAILABLE_BULB_EFFECTS = {
|
|
21
22
|
"L1": "Party",
|
|
22
23
|
"L2": "Relax",
|
|
@@ -73,6 +74,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
73
74
|
"""Return effect name."""
|
|
74
75
|
return self._effect
|
|
75
76
|
|
|
77
|
+
@allow_update_after
|
|
76
78
|
async def set_effect(
|
|
77
79
|
self,
|
|
78
80
|
effect: str,
|
|
@@ -130,6 +132,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
130
132
|
|
|
131
133
|
return brightness
|
|
132
134
|
|
|
135
|
+
@allow_update_after
|
|
133
136
|
async def set_brightness(
|
|
134
137
|
self,
|
|
135
138
|
brightness: int,
|
|
@@ -156,6 +159,7 @@ class LightEffect(SmartModule, SmartLightEffect):
|
|
|
156
159
|
|
|
157
160
|
return await self.call("edit_dynamic_light_effect_rule", new_effect)
|
|
158
161
|
|
|
162
|
+
@allow_update_after
|
|
159
163
|
async def set_custom_effect(
|
|
160
164
|
self,
|
|
161
165
|
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
|
|