GithubHelp home page GithubHelp logo

lumokitho / loxone-influx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrasg/loxone-influx

0.0 0.0 0.0 87 KB

Loxone to InfluxDB node script

License: Apache License 2.0

TypeScript 100.00%

loxone-influx's Introduction

loxone-influx

This script listens for events on Loxone's websocket (WS) API and adds event data to Influx based on the config.

The script has a buffer of bufferSize for regular events and for an additional criticalBufferSize for critical events (marked as such in the config). The buffer is used to store events in-memory, in case data cannot be sent to InfluxDb.

The script is based on the script at: https://github.com/raintonr/loxone-stats-influx

Usage

You can run the script directly, through node or install the scirpt as a Docker container.

Running through node

  • Update default.json in the config folder with:
    • Loxone IP address
    • Loxone username
    • Influx IP address
    • Influx database
    • Your environment's UUID's
  • Create local.json in the config folder with:
    • Loxone password
  • run using npm start

Running through Docker

  • Update default.json in the config folder with:
    • Loxone IP address
    • Loxone username
    • Influx IP address
    • Influx database
    • Your environment's UUID's
  • Create local.json in the config folder with:
    • Loxone password
  • Build the container using dockerfile.
  • Start the container
    • make sure to add the TZ environmental variable with the proper timezone

    • make sure to map the config into the container under /app/config, eg:

      docker run -d \
          --name loxone-influx \
          -v <path to config on host>/config:/app/config \
          -e TZ="Europe/London" \
          --restart=unless-stopped \
          loxone-influx
      

Configuration

UUID's can be easily obtained by opening your *.Loxone file and searching for the building block name you are interested in.

NOTE: The Loxone WS API will only emit change updates for items that are configured as "Use" in the "User interface" section of the block's Loxone config. To avoid clutter in the Loxone native mobile app, I am using a dedicated user for this script, so items that I need in Influx but don't want in the mobile app are assigned in Loxone Config to this user only.

The file local.json is in .gitignore so it won't be added to source control to avoid checking in credentials.

The configuration items under the uuids node need to have the following format:

"uuids" : {
    "uuid-of-loxone-item": {
        "measurement": "influx measurement name",
        "tags": {
            "any": "tag",
            "tag2": "value2"
        },
        "critical": false
    }
}

DevOps flow using Docker

I am using an Azure Container Registry (ACR) to host my images but this approach would be analogous when using other registries (eg: dockerhub) as well. The following ACR task watches commits in this github repository, builds the docker image, and pushes the new image to the registry.

I am running watchtower to make sure my container is using the latest image available in ACR.

ACR task

The following task watches this github repository, builds the docker image upon commit and pushes the new image to ACR with the latest tag.

az acr task create \
     --registry andrasg \
     --name loxone-influx \
     --image loxone-influx:latest \
     --context https://github.com/andrasg/loxone-influx.git \
     --file dockerfile \
     --git-access-token <PAT> \
     --base-image-trigger-enabled false \
     --platform linux/arm/v7

loxone-influx's People

Contributors

andrasg 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.