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:
Teemu R 2020-04-22 09:48:28 +02:00 committed by GitHub
parent 3fe578cf26
commit fd560442a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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}