node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

pimatic-pcf8574

npm version build status

pimatic-pcf8574

pimatic-pcf8574 is a pimatic plugin that enables PCF8574 portexpander ICs to be used as Switch, ContactSensor, PresenceSensor or ShutterController.

The PCF8574/PCF8574A is an 8 bit/pin port expander IC, which can be controlled over the I2C-Bus. Each of the 8 pins can be separately used as an input or output. It also offers an interrupt signal, which can be used to detect input changes by the I2C master (e.g. a Raspberry Pi). For more information about the PCF8574/PCF8574A please consult the datasheet from Texas Instruments.

Localizations

Included localizations for device configs:

  • en - English
  • de - German

Feel free to submit more localized device-config-schema-xx.coffee files.

Installation

You can simply install this plugin via the frontend. After the installation you have to restart pimatic.

Alternatively you can add it manually to the config.json of pimatic:

{
  "plugin": "pcf8574",
  "i2cBusNr": 1
}

This will fetch the most recent version from npm-registry on the next pimatic start and install the plugin.

Configuration

The whole configuration can be made via the frontend in the Devices section.

You have to add one PCF8574IC device first, because the other devices will need this.

Device PCF8574IC

This is a basic device which provides the inputs and outputs (8 pins) for the other devices.

You have to set the address of the IC.

Optionally you can enable the detection of input changes using an interrupt or using active polling. If you need input change detection you should prefer using the interrupt, because polling leeds to a higher load on the I2C bus.

The pin number of the interrupt pin must to be the BCM pin number of the Raspberry Pi. (see https://de.pinout.xyz/)

PCF8574ContactSensor, PCF8574PresenceSensor, PCF8574Switch and PCF8574Shutter

All other devices (PCF8574ContactSensor, PCF8574PresenceSensor, PCF8574Switch and PCF8574Shutter) needs an PCF8574IC device and a pin number of the IC. Also you can define each pin as inverted, which assumes that the hardware inverts the logical signal.

A PCF8574Shutter device needs two PCF8574IC devices (which can be the same device) and also two pin numbers for up and down.

License

Licensed under GPL Version 2

Copyright (c) 2017 Peter Müller peter@crycode.de (https://crycode.de/)