Git Product home page Git Product logo

laurentalacoque / raspberry-gpiobridge Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 90 KB

Somfy gate motors can easily be controlled using RFXCOM module but don't provide a way to know the current gate state. This software is a gate state tracking daemon. It monitors the Motor command using GPIO and expose them on a webserver and can push them to a remote webserver.

License: GNU General Public License v3.0

Makefile 2.53% C 94.42% Shell 3.05%

raspberry-gpiobridge's Introduction

raspberry-gpiobridge

What it is

This is a raspberry daemon that helps keep track of my Somfy freevia motor state.

The motor M1+- signals are connected to raspberry GPIO 0/1 (Through optocoupler)

This daemon keeps track of the gate state (open, opening, closed, closing), logs theses states in a sqlite3 database, push them to a web server (only GET requests) and starts and embedded webserver to report the current state (pull).

Hardware

You will need handmade hardware for this to work: you should connect your somfy motor output (i.e. the part that goes to the motor) to a dedicated board (see Raspberry-gate-interface.png file in the source for inspiration). Caution: this was made for a motor output of +-20V, you should adapt the 1k7 input resistor to your own motor output voltage.

Internal webserver pages

/gateState

This page contains a single digit (0/1) to report if the state is closed/open

/gateStateFull

This page contains a single digit (0-4) to report the gate state

0: unknown

1: opening

2: open

3: closing

4: closed

/gateStateHuman

This page contains a human readable state for the gate state.

Push URLs

Apart from pulling some information from the raspberry, you can push events to a webserver or home automation box

configuration

For push operations to work, you need to indicate the push host, port and URL in the configuration file and launch gatekeeper -c <pathtoconfiguration>

Say you want to report (simple) states to host 192.168.0.200 on port 80 with an url /logdata?key=mystate&value=<thenewvalue>

The <thenewvalue> part is easily replaced by the new value placeholder @@

pushHost           = "192.168.0.200"; // host to push to
pushPort           = 80; //push port
pushCoarseEvents   = 1; //should we push coarse events? (open, closed), use '@@' as placeholder for the value
PCEURL             = "/logdata?key=mystate&value=@@";

jeedom configuration

Let's take an example. Suppose you've got a jeedom box on the same network at adress 192.168.0.200

You already configured a virtual element "Gate State" and added two informations lines "state" (binary) and "full state" (numeric)

You can check the ids of both informations on the left of the virtual element configuration page. Let's say that "state" has id 350 and "full state" has id 351.

You'll also need to get your API key from the configuration page.

Then change the configuration file to this :

pushHost           = "192.168.0.200"; // host to push to
pushPort           = 80; //push port
pushDetailedEvents = 1; //should we push detailed events? (opening, open, closing, closed), use '@@' as placeholder for the value
PDEURL             = "/core/api/jeeApi.php?api=<YOURAPIKEY>&type=virtual&id=351&value=@@";
pushCoarseEvents   = 1; //should we push coarse events? (open, closed), use '@@' as placeholder for the value
PCEURL             = "/core/api/jeeApi.php?api=<YOURAPIKEY>&type=virtual&id=367&value=@@";

raspberry-gpiobridge's People

Contributors

laurentalacoque avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.