mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-08 22:07:06 +00:00
Allow 0 brightness for smartdimmer (#47)
according to https://github.com/home-assistant/core/pull/33909/files#diff-9a900d2f83693dd3e01d2894bf1c6bffR452 the dimmers will accept 0 brightness which differs from turning it off
This commit is contained in:
parent
3fe578cf26
commit
fd560442a2
@ -52,7 +52,7 @@ class SmartDimmer(SmartPlug):
|
|||||||
When setting brightness, if the light is not
|
When setting brightness, if the light is not
|
||||||
already on, it will be turned on automatically.
|
already on, it will be turned on automatically.
|
||||||
|
|
||||||
:param value: integer between 1 and 100
|
:param value: integer between 0 and 100
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.is_dimmable:
|
if not self.is_dimmable:
|
||||||
@ -60,7 +60,7 @@ class SmartDimmer(SmartPlug):
|
|||||||
|
|
||||||
if not isinstance(value, int):
|
if not isinstance(value, int):
|
||||||
raise ValueError("Brightness must be integer, " "not of %s.", type(value))
|
raise ValueError("Brightness must be integer, " "not of %s.", type(value))
|
||||||
elif 0 < value <= 100:
|
elif 0 <= value <= 100:
|
||||||
await self.turn_on()
|
await self.turn_on()
|
||||||
await self._query_helper(
|
await self._query_helper(
|
||||||
"smartlife.iot.dimmer", "set_brightness", {"brightness": value}
|
"smartlife.iot.dimmer", "set_brightness", {"brightness": value}
|
||||||
|
Loading…
Reference in New Issue
Block a user