Rflink: added support for lights with toggle type (#6521)

* added support for lights with toggle type

* fixed style errors

* introduced tests for the toggle type

it's not passing yet because of an assertionerror at line 407

* updated to reflect tristate of "state"

* Format code according to pep8

Added line break for import that was too long.

* fixed lint, replaced if statement with 'var = bool(test)'

* changed implementation of state check according to bug on 6bceb04ca1 (r106758784)
This commit is contained in:
martinfrancois 2017-03-18 21:34:17 +01:00 committed by Pascal Vizeli
parent 4e91c65d6e
commit 678f273002
3 changed files with 92 additions and 3 deletions

View file

@ -316,6 +316,12 @@ class RflinkCommand(RflinkDevice):
cmd = str(int(args[0] / 17))
self._state = True
elif command == 'toggle':
cmd = 'on'
# if the state is unknown or false, it gets set as true
# if the state is true, it gets set as false
self._state = self._state in [STATE_UNKNOWN, False]
# Send initial command and queue repetitions.
# This allows the entity state to be updated quickly and not having to
# wait for all repetitions to be sent