Fix initialization state for GPIO switches configured with inverted logic (#2550)

When switches are configured to use inverted logic, the GPIO pins initial
state has to be inverted as well (set to HIGH)
pull/2558/head
Daniel Zozin 2016-07-18 00:18:16 +02:00 committed by Paulus Schoutsen
parent ddcad275f7
commit 027266ed8b
1 changed files with 1 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class RPiGPIOSwitch(ToggleEntity):
self._invert_logic = invert_logic self._invert_logic = invert_logic
self._state = False self._state = False
rpi_gpio.setup_output(self._port) rpi_gpio.setup_output(self._port)
rpi_gpio.write_output(self._port, 1 if self._invert_logic else 0)
@property @property
def name(self): def name(self):