ixs / knxcal

iCal to KNX Gateway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

knxcal

iCal to KNX Gateway

This was a custom engineering effort to allow sending values onto a KNX bus depending on a Google calendar feed. The requirement was to send different values depending on time until an event. e.g. 3 days before the event, send a value of 3, 2 days before the event, send a value of 2, 1 day before the event, send a value of 1. After the event has concluded, send a 0.

Docker Usage instructions

  1. checkout code to your local machine
git clone https://github.com/ixs/knxcal.git
  1. build a docker image
cd knxcal
docker build --tag knxcal:latest .
  1. run the application as a docker image
docker run --rm -it knxcal:latest

or with debug and disabled BUS access for testing

docker run --rm -it -e DEBUG=1 -e NOKNX=1 knxcal:latest

Native Usage instructions

  1. checkout code to your local machine
git clone https://github.com/ixs/knxcal.git
  1. ensure dependencies are installed
cd knxcal
pip3 install -r requirements.txt
  1. run the application
./knxcal.py

Configuration

The configuration is done throught the knxcal.ini file.

Section [knxcal] (required)

  • iCalURL: The URL to the iCal file
  • eventName: What event to trigger on
  • checkFrequency: How often do we check for new events, currently not used
  • stateFile: The file that is used to keep state what event already got notified

Section [connection] (optional)

  • type: Connection type to the KNX bus: auto, tunneling, routing
  • gateway_ip: IP of the gateway, required for tunneling, optional otherwise
  • gateway_port: UDP Port listening on the gateway, optional
  • local_ip: The local IP to bind to, optional
  • auto_reconnect: Reconnect automatically when connection lost

Section [heartbeat]

  • frequency; How often in minutes should a heartbeat be sent to the bus
  • address: KNX Group Address to send to
  • dtp: Data type to send
  • value: Value to send

Section [trigger*]

This defines the trigger for an event. Can exist multiple times, names must be unique though. e.g. trigger1, trigger99, triggerabc are all acceptable names, they just need to start with trigger.

  • offset: Hours to event, when to trigger
  • base: begin or end, count the offset from either end or beginning of the event.
  • address: The KNX group address to notify
  • dpt: The KNX data point type to send
  • value: The KNX value to send

Command line arguments

Options:
  --debug     Debug output
  --no-knx    Disable KNX bus access
  --no-state  Disable state keeping
  --log FILE  Log to file FILE
  --help      Show this message and exit.

About

iCal to KNX Gateway

License:GNU General Public License v3.0


Languages

Language:Python 96.9%Language:Dockerfile 3.1%