SynTexDZN / homebridge-syntex-knx

11 stars 2 forks source link

Homebridge SynTex KNX

NPM Recommended Version NPM Beta Version NPM Downloads GitHub Commits GitHub Code Size

A simple plugin to control KNX devices.
This plugin is made to cooperate with Homebridge: https://github.com/nfarina/homebridge
It connects to a KNX IP Gateway and offers some special tweaks.

Core Features

Troubleshooting

GitHub Issues


Installation

  1. Install homebridge using: sudo npm install -g homebridge
  2. Install this plugin using: sudo npm install -g homebridge-syntex-knx
  3. Update your config.json file. See snippet below.
  4. Restart the Homebridge Service with: sudo systemctl restart homebridge; sudo journalctl -fau homebridge

Example Config

Info: If the baseDirectory for the storage can't be created you have to do it by yourself and give it full write permissions!

"platforms": [
    {
        "platform": "SynTexKNX",
        "baseDirectory": "/var/homebridge/SynTex",
        "ip": "192.168.1.100",
        "options": {
            "port": 1714,
            "language": "us",
            "disablePreload": false
        },
        "log": {
            "debug": false
        },
        "accessories": [
            {
                "id": "knx1",
                "name": "Sensor Accessory",
                "services": [
                    {
                        "address": {
                            "status": "1/0/0"
                        },
                        "type": "contact"
                    }
                ]
            },
            {
                "id": "knx2",
                "name": "Boolean Accessory",
                "services": [
                    {
                        "address": {
                            "status": ["1/1/0", "1/1/1"],
                            "control": ["1/1/0", "1/1/1"]
                        },
                        "type": "switch"
                    }
                ]
            },
            {
                "id": "knx3",
                "name": "Dimmer Accessory",
                "services": [
                    {
                        "address": {
                            "status": "1/1/2",
                            "control": "1/1/2"
                        },
                        "type": "dimmer"
                    }
                ]
            },
            {
                "id": "knx4",
                "name": "RGB Accessory",
                "services": [
                    {
                        "address": {
                            "status": "1/1/3",
                            "control": "1/1/3"
                        },
                        "type": "rgb"
                    }
                ]
            },
            {
                "id": "knx5",
                "name": "Window Covering Accessory",
                "services": [
                    {
                        "address": {
                            "status": "1/1/4",
                            "control": "1/1/4"
                        },
                        "delay": {
                            "up": 11000,
                            "down": 10000
                        },
                        "type": "blind",
                        "name": "Up / Down"
                    },
                    {
                        "address": {
                            "status": "1/1/5",
                            "control": "1/1/5"
                        },
                        "type": "switch",
                        "name": "Stop"
                    }
                ]
            },
            {
                "id": "knx6",
                "name": "Inverted Accessory",
                "services": [
                    {
                        "datapoint": "1.001",
                        "address": {
                            "status": "1/0/0"
                        },
                        "type": "contact",
                        "inverted": true
                    }
                ]
            },
            {
                "id": "knx7",
                "name": "Multi Accessory",
                "services": [
                    {
                        "address": {
                            "status": "1/0/0"
                        },
                        "type": "contact",
                        "name": "Contact"
                    },
                    {
                        "address": {
                            "status": "1/0/1"
                        },
                        "type": "humidity",
                        "name": "Humidity"
                    },
                    {
                        "address": {
                            "status": "1/0/2"
                        },
                        "type": "leak",
                        "name": "Leak"
                    },
                    {
                        "address": {
                            "status": "1/0/3"
                        },
                        "type": "light",
                        "name": "Light"
                    },
                    {
                        "address": {
                            "status": "1/0/4"
                        },
                        "type": "motion",
                        "name": "Motion"
                    },
                    {
                        "address": {
                            "status": "1/0/5"
                        },
                        "type": "occupancy",
                        "name": "Occupancy"
                    },
                    {
                        "address": {
                            "status": "1/0/6"
                        },
                        "type": "smoke",
                        "name": "Smoke"
                    },
                    {
                        "address": {
                            "status": "1/0/7"
                        },
                        "type": "temperature",
                        "name": "Temperature"
                    },
                    {
                        "address": {
                            "status": "1/1/1",
                            "control": "1/1/1"
                        },
                        "type": "led",
                        "name": "LED"
                    },
                    {
                        "address": {
                            "status": "1/1/1",
                            "control": "1/1/1"
                        },
                        "type": "outlet",
                        "name": "Outlet"
                    },
                    {
                        "address": {
                            "status": "1/1/1",
                            "control": "1/1/1"
                        },
                        "type": "switch",
                        "name": "Switch"
                    },
                    {
                        "address": {
                            "status": "1/1/2",
                            "control": "1/1/2"
                        },
                        "type": "dimmer",
                        "name": "Dimmer"
                    },
                    {
                        "address": {
                            "status": "1/1/3",
                            "control": "1/1/3"
                        },
                        "type": "rgb",
                        "name": "RGB"
                    },
                    {
                        "datapoint": "5.001",
                        "address": {
                            "status": "1/1/4",
                            "control": "1/1/4"
                        },
                        "delay": {
                            "up": 11000,
                            "down": 10000
                        },
                        "type": "blind",
                        "name": "Blind"
                    },
                    {
                        "datapoint": "1.001",
                        "address": {
                            "status": "1/1/1",
                            "control": "1/1/1"
                        },
                        "type": "switch",
                        "name": "Inverted Switch",
                        "inverted": true
                    }
                ]
            }
        ]
    }
]

