Sensor logging visualization is not available in Hubitat as the standard functionality. There are some ways to do it. The easiest implementation of the functionality is based on InfluxDB with Grafana. Those products are open-source and they are aimed to build logging visualization. The linking piece to Hubitat is InfluxDB Logger application for Hubitat. Also, it is required a box to install and run InfluxDB and Grafana. If Synology NAS with decent configuration is in place, it might be used to install and run InfluxDB and Grafana. Synology NAS Docker handles InfluxDB and Grafana perfectly for the case. The design is outlined and it is time to follow the steps to accomplish the task of implementation of the functionality.

1. Install Docker in Synology NAS from Package Center

Install Docker in Synology NAS

2. Create Subfolder with grafana Name in docker Folder

Create grafana Subfolder in docker Folder in Synology NAS

3. Grant Access for Grafana User to New grafana Folder

Grafana image contains a user with 472 user ID. To make the grafana folder persistent, user with 472 ID must be an owner of the folder.

  • Enable SSH service

    Enable SSH Service in Synology NAS

  • If needed, set security level to Low in Advanced Settings

    Set Security to Low in Synology NAS

  • Open ssh tool, for example, PuTTY, connect to Synology NAS, and run the command

    PuTTY

    sudo chown -R 472:472 /volume1/docker/grafana
    

    Validate

    ls -l /volume1/docker/
    drwxrwxrwx+ 1  472  472 0 Oct 29 21:54 grafana
    

4. Download Latest Grafana Image in Docker

Download Latest Grafana Image in Synology NAS

5. Configure Downloaded Grafana Image

Configure Downloaded Grafana Image in Synology NAS

  • Change name to Grafana

    Change Name to Grafana for Docker Image in Synology NAS

  • Enable auto-start in Advanced Settings

    Enable Auto-start in Advanced Settings in Docker Image in Synology NAS

  • Map grafana folder to /var/lib/grafana Docker image folder in Advanced Settings

    Map grafana Folder to Docker Image Folder in Synology NAS

  • Assign a Grafana port in Advanced Settings

    It has to be unoccupied port.

    Assign Grafana Port in Advanced Settings in Synology NAS

6. Run Grafana container

Run Grafana Container in Synology NAS

7. Navigate to Grafana Login Page

User name and password is admin. Type [your Synology NAS address]:[Grafana port as per topic #5] in browser.

Navigate to Grafana Login Page in Synology NAS

8. Download latest 1.x InfluxDB Image in Docker

Download Latest 1.x InfluxDB Image in Synology NAS

Choose InfluxDB Docker Tag in Synology NAS

9. Configure Downloaded InfluxDB Image

  • Change name to InfluxDB

    Change Name to InfluxDB for Docker Image in Synology NAS

  • Enable auto-start in Advanced Settings

    Enable Auto-start in Advanced Settings for InfluxDB in Docker Image in Synology NAS

  • Create InfluxDB folder in docker folder on Volume Tab of Advanced Settings

    The folders are influxdb/var/lib/influxdb.

    Create InfluxDB Folders in Synology NAS

    Created InfluxDB Folders in Synology NAS

  • Map InfluxDB folders to /var/lib/influxdb Docker image folder in Advanced Settings

    Map InfluxDB Folder to Docker Image Folder in Synology NAS

  • Make sure that Grafana and InfluxDB have the same network

    Grafana and InfluxDB Have Same Network in Synology NAS

  • Assign InfluxDB port in Advanced Settings

    Assign Local InfluxDB Port in Advanced Settings in Synology NAS

  • Add environment variables in Advanced Settings

    • DOCKER_INFLUXDB_INIT_MODE -> setup
    • DOCKER_INFLUXDB_INIT_USERNAME -> my-user
    • DOCKER_INFLUXDB_INIT_PASSWORD -> my-password
    • DOCKER_INFLUXDB_INIT_ORG -> my-org
    • DOCKER_INFLUXDB_INIT_BUCKET -> my-bucket

    Add InfluxDB Environment Variables in Advanced Settings in Synology NAS

  • InfluxDB Docker image final step

    InfluxDB Docker Image Final Step in Synology NAS

11. Create Hubitat database

  • Open InfluxDB container

    Open InfluxDB Container in Synology NAS

  • Go to Terminal

    Go to InfluxDB Container Terminal in Synology NAS

  • Click Create button and then select bash

    Create New Terminal in InfluxDB Container in Synology NAS

  • Run influx command

    Run influx Command in InfluxDB Docker Container in Synology NAS

  • Create Hubitat database

    > create database Hubitat
    
  • Validate database creation

    > show databases
    name: databases
    name
    ----
    _internal
    Hubitat
    
  • Exit from InfluxDB

    > exit 
    root@InfluxDB:/#
    

12. Add Grafana Panel to view Habitat Data

  • Open Grafana home page entering [your Synology NAS address]:[Grafana port as per topic #5]

    Grafana Home Page

  • Add data source

    Add Grafana Data Source

  • Find InfluxDB data source

    Find InfluxDB Data Source

  • Replace data source name, URL, and Database

    Replace Name, URL, and Database in Grafana Data Source

  • Click Save & Test to get message datasource is working

    Grafana Datasource Is Working

  • Create new dashboard

    Create New Grafana Dashboard

  • Add new panel

    Add New Panel to Grafana Dashboard

  • Create query to retrieve data

    Create Grafana Query to Retrieve Data

Resources


Comments

comments powered by Disqus