GPIO input and contact

Hi I’ve got my openhab working great on my pi and have made it run a couple relays to open my garage door and heater. I’ve also got it running RFoutlet to control some of my 433hz devices. However I have a wired door sensor going into my GPIO and looking for a good walk through on how to use the contact in items and sitemaps with GPIOs. Anyone know a good walk through? I have it added to my items however on my sitemap I see nothing.

If you already have the Item set up it is as simple as adding

Text item=MyContact

to your sitemap file.

See the sitemap docs for full documentation:

http://docs.openhab.org/configuration/sitemaps.html

Hi yes I have that but it always just says unknow
here is what i have in .items

Contact FD "Front Door [MAP(fd.map):%s]" (Outdoor) {gpio="pin:22"}

and in .sitemap

Text item=FD

and in tranform/fd.map

OPEN=open
CLOSED=closed
undefined=unknown
-=unknown

I was reading that alot of people were having problems with inputs using the GPIO binding and Jessie Pi build…is that still true?

1 Like

People have always had trouble with the GPIO binding in OH. It is one of the top five difficult bindings to get working correctly.

Look in the log for errors from the binding.

Make sure the openhab user is a member of GPIO or run OH as root. I think running as root is still required if you installed using openHABian.

I just added openhab to gpio group and that did it

just did that and worked!

sorry - any idea about why i don’t have a GPIO group? openhabian 2 on raspi 3

Thanks for sharing your item, sitemap and transform files! It was the last information I needed for adding my physical buttons to the rest of OpenHAB :smiley: