python-kasa 0.7.0.dev0__tar.gz → 0.7.0.dev1__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.
Files changed (239) hide show
  1. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/CHANGELOG.md +10 -0
  2. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/PKG-INFO +1 -1
  3. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/__init__.py +3 -1
  4. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/device.py +8 -0
  5. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/light.py +6 -1
  6. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotbulb.py +3 -0
  7. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotdevice.py +19 -0
  8. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotdimmer.py +3 -0
  9. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/light.py +46 -4
  10. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/light.py +28 -1
  11. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_bulb.py +1 -1
  12. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_common_modules.py +28 -2
  13. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_dimmer.py +9 -9
  14. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/pyproject.toml +1 -1
  15. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/LICENSE +0 -0
  16. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/README.md +0 -0
  17. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/aestransport.py +0 -0
  18. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/cli.py +0 -0
  19. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/credentials.py +0 -0
  20. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/device_factory.py +0 -0
  21. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/device_type.py +0 -0
  22. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/deviceconfig.py +0 -0
  23. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/discover.py +0 -0
  24. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/emeterstatus.py +0 -0
  25. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/exceptions.py +0 -0
  26. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/feature.py +0 -0
  27. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/httpclient.py +0 -0
  28. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/__init__.py +0 -0
  29. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/fan.py +0 -0
  30. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/led.py +0 -0
  31. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/lighteffect.py +0 -0
  32. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/interfaces/lightpreset.py +0 -0
  33. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/__init__.py +0 -0
  34. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/effects.py +0 -0
  35. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotlightstrip.py +0 -0
  36. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotmodule.py +0 -0
  37. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotplug.py +0 -0
  38. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/iotstrip.py +0 -0
  39. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/__init__.py +0 -0
  40. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/ambientlight.py +0 -0
  41. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/antitheft.py +0 -0
  42. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/cloud.py +0 -0
  43. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/countdown.py +0 -0
  44. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/emeter.py +0 -0
  45. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/led.py +0 -0
  46. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/lighteffect.py +0 -0
  47. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/lightpreset.py +0 -0
  48. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/motion.py +0 -0
  49. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/rulemodule.py +0 -0
  50. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/schedule.py +0 -0
  51. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/time.py +0 -0
  52. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iot/modules/usage.py +0 -0
  53. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/iotprotocol.py +0 -0
  54. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/json.py +0 -0
  55. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/klaptransport.py +0 -0
  56. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/module.py +0 -0
  57. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/modulemapping.py +0 -0
  58. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/modulemapping.pyi +0 -0
  59. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/protocol.py +0 -0
  60. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/py.typed +0 -0
  61. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/__init__.py +0 -0
  62. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/effects.py +0 -0
  63. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/__init__.py +0 -0
  64. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/alarm.py +0 -0
  65. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/autooff.py +0 -0
  66. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/batterysensor.py +0 -0
  67. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/brightness.py +0 -0
  68. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/childdevice.py +0 -0
  69. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/cloud.py +0 -0
  70. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/color.py +0 -0
  71. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/colortemperature.py +0 -0
  72. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/contactsensor.py +0 -0
  73. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/devicemodule.py +0 -0
  74. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/energy.py +0 -0
  75. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/fan.py +0 -0
  76. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/firmware.py +0 -0
  77. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/frostprotection.py +0 -0
  78. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/humiditysensor.py +0 -0
  79. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/led.py +0 -0
  80. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/lighteffect.py +0 -0
  81. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/lightpreset.py +0 -0
  82. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/lightstripeffect.py +0 -0
  83. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/lighttransition.py +0 -0
  84. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/reportmode.py +0 -0
  85. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/temperaturecontrol.py +0 -0
  86. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/temperaturesensor.py +0 -0
  87. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/time.py +0 -0
  88. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/modules/waterleaksensor.py +0 -0
  89. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/smartchilddevice.py +0 -0
  90. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/smartdevice.py +0 -0
  91. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smart/smartmodule.py +0 -0
  92. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/smartprotocol.py +0 -0
  93. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/__init__.py +0 -0
  94. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/conftest.py +0 -0
  95. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/device_fixtures.py +0 -0
  96. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/discovery_fixtures.py +0 -0
  97. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fakeprotocol_iot.py +0 -0
  98. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fakeprotocol_smart.py +0 -0
  99. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtureinfo.py +0 -0
  100. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/EP10(US)_1.0_1.0.2.json +0 -0
  101. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/EP40(US)_1.0_1.0.2.json +0 -0
  102. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json +0 -0
  103. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json +0 -0
  104. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +0 -0
  105. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS100(US)_1.0_1.2.5.json +0 -0
  106. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS100(US)_2.0_1.5.6.json +0 -0
  107. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS103(US)_1.0_1.5.7.json +0 -0
  108. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS103(US)_2.1_1.1.2.json +0 -0
  109. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS103(US)_2.1_1.1.4.json +0 -0
  110. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS105(US)_1.0_1.5.6.json +0 -0
  111. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS107(US)_1.0_1.0.8.json +0 -0
  112. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS110(EU)_1.0_1.2.5.json +0 -0
  113. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS110(EU)_4.0_1.0.4.json +0 -0
  114. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS200(US)_2.0_1.5.7.json +0 -0
  115. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS200(US)_5.0_1.0.2.json +0 -0
  116. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS210(US)_1.0_1.5.8.json +0 -0
  117. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS220(US)_1.0_1.5.7.json +0 -0
  118. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS220(US)_2.0_1.0.3.json +0 -0
  119. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS300(US)_1.0_1.0.10.json +0 -0
  120. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json +0 -0
  121. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/HS300(US)_2.0_1.0.3.json +0 -0
  122. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL110(US)_1.0_1.8.11.json +0 -0
  123. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL120(US)_1.0_1.8.6.json +0 -0
  124. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL125(US)_1.20_1.0.5.json +0 -0
  125. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL125(US)_2.0_1.0.7.json +0 -0
  126. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json +0 -0
  127. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL130(EU)_1.0_1.8.8.json +0 -0
  128. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL130(US)_1.0_1.8.11.json +0 -0
  129. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL135(US)_1.0_1.0.6.json +0 -0
  130. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.5.json +0 -0
  131. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL400L5(US)_1.0_1.0.8.json +0 -0
  132. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL420L5(US)_1.0_1.0.2.json +0 -0
  133. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL430(UN)_2.0_1.0.8.json +0 -0
  134. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL430(US)_1.0_1.0.10.json +0 -0
  135. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json +0 -0
  136. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL430(US)_2.0_1.0.8.json +0 -0
  137. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL430(US)_2.0_1.0.9.json +0 -0
  138. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL50(US)_1.0_1.1.13.json +0 -0
  139. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL60(UN)_1.0_1.1.4.json +0 -0
  140. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KL60(US)_1.0_1.1.13.json +0 -0
  141. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP100(US)_3.0_1.0.1.json +0 -0
  142. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json +0 -0
  143. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +0 -0
  144. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP115(EU)_1.0_1.0.16.json +0 -0
  145. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP115(US)_1.0_1.0.17.json +0 -0
  146. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json +0 -0
  147. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP125(US)_1.0_1.0.6.json +0 -0
  148. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP200(US)_3.0_1.0.3.json +0 -0
  149. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP303(UK)_1.0_1.0.3.json +0 -0
  150. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP303(US)_2.0_1.0.3.json +0 -0
  151. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP400(US)_1.0_1.0.10.json +0 -0
  152. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP400(US)_2.0_1.0.6.json +0 -0
  153. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP401(US)_1.0_1.0.0.json +0 -0
  154. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KP405(US)_1.0_1.0.5.json +0 -0
  155. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KS200M(US)_1.0_1.0.8.json +0 -0
  156. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KS220M(US)_1.0_1.0.4.json +0 -0
  157. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/KS230(US)_1.0_1.0.14.json +0 -0
  158. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/LB110(US)_1.0_1.8.11.json +0 -0
  159. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.1.json +0 -0
  160. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json +0 -0
  161. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.2.3.json +0 -0
  162. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.10.json +0 -0
  163. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/H100(EU)_1.0_1.5.5.json +0 -0
  164. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KH100(UK)_1.0_1.5.6.json +0 -0
  165. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KP125M(US)_1.0_1.1.3.json +0 -0
  166. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KS205(US)_1.0_1.0.2.json +0 -0
  167. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KS225(US)_1.0_1.0.2.json +0 -0
  168. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.4.json +0 -0
  169. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/KS240(US)_1.0_1.0.5.json +0 -0
  170. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json +0 -0
  171. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L510E(US)_3.0_1.0.5.json +0 -0
  172. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L510E(US)_3.0_1.1.2.json +0 -0
  173. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.0.6.json +0 -0
  174. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json +0 -0
  175. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.6.json +0 -0
  176. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json +0 -0
  177. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json +0 -0
  178. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L900-10(US)_1.0_1.0.11.json +0 -0
  179. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.0.17.json +0 -0
  180. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L900-5(EU)_1.0_1.1.0.json +0 -0
  181. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.0.json +0 -0
  182. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L920-5(US)_1.0_1.1.3.json +0 -0
  183. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/L930-5(US)_1.0_1.1.2.json +0 -0
  184. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P100_1.0.0_1.1.3.json +0 -0
  185. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P100_1.0.0_1.3.7.json +0 -0
  186. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P100_1.0.0_1.4.0.json +0 -0
  187. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P110(EU)_1.0_1.0.7.json +0 -0
  188. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P110(EU)_1.0_1.2.3.json +0 -0
  189. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +0 -0
  190. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json +0 -0
  191. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P135(US)_1.0_1.0.5.json +0 -0
  192. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.13.json +0 -0
  193. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/P300(EU)_1.0_1.0.7.json +0 -0
  194. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/S500D(US)_1.0_1.0.5.json +0 -0
  195. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/S505(US)_1.0_1.0.2.json +0 -0
  196. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/TP15(US)_1.0_1.0.3.json +0 -0
  197. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/TP25(US)_1.0_1.0.2.json +0 -0
  198. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.4.0.json +0 -0
  199. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/KE100(EU)_1.0_2.8.0.json +0 -0
  200. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/KE100(UK)_1.0_2.8.0.json +0 -0
  201. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/T110(EU)_1.0_1.8.0.json +0 -0
  202. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/T300(EU)_1.0_1.7.0.json +0 -0
  203. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json +0 -0
  204. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json +0 -0
  205. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/__init__.py +0 -0
  206. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/features/__init__.py +0 -0
  207. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/features/test_brightness.py +0 -0
  208. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/features/test_colortemp.py +0 -0
  209. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/__init__.py +0 -0
  210. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_contact.py +0 -0
  211. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_fan.py +0 -0
  212. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_firmware.py +0 -0
  213. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_humidity.py +0 -0
  214. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_light_effect.py +0 -0
  215. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_temperature.py +0 -0
  216. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_temperaturecontrol.py +0 -0
  217. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/smart/modules/test_waterleak.py +0 -0
  218. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_aestransport.py +0 -0
  219. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_childdevice.py +0 -0
  220. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_cli.py +0 -0
  221. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_device.py +0 -0
  222. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_device_factory.py +0 -0
  223. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_device_type.py +0 -0
  224. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_deviceconfig.py +0 -0
  225. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_discovery.py +0 -0
  226. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_emeter.py +0 -0
  227. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_feature.py +0 -0
  228. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_httpclient.py +0 -0
  229. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_iotdevice.py +0 -0
  230. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_klapprotocol.py +0 -0
  231. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_lightstrip.py +0 -0
  232. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_plug.py +0 -0
  233. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_protocol.py +0 -0
  234. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_readme_examples.py +0 -0
  235. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_smartdevice.py +0 -0
  236. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_smartprotocol.py +0 -0
  237. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_strip.py +0 -0
  238. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/tests/test_usage.py +0 -0
  239. {python_kasa-0.7.0.dev0 → python_kasa-0.7.0.dev1}/kasa/xortransport.py +0 -0
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0.dev1](https://github.com/python-kasa/python-kasa/tree/0.7.0.dev1) (2024-05-22)
4
+
5
+ [Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.7.0.dev0...0.7.0.dev1)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Fix set\_state for common light modules [\#929](https://github.com/python-kasa/python-kasa/pull/929) (@sdb9696)
10
+ - Add state feature for iot devices [\#924](https://github.com/python-kasa/python-kasa/pull/924) (@rytilahti)
11
+
3
12
  ## [0.7.0.dev0](https://github.com/python-kasa/python-kasa/tree/0.7.0.dev0) (2024-05-19)
4
13
 
5
14
  [Full Changelog](https://github.com/python-kasa/python-kasa/compare/0.6.2.1...0.7.0.dev0)
@@ -120,6 +129,7 @@
120
129
 
121
130
  **Merged pull requests:**
122
131
 
132
+ - Prepare 0.7.0.dev0 [\#922](https://github.com/python-kasa/python-kasa/pull/922) (@rytilahti)
123
133
  - Fix potential infinite loop if incomplete lists returned [\#920](https://github.com/python-kasa/python-kasa/pull/920) (@sdb9696)
124
134
  - Deprecate device level light, effect and led attributes [\#916](https://github.com/python-kasa/python-kasa/pull/916) (@sdb9696)
125
135
  - Update cli to use common modules and remove iot specific cli testing [\#913](https://github.com/python-kasa/python-kasa/pull/913) (@sdb9696)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-kasa
3
- Version: 0.7.0.dev0
3
+ Version: 0.7.0.dev1
4
4
  Summary: Python API for TP-Link Kasa Smarthome devices
5
5
  Home-page: https://github.com/python-kasa/python-kasa
6
6
  License: GPL-3.0-or-later
@@ -35,7 +35,7 @@ from kasa.exceptions import (
35
35
  UnsupportedDeviceError,
36
36
  )
37
37
  from kasa.feature import Feature
38
- from kasa.interfaces.light import Light, LightState
38
+ from kasa.interfaces.light import HSV, ColorTempRange, Light, LightState
39
39
  from kasa.iotprotocol import (
40
40
  IotProtocol,
41
41
  _deprecated_TPLinkSmartHomeProtocol, # noqa: F401
@@ -60,6 +60,8 @@ __all__ = [
60
60
  "EmeterStatus",
61
61
  "Device",
62
62
  "Light",
63
+ "ColorTempRange",
64
+ "HSV",
63
65
  "Plug",
64
66
  "Module",
65
67
  "KasaException",
@@ -138,6 +138,14 @@ class Device(ABC):
138
138
  async def turn_off(self, **kwargs) -> dict | None:
139
139
  """Turn off the device."""
140
140
 
141
+ @abstractmethod
142
+ async def set_state(self, on: bool):
143
+ """Set the device state to *on*.
144
+
145
+ This allows turning the device on and off.
146
+ See also *turn_off* and *turn_on*.
147
+ """
148
+
141
149
  @property
142
150
  def host(self) -> str:
143
151
  """The device host."""
@@ -18,7 +18,7 @@ class LightState:
18
18
  hue: int | None = None
19
19
  saturation: int | None = None
20
20
  color_temp: int | None = None
21
- transition: bool | None = None
21
+ transition: int | None = None
22
22
 
23
23
 
24
24
  class ColorTempRange(NamedTuple):
@@ -128,6 +128,11 @@ class Light(Module, ABC):
128
128
  :param int transition: transition in milliseconds.
129
129
  """
130
130
 
131
+ @property
132
+ @abstractmethod
133
+ def state(self) -> LightState:
134
+ """Return the current light state."""
135
+
131
136
  @abstractmethod
132
137
  async def set_state(self, state: LightState) -> dict:
133
138
  """Set the light state."""
@@ -329,6 +329,9 @@ class IotBulb(IotDevice):
329
329
  if transition is not None:
330
330
  state["transition_period"] = transition
331
331
 
332
+ if "brightness" in state:
333
+ self._raise_for_invalid_brightness(state["brightness"])
334
+
332
335
  # if no on/off is defined, turn on the light
333
336
  if "on_off" not in state:
334
337
  state["on_off"] = 1
@@ -323,6 +323,18 @@ class IotDevice(Device):
323
323
  """Initialize modules not added in init."""
324
324
 
325
325
  async def _initialize_features(self):
326
+ """Initialize common features."""
327
+ self._add_feature(
328
+ Feature(
329
+ self,
330
+ id="state",
331
+ name="State",
332
+ attribute_getter="is_on",
333
+ attribute_setter="set_state",
334
+ type=Feature.Type.Switch,
335
+ category=Feature.Category.Primary,
336
+ )
337
+ )
326
338
  self._add_feature(
327
339
  Feature(
328
340
  device=self,
@@ -634,6 +646,13 @@ class IotDevice(Device):
634
646
  """Return True if the device is on."""
635
647
  raise NotImplementedError("Device subclass needs to implement this.")
636
648
 
649
+ async def set_state(self, on: bool):
650
+ """Set the device state."""
651
+ if on:
652
+ return await self.turn_on()
653
+ else:
654
+ return await self.turn_off()
655
+
637
656
  @property # type: ignore
638
657
  @requires_update
639
658
  def on_since(self) -> datetime | None:
@@ -168,6 +168,9 @@ class IotDimmer(IotPlug):
168
168
  if not 0 <= brightness <= 100:
169
169
  raise ValueError("Brightness value %s is not valid." % brightness)
170
170
 
171
+ # If zero set to 1 millisecond
172
+ if transition == 0:
173
+ transition = 1
171
174
  if not isinstance(transition, int):
172
175
  raise ValueError(
173
176
  "Transition must be integer, " "not of %s.", type(transition)
@@ -25,6 +25,7 @@ class Light(IotModule, LightInterface):
25
25
  """Implementation of brightness module."""
26
26
 
27
27
  _device: IotBulb | IotDimmer
28
+ _light_state: LightState
28
29
 
29
30
  def _initialize_features(self):
30
31
  """Initialize features."""
@@ -102,12 +103,14 @@ class Light(IotModule, LightInterface):
102
103
  async def set_brightness(
103
104
  self, brightness: int, *, transition: int | None = None
104
105
  ) -> dict:
105
- """Set the brightness in percentage.
106
+ """Set the brightness in percentage. A value of 0 will turn off the light.
106
107
 
107
108
  :param int brightness: brightness in percent
108
109
  :param int transition: transition in milliseconds.
109
110
  """
110
- return await self._device._set_brightness(brightness, transition=transition)
111
+ return await self.set_state(
112
+ LightState(brightness=brightness, transition=transition)
113
+ )
111
114
 
112
115
  @property
113
116
  def is_color(self) -> bool:
@@ -202,15 +205,54 @@ class Light(IotModule, LightInterface):
202
205
 
203
206
  async def set_state(self, state: LightState) -> dict:
204
207
  """Set the light state."""
205
- if (bulb := self._get_bulb_device()) is None:
206
- return await self.set_brightness(state.brightness or 0)
208
+ # iot protocol Dimmers and smart protocol devices do not support
209
+ # brightness of 0 so 0 will turn off all devices for consistency
210
+ if (bulb := self._get_bulb_device()) is None: # Dimmer
211
+ if state.brightness == 0 or state.light_on is False:
212
+ return await self._device.turn_off(transition=state.transition)
213
+ elif state.brightness:
214
+ # set_dimmer_transition will turn on the device
215
+ return await self._device.set_dimmer_transition(
216
+ state.brightness, state.transition or 0
217
+ )
218
+ return await self._device.turn_on(transition=state.transition)
207
219
  else:
208
220
  transition = state.transition
209
221
  state_dict = asdict(state)
210
222
  state_dict = {k: v for k, v in state_dict.items() if v is not None}
223
+ if "transition" in state_dict:
224
+ del state_dict["transition"]
211
225
  state_dict["on_off"] = 1 if state.light_on is None else int(state.light_on)
226
+ if state_dict.get("brightness") == 0:
227
+ state_dict["on_off"] = 0
228
+ del state_dict["brightness"]
229
+ # If light on state not set default to on.
230
+ elif state.light_on is None:
231
+ state_dict["on_off"] = 1
232
+ else:
233
+ state_dict["on_off"] = int(state.light_on)
212
234
  return await bulb._set_light_state(state_dict, transition=transition)
213
235
 
236
+ @property
237
+ def state(self) -> LightState:
238
+ """Return the current light state."""
239
+ return self._light_state
240
+
241
+ def _post_update_hook(self) -> None:
242
+ if self._device.is_on is False:
243
+ state = LightState(light_on=False)
244
+ else:
245
+ state = LightState(light_on=True)
246
+ if self.is_dimmable:
247
+ state.brightness = self.brightness
248
+ if self.is_color:
249
+ hsv = self.hsv
250
+ state.hue = hsv.hue
251
+ state.saturation = hsv.saturation
252
+ if self.is_variable_color_temp:
253
+ state.color_temp = self.color_temp
254
+ self._light_state = state
255
+
214
256
  async def _deprecated_set_light_state(
215
257
  self, state: dict, *, transition: int | None = None
216
258
  ) -> dict:
@@ -14,6 +14,8 @@ from ..smartmodule import SmartModule
14
14
  class Light(SmartModule, LightInterface):
15
15
  """Implementation of a light."""
16
16
 
17
+ _light_state: LightState
18
+
17
19
  def query(self) -> dict:
18
20
  """Query to execute during the update cycle."""
19
21
  return {}
@@ -131,9 +133,34 @@ class Light(SmartModule, LightInterface):
131
133
  """Set the light state."""
132
134
  state_dict = asdict(state)
133
135
  # brightness of 0 turns off the light, it's not a valid brightness
134
- if state.brightness and state.brightness == 0:
136
+ if state.brightness == 0:
135
137
  state_dict["device_on"] = False
136
138
  del state_dict["brightness"]
139
+ elif state.light_on is not None:
140
+ state_dict["device_on"] = state.light_on
141
+ del state_dict["light_on"]
142
+ else:
143
+ state_dict["device_on"] = True
137
144
 
138
145
  params = {k: v for k, v in state_dict.items() if v is not None}
139
146
  return await self.call("set_device_info", params)
147
+
148
+ @property
149
+ def state(self) -> LightState:
150
+ """Return the current light state."""
151
+ return self._light_state
152
+
153
+ def _post_update_hook(self) -> None:
154
+ if self._device.is_on is False:
155
+ state = LightState(light_on=False)
156
+ else:
157
+ state = LightState(light_on=True)
158
+ if self.is_dimmable:
159
+ state.brightness = self.brightness
160
+ if self.is_color:
161
+ hsv = self.hsv
162
+ state.hue = hsv.hue
163
+ state.saturation = hsv.saturation
164
+ if self.is_variable_color_temp:
165
+ state.color_temp = self.color_temp
166
+ self._light_state = state
@@ -241,7 +241,7 @@ async def test_dimmable_brightness_transition(dev: IotBulb, mocker):
241
241
  set_light_state = mocker.patch("kasa.iot.IotBulb._set_light_state")
242
242
  await dev.set_brightness(10, transition=1000)
243
243
 
244
- set_light_state.assert_called_with({"brightness": 10}, transition=1000)
244
+ set_light_state.assert_called_with({"brightness": 10, "on_off": 1}, transition=1000)
245
245
 
246
246
 
247
247
  @dimmable_iot
@@ -4,6 +4,7 @@ from pytest_mock import MockerFixture
4
4
  from kasa import Device, LightState, Module
5
5
  from kasa.tests.device_fixtures import (
6
6
  bulb_iot,
7
+ bulb_smart,
7
8
  dimmable_iot,
8
9
  dimmer_iot,
9
10
  lightstrip_iot,
@@ -40,6 +41,8 @@ light_preset_smart = parametrize(
40
41
 
41
42
  light_preset = parametrize_combine([light_preset_smart, bulb_iot])
42
43
 
44
+ light = parametrize_combine([bulb_smart, bulb_iot, dimmable])
45
+
43
46
 
44
47
  @led
45
48
  async def test_led_module(dev: Device, mocker: MockerFixture):
@@ -139,6 +142,30 @@ async def test_light_brightness(dev: Device):
139
142
  await light.set_brightness(feature.maximum_value + 10)
140
143
 
141
144
 
145
+ @light
146
+ async def test_light_set_state(dev: Device):
147
+ """Test brightness setter and getter."""
148
+ assert isinstance(dev, Device)
149
+ light = dev.modules.get(Module.Light)
150
+ assert light
151
+
152
+ await light.set_state(LightState(light_on=False))
153
+ await dev.update()
154
+ assert light.state.light_on is False
155
+
156
+ await light.set_state(LightState(light_on=True))
157
+ await dev.update()
158
+ assert light.state.light_on is True
159
+
160
+ await light.set_state(LightState(brightness=0))
161
+ await dev.update()
162
+ assert light.state.light_on is False
163
+
164
+ await light.set_state(LightState(brightness=50))
165
+ await dev.update()
166
+ assert light.state.light_on is True
167
+
168
+
142
169
  @light_preset
143
170
  async def test_light_preset_module(dev: Device, mocker: MockerFixture):
144
171
  """Test light preset module."""
@@ -148,7 +175,6 @@ async def test_light_preset_module(dev: Device, mocker: MockerFixture):
148
175
  assert light_mod
149
176
  feat = dev.features["light_preset"]
150
177
 
151
- call = mocker.spy(light_mod, "set_state")
152
178
  preset_list = preset_mod.preset_list
153
179
  assert "Not set" in preset_list
154
180
  assert preset_list.index("Not set") == 0
@@ -157,7 +183,6 @@ async def test_light_preset_module(dev: Device, mocker: MockerFixture):
157
183
  assert preset_mod.has_save_preset is True
158
184
 
159
185
  await light_mod.set_brightness(33) # Value that should not be a preset
160
- assert call.call_count == 0
161
186
  await dev.update()
162
187
  assert preset_mod.preset == "Not set"
163
188
  assert feat.value == "Not set"
@@ -165,6 +190,7 @@ async def test_light_preset_module(dev: Device, mocker: MockerFixture):
165
190
  if len(preset_list) == 1:
166
191
  return
167
192
 
193
+ call = mocker.spy(light_mod, "set_state")
168
194
  second_preset = preset_list[1]
169
195
  await preset_mod.set_preset(second_preset)
170
196
  assert call.call_count == 1
@@ -7,19 +7,19 @@ from .conftest import dimmer_iot, handle_turn_on, turn_on
7
7
 
8
8
 
9
9
  @dimmer_iot
10
- @turn_on
11
- async def test_set_brightness(dev, turn_on):
12
- await handle_turn_on(dev, turn_on)
10
+ async def test_set_brightness(dev):
11
+ await handle_turn_on(dev, False)
12
+ assert dev.is_on is False
13
13
 
14
14
  await dev.set_brightness(99)
15
15
  await dev.update()
16
16
  assert dev.brightness == 99
17
- assert dev.is_on == turn_on
17
+ assert dev.is_on is True
18
18
 
19
19
  await dev.set_brightness(0)
20
20
  await dev.update()
21
- assert dev.brightness == 1
22
- assert dev.is_on == turn_on
21
+ assert dev.brightness == 99
22
+ assert dev.is_on is False
23
23
 
24
24
 
25
25
  @dimmer_iot
@@ -41,7 +41,7 @@ async def test_set_brightness_transition(dev, turn_on, mocker):
41
41
 
42
42
  await dev.set_brightness(0, transition=1000)
43
43
  await dev.update()
44
- assert dev.brightness == 1
44
+ assert dev.is_on is False
45
45
 
46
46
 
47
47
  @dimmer_iot
@@ -50,7 +50,7 @@ async def test_set_brightness_invalid(dev):
50
50
  with pytest.raises(ValueError):
51
51
  await dev.set_brightness(invalid_brightness)
52
52
 
53
- for invalid_transition in [-1, 0, 0.5]:
53
+ for invalid_transition in [-1, 0.5]:
54
54
  with pytest.raises(ValueError):
55
55
  await dev.set_brightness(1, transition=invalid_transition)
56
56
 
@@ -133,7 +133,7 @@ async def test_set_dimmer_transition_invalid(dev):
133
133
  with pytest.raises(ValueError):
134
134
  await dev.set_dimmer_transition(invalid_brightness, 1000)
135
135
 
136
- for invalid_transition in [-1, 0, 0.5]:
136
+ for invalid_transition in [-1, 0.5]:
137
137
  with pytest.raises(ValueError):
138
138
  await dev.set_dimmer_transition(1, invalid_transition)
139
139
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-kasa"
3
- version = "0.7.0.dev0"
3
+ version = "0.7.0.dev1"
4
4
  description = "Python API for TP-Link Kasa Smarthome devices"
5
5
  license = "GPL-3.0-or-later"
6
6
  authors = ["python-kasa developers"]