Skip to content

DarkC35/catflap-magnet

Repository files navigation

Catflap Magnet

Small Raspberry Pi python application that sends "OPEN" or "CLOSED" state of a magnet sensor to an openHAB Contact Item according to the settings in .env.

Please be aware that in my setup the magnet sensor has no contact in the default position and is OPEN/"active" when the flap swings so that there is a short contact at the sensor. Therefore you maybe have to switch the state values in the .env file according to your setup.

Setup

  1. Install git and pip3
sudo apt-get update && sudo apt-get install git python3-pip -y
  1. Clone the Repo
git clone /~https://github.com/DarkC35/catflap-magnet
cd catflap-magnet
  1. Install requirements
sudo pip3 install -r requirements.txt
  1. Set required env values
cp .env.sample .env
nano .env
OPENHAB_THING_STATE_URL=http://<openhab-host>:<openhab-port>/rest/items/<contact-item-name>/state
MAGNET_PIN=<gpio-pin-number>
ACTIVATED_STATE=OPEN
DEACTIVATED_STATE=CLOSED
  1. Install system unit
# chmod +x install.sh
./install.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published