Default GPIO PIN state after openHAB reboot

Hi everybody,
I have to control a door triggering a zero level activation relay for a short period (700ms).
With “zero level activation relay” I mean that the relay is excited when Raspberry voltage is zero volts on a certain GPIO PIN.
I’m running openHAB 3.2.0 stable on a Raspberry Pi 3 model B with openjdk 11.0.12 2021-07-20 LTS (installed with openHABian image).

Below you can find the code that I’ve written; once openHAB has finished its boot, this code works perfectly.
But if I restart openHAB, at the end of the restart, the relay remains constantly excited (PIN voltage detected: zero volts).
Only after having sent the first impulse (clicking on the item on the UI), the relay switches off and from this moment, the operation is regular.

What should I set or how should I change the configuration in order to reach the behaviour that, in absence of commands, the relay remains off during and after the restart of openHAB (the state of the GPIO13 must remain constant at 3.3V throughout the bootstrap period)?

Thanks in advance


sitemap default label="Test" {
	Switch item=DoorSwitch label="Door" mappings=[ON="CLICKME"]


Switch DoorSwitch <switch> {channel="gpio:pigpio-remote:sample-pi-1:door-command"}


Thing gpio:pigpio-remote:sample-pi-1 "GPIO locale" [host="::1", port=8888] {
   Type pigpio-digital-output : door-command [ gpioId=13, invert=true ]  


rule "Door - Command"
  Item DoorSwitch received command ON
  try {
    if (lockDoor.tryLock ()) {
      Thread::sleep (700)
      DoorSwitch.sendCommand (OFF)
      lockDoor.unlock ()
    } // if
  } catch (Exception e) {
    logInfo("Generic exception")
  } // try - catch

No solution but some insights:

1 Like

Thanks for your answer, I’ve solved my problem putting a PIN initialization on system startup with:

sudo nano /etc/rc.local

and putting before the “exit 0” final command a line:

pigs w 13 1      #DoorSwitch command

I think it would be better if GPIO Binding had a default value for output channel somewhere in the configuration. :grinning: