Updated external content (Jenkins build 1756)

pull/2219/head
openHAB Build Server 2023-10-31 05:41:47 +00:00
parent a8c38b3670
commit 4a9d9e8df5
2 changed files with 358 additions and 44 deletions

View File

@ -3,7 +3,7 @@ id: gpio
label: GPIO
title: GPIO - Bindings
type: binding
description: "This binding adds GPIO support via the pigpio daemon to openhab."
description: "This binding adds GPIO support via the pigpiod daemon to openHAB."
since: 3x
install: auto
---
@ -14,20 +14,20 @@ install: auto
# GPIO Binding
This binding adds GPIO support via the pigpio daemon to openhab.
It requires the pigpio (<http://abyz.me.uk/rpi/pigpio/>) to be running on the pi that should be controlled.
This binding adds GPIO support via the pigpiod daemon to openHAB.
It requires the pigpiod daemon (<http://abyz.me.uk/rpi/pigpio/>) to be installed on the pi that should be controlled.
## Supported Things
### pigpio-remote
This thing represents a remote pigpio instance running as daemon on a raspberry pi.
This thing represents a remote pigpiod instance running as daemon on a raspberry pi.
## Thing Configuration
### Pigpio Remote (`pigpio-remote`)
On a raspberry (or a compatible device) you have to install pigpio:
On a raspberry (or a compatible device) you have to install pigpiod.
```shell
sudo apt-get install pigpiod
@ -53,71 +53,204 @@ ExecStart=/usr/bin/pigpiod
sudo systemctl daemon-reload
```
Now that Remote GPIO is enabled, get the daemon going (even if installed with apt-get):
Now that Remote GPIO is enabled, get the pigpiod daemon going (even if installed with apt-get):
```shell
sudo systemctl enable pigpiod
sudo systemctl start pigpiod
```
In openHAB, set `host` to the address of the pi and the `port` to the port of pigpio (default: 8888).
## General Configuration
Note: If you are running Pigpio on same host as openHAB, then set host to **::1**.
Binding general configuration options. If you do not see all options, ensure `Show Advanced` is selected.
### Host
Set `Host` to the address of the Pi that pigpiod is running on. Default is 127.0.0.1 (IPV4).
Note: If you are running pigpiod on same host as openHAB, set the host to 127.0.0.1 (IPV4) or ::1 (IPV6).
### Port
Set `Port` to the network port that pigpiod is listening on. Default is 8888.
### Heart Beat Interval
The binding will poll pigpiod running on the Pi to determine if a network disconnect has occurred.
This is the interval in milliseconds that the heart beat poll occurs. Defaults to 30000 (30 seconds).
## Input Channel Connect Action
Input Channel Connect Action determines what happens when the binding initially connects to pigpiod.
This action only occurs once after binding startup.
- **Do Nothing:** The default, do nothing. Input channels will retain their default value (UNDEF).
- **Refresh Channel:** Issues a refresh command on the input channels. This will refresh the channels from pigpiod causing the gpio pin state to reflect on the channel state.
Input Channel Disconnect Connect Action:
### Input Channel Disconnect Connect Action
Input Channel Disconnect Connect Action determines what happens when the binding disconnects from pigpiod.
- **Do Nothing:** The default, do nothing. Input channels will retain their current value.
- **Set Undef:** Sets the input channel states to UNDEF to indicate that pigpiod has disconnected.
### Input Channel Reconnect Connect Action
Input Channel Reconnect Action determines what happens when the binding reconnects to pigpiod
after a disconnect. This action does not occur on the initial binding connect to pigpiod.
startup.
- **Do Nothing:** The default, do nothing. Input channels will retain their current value.
- **Refresh Channel:** Issues a refresh command on the input channels. This will refresh the channels from
pigpiod causing the gpio pin state to reflect on the channel state.
### Output Channel Connect Action
Output Channel Connect Action determines what happens when the binding initially connects to pigpiod.
This action only occurs once after binding startup.
- **Do Nothing:** The default, do nothing. Output channels will retain their default value (UNDEF).
- **All On:** Issues a ON command to all configured output channels.
- **All Off:** Issues a OFF command to all configured output channels.
- **Refresh Channel:** Issues a refresh command on the output channels. This will refresh the channels from
pigpiod causing the gpio pin state to reflect on the channel state. NOTE: This does
not update the gpio pin state on the Pi itself. It only updates the channel state
within openHAB.
### Output Channel Disconnect Connect Action
Output Channel Disconnect Connect Action determines what happens when the binding disconnects from pigpiod.
- **Do Nothing:** he default, do nothing. Input channels will retain their current value.
- **Set Undef:** Sets the output channel states to UNDEF to indicate that pigpiod has disconnected.
### Output Channel Reconnect Connect Action
Output Channel Reconnect Action determines what happens when the binding reconnects to pigpiod
after a disconnect. This action does not occur on the initial binding connect to pigpiod.
- **Do Nothing:** The default, do nothing. Output channels will retain their current value.
- **Refresh Channel:** Issues a refresh command on the output channels. This will refresh the channels from
pigpiod causing the gpio pin state to reflect on the channel state. NOTE: This does
not update the gpio pin state on the Pi itself. It only updates the channel state
within openHAB.
## Channels
### Pigpio Remote
The binding has two channel types.
One for gpio input pins, and another for gpio output pins.
| channel | type | description |
|-----------------------|--------|---------------------------------|
| pigpio-digital-input | Switch | Read-only value of the gpio pin |
| pigpio-digital-output | Switch | Controls the gpio pin |
### GPIO digital input channel
### GPIO pigpio-digital-input channel configuration
Set the number of the pin in `gpioId`.
If you want to invert the value, set `invert` to true.
To prevent incorrect change events, you can adjust the `debouncingTime`.
Using `pullupdown` you can enable pull up or pull down resistor (OFF = Off, DOWN = Pull Down, UP = Pull Up).
Input channels provide a read-only value of the gpio pin state using the `OnOffType` datatype.
### GPIO digital output channel
GPIO Pin:
Set the number of the pin in `gpioId`.
If you want to invert the value, set `invert` to true.
The gpio pin number on the Pi that the channel will monitor.
## Full Example
Invert:
Inverts the value of the gpio pin before reflecting the value on the channel.
Useful for active low gpio pins where you want the channel state to reflect an ON value when the pin is low (OFF).
Delay Time:
Sets a delay value in milliseconds that the gpio pin must remain at prior to updating the channel state.
This is the same as switch debouncing or hysteresis.
Default value is 10 milliseconds.
Increase this value for noisy inputs.
Pull Up/Down Resistor:
Sets the mode of operation for the internal pull up/ down resistor on the gpio pin.
Set this to OFF if you use external pull up/down resistors.
Edge Detection Mode:
Sets the mode of operation for the pin edge detection mode.
If you are not sure what the use case is for this, leave at the default value of `Either Edge`.
This is the most common mode that gpio inputs are used.
### GPIO pigpio-digital-output channel configuration
Output channels provide a means of controlling the output value of the gpio pin using the `OnOffType` datatype.
GPIO Pin:
The gpio pin number on the Pi that the channel will control.
Invert:
Inverts the value of the channel state before commanding the gpio pin.
Useful to simulate active low gpio pins.
Pulse:
Time in milliseconds that must elapse before the Pulse Command is sent to the channel.
Default value is 0, which disables the Pulse feature.
Pulse Command:
Together with the Pulse configuration, can be used to create a one shot or momentary output.
This is useful to simulate momentary button presses or to drive motors for a predefined amount
of time.
- **Off:** When the ON command is issued to the channel. The Pulse feature will send an OFF command
after the Pulse duration.
- **On:** When the OFF command is issued to the channel. The Pulse feature will send an
ON command after the Pulse duration.
- **Blink:** Cycles the channel ON, OFF, ON indefinitely with a 50% duty cycle. The Blink
operation continues regardless of the commanded channel state. This was originaly
developed as a way to flash a status LED to visually confirm that a remote pigpiod
instance has connectivity to openHAB.
## Config file example
Example for users who still prefer configuration files.
demo.things:
```java
Thing gpio:pigpio-remote:sample-pi-1 "Sample-Pi 1" [host="192.168.2.36", port=8888] {
Channels:
Type pigpio-digital-input : sample-input-1 [ gpioId=10]
Type pigpio-digital-input : sample-input-2 [ gpioId=14, invert=true]
Type pigpio-digital-output : sample-output-1 [ gpioId=3]
}
Thing gpio:pigpio-remote:mypi "MyPi GPIO" [ host="192.168.1.5", port=8888,
heartBeatInterval=10000,
inputConnectAction="REFRESH", # REFRESH,NOTHING
inputDisconnectAction="NOTHING", # SETUNDEF,NOTHING
inputReconnectAction="REFRESH", # REFRESH,NOTHING
outputConnectAction="REFRESH", # ALLOFF,ALLON,REFRESH,NOTHING
outputDisconnectAction="SETUNDEF", # SETUNDEF,NOTHING
outputReconnectAction="REFRESH" ] # REFRESH,NOTHING
{
Channels:
Type pigpio-digital-output : BCM18 [ gpioId=18,invert=false,pulse=3000,pulseCommand="BLINK" ] # OFF,ON,BLINK
Thing gpio:pigpio-remote:sample-pi-2 "Sample-Pi 2" [host="192.168.2.37", port=8888] {
Channels:
Type pigpio-digital-input : sample-input-3 [ gpioId=16, debouncingTime=20]
Type pigpio-digital-input : sample-input-4 [ gpioId=17, invert=true, debouncingTime=5, pullupdown="UP"]
Type pigpio-digital-output : sample-output-2 [ gpioId=4, invert=true]
}
Type pigpio-digital-output : GPO4 [ gpioId=4, invert=true,pulse=5000,pulseCommand="OFF" ]
Type pigpio-digital-output : GPO17 [ gpioId=17,invert=false,pulse=500,pulseCommand="ON" ]
Type pigpio-digital-output : GPO27 [ gpioId=27,invert=false ]
Type pigpio-digital-output : GPO22 [ gpioId=22,invert=true ]
Type pigpio-digital-input : GPI23 [ gpioId=23,debouncingTime=50,pullupdown="UP",invert=true ] # OFF,DOWN,UP
Type pigpio-digital-input : GPI24 [ gpioId=24,debouncingTime=50,pullupdown="UP",invert=true ]
Type pigpio-digital-input : GPI25 [ gpioId=25,debouncingTime=50,pullupdown="UP",invert=true ]
Type pigpio-digital-input : GPI12 [ gpioId=12,debouncingTime=50,pullupdown="UP",invert=true ]
Type pigpio-digital-input : GPI16 [ gpioId=16,debouncingTime=50,pullupdown="UP",invert=true ]
Type pigpio-digital-input : GPI20 [ gpioId=20,debouncingTime=50,pullupdown="UP",invert=true,edgeMode="EDGE_EITHER" ] # EITHER,RISING,FALLING
Type pigpio-digital-input : GPI21 [ gpioId=21,debouncingTime=50,pullupdown="UP",invert=true,edgeMode="EDGE_RISING" ]
Type pigpio-digital-input : GPI5 [ gpioId=5, debouncingTime=50,pullupdown="UP",invert=true,edgeMode="EDGE_FALLING" ]
Type pigpio-digital-input : GPI6 [ gpioId=6, debouncingTime=50,pullupdown="UP",invert=true ]
Type pigpio-digital-input : GPI13 [ gpioId=13,debouncingTime=50,pullupdown="DOWN",invert=false ]
Type pigpio-digital-input : GPI26 [ gpioId=26,debouncingTime=50,pullupdown="OFF",invert=false ]
}
```
demo.items:
```java
Switch SampleInput1 {channel="gpio:pigpio-remote:sample-pi-1:sample-input-1"}
Switch SampleOutput1 {channel="gpio:pigpio-remote:sample-pi-1:sample-output-1"}
```
demo.sitemap:
```perl
sitemap demo label="Main Menu"
{
Switch item=SampleInput1
Switch item=SampleOutput1
}
Switch SampleInput1 {channel="gpio:pigpio-remote:mypi:GPI23"}
Switch SampleOutput1 {channel="gpio:pigpio-remote:mypi:GPO4"}
```

View File

@ -18,6 +18,7 @@
<context>network_address</context>
<label>Network Address</label>
<description>Network address of the Raspberry Pi.</description>
<default>127.0.0.1</default>
</parameter>
<parameter name="port" type="integer" min="0" max="65535">
<context>port</context>
@ -25,6 +26,141 @@
<description>Port of pigpio on the remote Raspberry Pi.</description>
<default>8888</default>
</parameter>
<parameter name="heartBeatInterval" type="integer" min="100" max="2147483647">
<context>time</context>
<label>Heart Beat Interval</label>
<description>
Time in ms to send CMD_TICK calls on the communication socket.
Used to detect and recover from pigpiod
disconnects.
</description>
<default>30000</default>
<advanced>true</advanced>
</parameter>
<parameter name="inputConnectAction" type="text">
<label>Input Channel Connect Action</label>
<description>
When a pigpiod connection is first established after
binding INITIALIZATION.
The desired action to
perform on input channels.
REFRESH: Send a REFRESH command
to the channel.
NOTHING: Leave
all channels
at their
current
state.
</description>
<options>
<option value="REFRESH">Refresh Channel</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
<parameter name="inputDisconnectAction" type="text">
<label>Input Channel Disconnect Action</label>
<description>
When a pigpiod disconnect is encountered.
The desired action to perform on input channel.
SETUNDEF: Set
all configured channels to UNDEF.
NOTHING: Leave all channels at their current state.
</description>
<options>
<option value="SETUNDEF">Set Undef</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
<parameter name="inputReconnectAction" type="text">
<label>Input Channel Reconnect Action</label>
<description>
When a pigpiod connection is re-established after being disconnected.
The desired action to perform on
input channels.
REFRESH: Send a REFRESH command
to the channel.
NOTHING: Leave all
channels at their
current
state.
</description>
<options>
<option value="REFRESH">Refresh Channel</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
<parameter name="outputConnectAction" type="text">
<label>Output Channel Connect Action</label>
<description>
When a pigpiod connection is first established after
binding INITIALIZATION.
The desired action to
perform on outputs.
ALLOFF: Update the GPIO pin to OFF.
ALLON: Update the GPIO pin to ON.
REFRESH: Send a REFRESH
command
to the channel.
NOTHING: Leave all
channels at their current
state.
</description>
<options>
<option value="ALLOFF">All OFF</option>
<option value="ALLON">All ON</option>
<option value="REFRESH">Refresh Channel</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
<parameter name="outputDisconnectAction" type="text">
<label>Output Channel Disconnect Action</label>
<description>
When a pigpiod disconnect is encountered.
The desired action to perform on outputs.
SETUNDEF: Set all
configured channels to UNDEF.
NOTHING: Leave all channels at their current state.
</description>
<options>
<option value="SETUNDEF">Set Undef</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
<parameter name="outputReconnectAction" type="text">
<label>Output Channel Reconnect Action</label>
<description>
When a pigpiod connection is re-established after being disconnected.
The desired action to perform on
outputs.
REFRESH: Send a REFRESH command
to the channel.
NOTHING: Leave all
channels at their current
state.
</description>
<options>
<option value="REFRESH">Refresh Channel</option>
<option value="NOTHING">Do Nothing</option>
</options>
<limitToOptions>true</limitToOptions>
<default>NOTHING</default>
<advanced>true</advanced>
</parameter>
</config-description>
</thing-type>
@ -35,18 +171,28 @@
<state readOnly="true"/>
<config-description>
<parameter name="gpioId" type="integer" required="true">
<parameter name="gpioId" type="integer" required="true" min="1" max="2147483647">
<label>GPIO Pin</label>
<description>GPIO pin to use as input</description>
</parameter>
<parameter name="invert" type="boolean">
<default>false</default>
<label>Invert</label>
<description>
Inverts the GPIO pin state from the channel state.
Setting this to true can simulate an active low GPIO
pin.
</description>
</parameter>
<parameter name="debouncingTime" type="integer" min="0">
<context>time</context>
<label>Delay Time</label>
<description>Time in ms to double check if value hasn't changed</description>
<description>
Time in ms to double check if value hasn't changed.
Be sure that the maximum latency of your
network is
not greater than two times this value.
</description>
<default>10</default>
<advanced>true</advanced>
</parameter>
@ -61,6 +207,17 @@
<limitToOptions>true</limitToOptions>
<default>OFF</default>
</parameter>
<parameter name="edgeMode" type="text">
<label>Edge Detection Mode</label>
<description>Edge detection mode of the GPIO pin</description>
<options>
<option value="EDGE_EITHER">Either Edge</option>
<option value="EDGE_FALLING">Falling Edge</option>
<option value="EDGE_RISING">Rising Edge</option>
</options>
<limitToOptions>true</limitToOptions>
<default>EDGE_EITHER</default>
</parameter>
</config-description>
</channel-type>
@ -76,6 +233,30 @@
<parameter name="invert" type="boolean">
<default>false</default>
<label>Invert</label>
<description>
Inverts the GPIO pin state from the channel state.
Setting this to true can simulate an active low GPIO
pin.
</description>
</parameter>
<parameter name="pulse" type="integer" min="0" max="2147483647">
<label>Pulse</label>
<description>Issues the pulse command after the given number of milliseconds. Used to pulse outputs.</description>
<default>0</default>
</parameter>
<parameter name="pulseCommand" type="text">
<label>Pulse Command</label>
<description>The command to issue after the pulse duration to complete the pulse. Blink will alternate ON/OFF,
useful for beacons
or
flashing leds.</description>
<options>
<option value="OFF">Off</option>
<option value="ON">On</option>
<option value="BLINK">Blink</option>
</options>
<limitToOptions>true</limitToOptions>
<default>OFF</default>
</parameter>
</config-description>
</channel-type>