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

default.sitemap

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

default.items

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

gpio.things

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

default.rules

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

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: