Good morning all
Please i have been stock with this GPIO bindings on openhab2 runing on rasbian. Installed the binding from the paper UI but it dos not work i have tried different ways but it did not still work
Hello, @Chenko
We will need more info in order to be able to help.
See:
Okay
I have installed openhab2 on raspbian buster the openhab is running well. I installed the gpio bindings from the paper UI an created few items and sitemaps. On the basic ui i can see the sitemap but wen i click on an switch there is no change in state on my gpios on the raspberry (i hv led and some relays)
I have not used the GPIO binding so I can’t offer much help there, but maybe my MQTTany software could help? It allows you to control the GPIO pins via MQTT.
Can you post your items and sitemap, please
This are the items
Switch LED “LED” { gpio=“pin:21” }
//Relays
Switch channel1 “Channel 1” { gpio=“pin:26 activelow:yes initialValue:high” }
Switch channel2 “Channel 2” { gpio=“pin:19 activelow:yes initialValue:low” }
Switch channel3 “Channel 3” { gpio=“pin:13 activelow:yes”}
Switch channel4 “Channel 4” { gpio=“pin:6 activelow:no”}
Contact DoorSensor “Door Sensor [%s]” { gpio=“pin:16 debounce:10 activelow:yes” }
Contact Button “Button [%s]” { gpio=“pin:24 activelow:yes” }
This are the sitemaps Sitemaps
Switch item=LED
Switch item=channel1
Switch item=channel2
Switch item=channel3
Switch item=channel4
Text item=Button
Text item=DoorSensor
I don’t use the GPIO Binding myself but after reading the doc, the setup is quite involved.
Did you follow all the steps?
Yes i did follow the steps carefully
Okay please what do you use to control local devices in you network. Let me try that
Okay how to i go about with that please
Have a look at the Wiki on the github page I linked to for instructions on how to configure MQTTany. You will then need to setup the MQTT binding for openHAB and create channels for each pin. You can then link those channels to your items.
I will try to give you some more specific examples tomorrow, based on the items file above.
Okay nice i will look at githop and wiki too while waiting for the specifics
So I’ve written up a simple config file for MQTTany, the things you will need to get the MQTT messages into openHAB, and the items file to connect those things. You sitemap will not need to be changed.
You will need to install and configure an MQTT server and the MQTT binding. If you are running openHABian you can use the configuration tool to simplify installing an MQTT server, see here.
In the following examples you will need to replace MQTT_HOST
with the hostname or address of the computer running MQTT, if you are using openHABian it will be openHABian
. You will also need to replace MQTTANY_HOST
with the hostname of the computer running MQTTany, in your case this will be the same as MQTT_HOST
and I suspect you should use openHABian
.
mqttany.yml
mqtt:
host: MQTT_HOST
gpio:
polling interval: 60
debounce: 10
led:
pin: 21
topic: '/{root_topic}/led'
direction: 'output'
channel1:
pin: 26
topic: '/{root_topic}/relay/1'
direction: 'output'
invert: true
channel2:
pin: 19
topic: '/{root_topic}/relay/2'
direction: 'output'
invert: true
channel3:
pin: 13
topic: '/{root_topic}/relay/3'
direction: 'output'
invert: true
channel4:
pin: 6
topic: '/{root_topic}/relay/4'
direction: 'output'
door:
pin: 16
topic: '/{root_topic}/door'
invert: true
button:
pin: 24
topic: '/{root_topic}/button'
invert: true
things
Bridge mqtt:broker:openhab [ host="MQTT_HOST" ] {
Thing topic led {
Channels:
Type switch : led "LED" [ stateTopic="MQTTANY_HOST/led", commandTopic="MQTTANY_HOST/led/set", on="ON", off="OFF" ]
}
Thing topic relays {
Channels:
Type switch : channel1 "Relay Channel 1" [ stateTopic="MQTTANY_HOST/relay/1", commandTopic="MQTTANY_HOST/relay/1/set", on="ON", off="OFF" ]
Type switch : channel2 "Relay Channel 2" [ stateTopic="MQTTANY_HOST/relay/2", commandTopic="MQTTANY_HOST/relay/2/set", on="ON", off="OFF" ]
Type switch : channel3 "Relay Channel 3" [ stateTopic="MQTTANY_HOST/relay/3", commandTopic="MQTTANY_HOST/relay/3/set", on="ON", off="OFF" ]
Type switch : channel4 "Relay Channel 4" [ stateTopic="MQTTANY_HOST/relay/4", commandTopic="MQTTANY_HOST/relay/4/set", on="ON", off="OFF" ]
}
Thing topic door {
Channels:
Type contact : sensor "Door Sensor" [ stateTopic="MQTTANY_HOST/door", on="ON", off="OFF" ]
}
Thing topic button {
Channels:
Type contact : button "Button" [ stateTopic="MQTTANY_HOST/button", on="ON", off="OFF" ]
}
}
items
Switch LED "LED" { channel="mqtt:topic:openhab:led:led" }
//Relays
Switch channel1 "Channel 1" { channel="mqtt:topic:openhab:relay:channel1" }
Switch channel2 "Channel 2" { channel="mqtt:topic:openhab:relay:channel2" }
Switch channel3 "Channel 3" { channel="mqtt:topic:openhab:relay:channel3" }
Switch channel4 "Channel 4" { channel="mqtt:topic:openhab:relay:channel4" }
Contact DoorSensor "Door Sensor [%s]" { channel="mqtt:topic:openhab:door:sensor" }
Contact Button "Button [%s]" { channel="mqtt:topic:openhab:button:button" }
Thank u alot i am going to try this immediately