package com.github.thomasfischl.aihome.controller.sensor;

import com.github.thomasfischl.aihome.communication.sensor.SensorData;
import com.github.thomasfischl.aihome.communication.sensor.SensorDataType;
import com.github.thomasfischl.aihome.controller.pi.PiMicroController;

public class GPIOSensorAdaptor extends AbstractSensorAdaptor {

  private PiMicroController controller = PiMicroController.getInstance();

  public GPIOSensorAdaptor() {
    super("BTN", SensorDataType.BOOL);
  }

  @Override
  public SensorData process() {
    return createSensorData(Boolean.toString(controller.isButtonPressed()));
  }

}

@@ -419,16 +419,52 @@
 e();%0D%0A%0D%0A
+  private boolean state = false;%0D%0A%0D%0A
   public
@@ -483,24 +483,24 @@
 daptor() %7B%0D%0A
-
     super(%22B
@@ -588,77 +588,123 @@
     
-return createSensorData(Boolean.toString(controller.isButtonPressed()
+if (controller.isButtonPressed()) %7B%0D%0A      state = !state;%0D%0A    %7D%0D%0A    return createSensorData(String.valueOf(state
 ));%0D

Fix behavior of the GPIOSensorAdaptor * use an internal toggle state