Required Parameters

Optional Parameters

Log Parameters

Accessory Config


SynTex UI

Control and set up your devices by installing homebridge-syntex
This plugin is made for plugin management, automation system and device control.

Check out the GitHub page for more information:
https://github.com/SynTexDZN/homebridge-syntex

Update KNX Device

  1. Open http:// Bridge IP /devices?id= Device ID &value= New Value
  2. Insert the Bridge IP and Device ID
  3. For the New Value you can type this pattern:
    • For boolean devices: true / false ( dimmer, fan, led, outlet, rgb, switch )
    • For numeric devices: 10 / 12.4 ( blind, thermostat )
    • For dimmable lights add &brightness= New Brightness ( has to be a number )
    • For colored lights add &hue= New Hue ( has to be a number )
    • For colored lights add &saturation= New Saturation ( has to be a number )
    • For thermostats add &target= New Target Temperature ( has to be a number )
    • For thermostats add &state= New Current Heating Cooling State ( has to be a number )
    • For thermostats add &mode= New Target Heating Cooling State ( has to be a number )
    • For fans add &direction= New Rotation Direction ( has to be a number )
    • For fans add &speed= New Rotation Speed ( has to be a number )
    • For accessories with multiple service types add &type= SERVICETYPE
    • For accessories with multiple services with more than one of the same service type add &counter= SERVICENUMBER\ ( First of that type = 0, second = 1 .. )

Example: http://homebridge.local:1714/devices?id=ABCDEF1234567890&type=dimmer&counter=0&value=true&brightness=100\ ( Updates the value and brightness of ABCDEF1234567890 to turned on, 100% brightness for example )

Read KNX Device

  1. Open http:// Bridge IP /devices?id= Device ID
  2. Insert the Bridge IP and Device ID
    • For accessories with multiple service types add &type= SERVICETYPE
    • For accessories with multiple services with more than one of the same service type add &counter= SERVICENUMBER\ ( First of that type = 0, second = 1 .. )

Example: http://homebridge.local:1714/devices?id=ABCDEF1234567890\ ( Reads the state of ABCDEF1234567890 for example )

Remove KNX Device

  1. Open http:// Bridge IP /devices?id= Device ID &remove=CONFIRM
  2. Insert the Bridge IP and Device ID
    • To remove a specific service add &type= SERVICETYPE
    • To remove a specific service from an accessory with more than one of the same service type add &counter= SERVICENUMBER\ ( First of that type = 0, second = 1 .. )

Example: http://homebridge.local:1714/devices?id=ABCDEF1234567890&remove=CONFIRM\ ( Removes ABCDEF1234567890 from the Config and Home App )


Automation

To enable the automation module you have to create a file named automation.json in your baseDirectory >> automation or install the homebridge-syntex plugin to create them via UI ( only between SynTex plugins )

Example: For manual configuration update your automation.json file. See snippet below.

{
    "automation": [
        {
            "id": 0,
            "name": "Demo Automation",
            "active": true,
            "trigger": {
                "logic": "AND",
                "groups": [
                    {
                        "logic": "OR",
                        "blocks": [
                            {
                                "id": "multi2",
                                "name": "Multi Device",
                                "letters": "F0",
                                "plugin": "SynTexWebHooks",
                                "operation": "<",
                                "state": {
                                    "value": 1000
                                }
                            },
                            {
                                "operation": "=",
                                "time": "16:00",
                                "options": {
                                    "stateLock": true
                                }
                            }
                        ]
                    },
                    {
                        "logic": "AND",
                        "blocks": [
                            {
                                "id": "multi1",
                                "name": "Multi Switch",
                                "letters": "41",
                                "plugin": "SynTexWebHooks",
                                "operation": "=",
                                "state": {
                                    "value": false
                                },
                                "options": {
                                    "stateLock": true
                                }
                            },
                            {
                                "operation": "=",
                                "days": [
                                    1,
                                    2,
                                    3,
                                    4,
                                    5
                                ]
                            }
                        ]
                    }
                ]
            },
            "result": [
                {
                    "id": "knx5",
                    "name": "Multi Accessory",
                    "letters": "80",
                    "plugin": "SynTexKNX",
                    "operation": "=",
                    "state": {
                        "value": true
                    }
                },
                {
                    "id": "extern1",
                    "name": "Extern Accessory",
                    "letters": "40",
                    "bridge": "192.168.1.100",
                    "plugin": "SynTexWebHooks",
                    "operation": "=",
                    "state": {
                        "value": false
                    },
                    "options": {
                        "stateLock": false
                    }
                },
                {
                    "operation": "=",
                    "delay": 1000
                },
                {
                    "url": "http://192.168.1.100:1714/devices?id=ABCDEF1234567890&value=true"
                }
            ]
        }
    ]
}

Required Parameters

Block Configuration

Service Block ( Trigger, Result )

Time Block ( Trigger )

Weekday Block ( Trigger )

Delay Block ( Result )

URL Block ( Result )

Letter Configuration

The letters are split into two parts ( characters )

1. Service Type

2. Duplicate Counter

Example: The first switch in your config has the letters 40, the second 41 and so on ..

Supported Plugins


Currently Supported