GithubHelp home page GithubHelp logo

jdeluyck / verisure-domoticz Goto Github PK

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

Scripts to query Verisure and pump the data into Domoticz

License: GNU General Public License v3.0

Python 100.00%
verisure-api verisure domoticz python3 imap

verisure-domoticz's Introduction

verisure-domoticz

Scripts to query Verisure and pump the data into Domoticz

License

These scripts are licensed under the GPL 3.0. You can find the full license in the LICENSE file.

Credits

These scripts wouldn't exist without verisure module by Per Sandström.

importVerisure.py

This script is designed to log into the Verisure API, and get out all the information of the system at that time. It then processes the devices specified in vsure.ini (see below) to see which ones it needs to upload into Domoticz.

monitorVerisureMail.py

This script is designed to open an imap idle connection to a mailbox folder, to monitor for Verisure events. This allows us to react quicker to specific events, than every X minutes (as specified by the cron job).

Configuring

Configuration is handled through an ini-style configuration file. By default, when run the first time, the script will create a file in the current directory called vsure.ini.

Domoticz configuration

Hardware

In the hardware section, you need to add a device called Dummy (Does nothing, use for virtual switches only). Next, you need to add (using Create virtual Sensors) the following sensors per device of a certain type in your Verisure installation that you want in Domoticz

  • Smoke detector: add a Temperature + Humidity sensor
  • Siren: Temperature sensor
  • Door/window magnetic lock: Switch (on/off)
  • Ethernet status: Switch (on/off)
  • Voicebox: Temperature sensor
  • Passive Infrared Sensor: temperature sensor
  • Smart plugs / control plugs: Switch (on/off)

I only own a limited selection of devices, so if it's not in the list above, I'm not 100% sure on what sensor information I need. Feel free to add an issue with additional information. Ideally add the output of vsure youruser yourpass overview, but remove any sensitive info (like actual component identifiers).

Thanks to IvovanTulden I've added the voicebox, passive infrared sensor and smart/control plugs!

You'll also need the following sensors (mandatory):

  • SMS Counter: Custom Sensor, X Axis: SMS Count
  • Alarm status: Switch (selector type) with three states:
    • 0: Off
    • 10: Armed Home
    • 20: Armed Away

vsure.ini

The configuration is handled through an ini-style config file called vsure.ini (by default, you can specify any other using command line parameters)

The blank file written is

[domoticz]
port = 8080
host = localhost
protocol = http

[verisure]
password = 
username = 

[global]
loglevel = warning
timezone = local

[sensorindex]
aaaa bbbb = XX
sms count = XX
arm state = XX

[email]
host =
port = 
ssl = 
folder = 
username = 
password = 
  • The domoticz section contains parameters needed to connect to your Domoticz instance.
  • the verisure section specifies your username (email) and password to get into verisure.
  • global contains the timezone your domoticz is running in (specifying local here takes the time from /etc/timezone), and the default loglevel you want. You can choose from DEBUG, INFO, WARNING, ERROR and CRITICAL. Note: DEBUG will output your passwords, too!
  • sensorindex is the block where you need to match up the serial ID if your Verisure components with the sensor index in Domoticz. Say your device has an identifier of JC2B XYZB, and the device identifier in Domoticz is 10, you'll need to add a line reading JC2B XYZB = 10. You also need to keep the lines sms count = xx and arm state = xx, and specify the sensor index from Domoticz. These reflect the SMS counter and the alarm armed status.
  • The email section contains the configuration parameters to connect to your email provider. See below for more info.

Email configuration

In case you want to use the mail polling script monitorVerisureMail.py, you'll need to add a user in the Verisure configuration and configure it to receive mails on Alarm events. You'll also need to add a filter so that all those mails are filtered into a specific subfolder. Then supply the necessary email server info in the vsure.ini configuration file.

  • host: your email IMAP server. POP3 is not supported at this time
  • port: the port to connect to. This is usually related directly to the parameter ssl (encryption)
  • ssl: wether or not to activate SSL from the get-go. The script will try to use STARTTLS if available.
  • folder: the folder in which we will receive mails from Verisure. I decided to not check which mails we get in this folder, but just to trigger the importVerisure.py script. This works around several issues, including language, formatting, ...
  • username and password should be self-explanatory. At this time no support for OAuth has been included, though it's possible with IMAPClient.

Command line parameters

The easiest way to get them is to ask for them ;)

$ ./importVerisure.py -h
usage: importVerisure.py [-h] [-v] [-l {info,warning,error,debug,critical}]
                         [-c CONFIGFILE]

Import Verisure information into Domoticz

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -l {info,warning,error,debug,critical}, --log {info,warning,error,debug,critical}
                        Specifies the loglevel to be used
  -c CONFIGFILE, --config CONFIGFILE
                        Name of the configuration file to use (default:
                        vsure.ini

Scheduling importVerisure.py through cron

Easy as

*/10 * * * * /home/domoticz/importVerisure.py

I don't know what the call limit is on the API, but I've not gotten any errors with a 10 minute interval.

Using monitorVerisureMail.py

Since I'm already running Domoticz through systemd, it was only logical to create a systemd unit file for this. You can find it here

You can copy it to /etc/systemd/system, install it using systemctl enable monitorVerisureMail.py and start it with systemctl start monitorVerisureMail.py. You'll probably have to modify it to your installation.

verisure-domoticz's People

Contributors

jdeluyck avatar

Watchers

 avatar  avatar

verisure-domoticz's Issues

Read only user less information

Within MyPages it is possible to give a user a access-level, I use this for creating a read-only user then only gets information from the system.

When the user is 'beheerder/administrator' the scripts runs fine, but with 'minium' rights there is a slight bug. The totalSmsCount is not available for all users.

What is did is create a overview of all the information that the 'minimum' user is missing below.
Perhaps you can code a 'try' command for this?

{
"controlPlugs": [
{
"currentState": "ON",
"deviceLabel": "XXXX XXXX",
"deviceId": "12345678",
"pendingState": "NONE",
"area": "Thuis",
"profile": "OTHER"
}
],
"installationErrorList": [],
"eventCounts": [],
"totalSmsCount": 0,
"heatPumps": [],
"userTracking": {
"installationStatus": "NOT_CONFIGURED"
},
"batteryProcess": {
"active": false
},
"pendingChanges": 0,
"smartCameras": [],
}

Verisure devices

Below are some additonals devices.

  • Smoke is added to be complete.
  • Voicebox information
  • PIR2 is a PIR without camera function, the ones with camera I can't read.
  • Smartplugs and Controlpugs use the same ID, the look the same.

Hope you can do something with this.

"climateValues": [
{
"deviceType": "SMOKE2",
"temperature": 15.2,
"deviceLabel": "id fits here",
"humidity": 72.0,
"deviceArea": "Zolder",
"time": "2018-01-29T17:06:14.000Z"
},

    {
        "temperature": 16.0,
        "deviceType": "VOICEBOX1",
        "deviceArea": "Hal",
        "deviceLabel": "id fits here",
        "time": "2018-01-29T20:10:49.000Z"
    },
    {
        "temperature": 15.0,
        "deviceType": "PIR2",
        "deviceArea": "Garage",
        "deviceLabel": "id fits here",
        "time": "2018-01-29T20:04:01.000Z"
    }

"smartPlugs": [
{
"isHazardous": false,
"currentState": "ON",
"deviceLabel": "id fits here",
"pendingState": "NONE",
"icon": "OTHER",
"area": "Thuis"
}
],
"controlPlugs": [
{
"profile": "OTHER",
"currentState": "ON",
"area": "Thuis",
"deviceId": "other id",
}

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.