pepsifan92 / pcf8574control

Controlling the chip pcf8574 (Port expander) via I2C from Raspberry Pi from openHAB
2 stars 0 forks source link

pcf8574control

Controlling the chip pcf8574 (Port expander) via I2C from Raspberry Pi from openHAB

The chip PCF8591 is an I2C-Bus Portexpander and provides setting and getting the state of 8 Pins. A Pin can be HIGH or LOW.
Addressrange of PCF8574: 32-39 (0x20-0x27)
Addressrange of PCF8574A: 56-63 (0x38-0x3F)
Pinrange of PCF8574: 0-7
This binding supports reading and writing of pin-states.

Config in *.item file

In the items-file of openHAB the following configuration is needed:
Contact Name-of-Item { pcf8574control="I2CAddressInDecimal;PinNumber;direction" }

Input-Pin example:
Contact motionSensor { pcf8574control="32;0;in" }
This would get the state of the Pin 0 from the PCF8574 chip with the address 0x20 (32 in decimal)

Output-Pin example:
Contact led { pcf8574control="32;1;out" }
This would set the state of the Pin 0 from the PCF8574 chip with the address 0x20 (32 in decimal)

Config in *.sitemap file

Example to show the read value on the website:
Text item=motionSensor label="motionSensor: [%s]"

Example to set Pin from the website:
Switch item=led