diff --git a/homeassistant/components/binary_sensor/rpi_gpio.py b/homeassistant/components/binary_sensor/rpi_gpio.py index 03978ac625b..eaf9ee737e5 100644 --- a/homeassistant/components/binary_sensor/rpi_gpio.py +++ b/homeassistant/components/binary_sensor/rpi_gpio.py @@ -51,7 +51,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): for port_num, port_name in ports.items(): binary_sensors.append(RPiGPIOBinarySensor( port_name, port_num, pull_mode, bouncetime, invert_logic)) - add_devices(binary_sensors) + add_devices(binary_sensors, True) class RPiGPIOBinarySensor(BinarySensorDevice): @@ -65,9 +65,9 @@ class RPiGPIOBinarySensor(BinarySensorDevice): self._pull_mode = pull_mode self._bouncetime = bouncetime self._invert_logic = invert_logic + self._state = None rpi_gpio.setup_input(self._port, self._pull_mode) - self._state = rpi_gpio.read_input(self._port) def read_gpio(port): """Read state from GPIO.""" @@ -90,3 +90,7 @@ class RPiGPIOBinarySensor(BinarySensorDevice): def is_on(self): """Return the state of the entity.""" return self._state != self._invert_logic + + def update(self): + """Update the GPIO state.""" + self._state = rpi_gpio.read_input(self._port)