SMI260 Standalone Logger

Docker Container sind eine tolle Sache und erlauben es eine Anwendung schnell auf viele Systeme zu portieren. Wieso also nicht den SMI 260 Solarlogger in ein Gerät verpacken?

Zu meinem erstaunen bieten mittlerweile selbst Raspberry Pi und und ARM-basierte NAS von QNAP die Möglichkeit Docker Container auszuführen. Zu den Vorteilen des Containerns muss man wohl nicht mehr viel sagen.

Warum also nicht den SMI260 SolarLogger zusammen mit Grafana etc. zusammen packen und auf einem kleinen NAS laufen lassen?
Die Wahl viel auf das QNAP TS-231P (zwei Plattenschächte, einen ARM Cortex-A15 Prozesser und 1 GB Arbeitsspeicher. Laut Hersteller verbraucht das Gerät mit Festplatten ~15 Watt.

Nach der Grundinstallation der QNAP Oberfläche muss man noch ein paar Änderungen vornehmen bis der Solar Logger einsatzfähig ist.

Zunächst muss im App Center Docker alias Container Station installiert werden.

Dann kann man den USB Funkstick anstecken. Leider wird dieser nicht automatisch erkannt, da der Kernel die entsprechenden Module nicht automatisch lädt.

Um die serielle Schnittstelle beim Start automatisch zu laden muss ein Autorun Script erstellt werden. Bei QNAP ist die Vorgehensweise je nach Modell unterschiedlich. Eine Auflistung wie es bei eurem Modell geht findet Ihr unter: https://wiki.qnap.com/wiki/Running_Your_Own_Application_at_Startup

Inhalt der autostart.sh :

#!/bin/bash

insmod /usr/local/modules/cp210x.ko

Nun sollte die serielle Schnittstelle bei jedem Start zur Verfügung stehen.

Die Container Station erlaubt es Zusammenstellungen von Containern durch einfügen einer Docker Compose Beschreibung zu erzeugen.

Hier kann nur folgende Beschreibung eingefügt werden, welche dann eine Influx Datenbank, ein Grafana Frontend, einen MQTT Server, den SMI260 Logger und Telegraf als Bindeglied installiert.

version: '3'

services:
  influxdb:
    image: influxdb:latest
    container_name: influxdb
    ports:
      - "8083:8083"
      - "8086:8086"
      - "8090:8090"
    environment:
      INFLUXDB_DATA_ENGINE: tsm1
      INFLUXDB_REPORTING_DISABLED: 'false'
      INFLUXDB_DB: SMI
      INFLUXDB_USER: telegraf
      INFLUXDB_USER_PASSWORD: telegraf
    volumes:
      - influx_data:/var/lib/influxdb
    networks:
      - local

  telegraf:
    image: telegraf:latest
    container_name: telegraf
    links:
      - influxdb
      - mqtt
    networks:
      - local
    depends_on:
      - mqtt  
    volumes:
      - telegraph_config:/etc/telegraf

  grafana:
    image: grafana/grafana-arm32v7-linux:latest
    container_name: grafana
    ports:
      - "3000:3000"
    environment:
      GF_INSTALL_PLUGINS: "grafana-clock-panel,briangann-gauge-panel,natel-plotly-panel,grafana-simple-json-datasource,https://github.com/geeks-r-us/mqtt-panel/releases/download/v1.0.0/geeksrus-mqtt-panel-1.0.0.zip;mqtt-panel"
    links:
      - influxdb
    networks:
      - local
      
    volumes:
      - grafana_data:/var/lib/grafana
    
  chronograf:
    image: chronograf:latest
    container_name: chronograf
    ports:
      - "8888:8888"
    links:
      - influxdb
    networks:
      - local

  mqtt:
    image: eclipse-mosquitto
    container_name: mqtt
    ports:
      - "1883:1883"
      - "9001:9001"
    networks:
      - local
    volumes:
      - mqtt_config:/mosquitto/config

  smimqttgateway:
    image: geeksrusde/smi260mqttgateway:latest-arm
    container_name: smi260mqttgateway
    environment: 
      - MQTTSERVER=mqtt
      - POLL=120
      - SMI_LIST=1234,2345
      - SUNSTICKPORT=/dev/ttyUSB0
    links:
      - mqtt
    devices:
      - /dev/ttyUSB0
    depends_on:
      - mqtt
    networks:
      - local
    restart: always
      
volumes:
    influx_data:
    telegraph_config: 
    grafana_data:
    mqtt_config:
    
networks:
  local:
    driver: bridge

Nun müssen noch ein paar Konfigurationen angepasst werden, welche bei QNAP entweder als Freigabe bereit stellt oder man verwendet die Text Editor App aus dem App Center. Die angelegten Dateien befinden sich unter /Container/container-station-data/lib/docker/volumes/

In der <Application>_telegraf_config/_data/telegraf.conf müssen 2 Abschnitte angepasst werden:

[[outputs.influxdb]]
  ## The full HTTP or UDP endpoint URL for your InfluxDB instance.
  ## Multiple urls can be specified as part of the same cluster,
  ## this means that only ONE of the urls will be written to each interval.
  # urls = ["udp://localhost:8089"] # UDP endpoint example
  urls = ["http://influxdb:8086"] # required
  ## The target database for metrics (telegraf will create it if not exists).
  database = "telegraf" # required

  ## Retention policy to write to. Empty string writes to the default rp.
  retention_policy = ""
  ## Write consistency (clusters only), can be: "any", "one", "quorum", "all"
  write_consistency = "any"

  ## Write timeout (for the InfluxDB client), formatted as a string.
  ## If not provided, will default to 5s. 0s means no timeout (not recommended).
  timeout = "5s"
  username = "telegraf"
  password = "telegraf"

um die MQTT Daten in die Influx Datenbank zu schreiben. Und die Daten Quelle woher die MQTT Daten eingesammelt werden sollen:

# # Read metrics from MQTT topic(s)
 [[inputs.mqtt_consumer]]
   servers = ["tcp://mqtt:1883"]
#   ## MQTT QoS, must be 0, 1, or 2
#   qos = 0
#
#   ## Topics to subscribe to
   topics = [
     "SMI/#",
   ]
#
#   # if true, messages that can't be delivered while the subscriber is offline
#   # will be delivered when it comes back (such as on service restart).
#   # NOTE: if true, client_id MUST be set
#   persistent_session = false
#   # If empty, a random client ID will be generated.
#   client_id = ""
#
#   ## username and password to connect MQTT server.
#   # username = "telegraf"
#   # password = "metricsmetricsmetricsmetrics"
#
#   ## Optional SSL Config
#   # ssl_ca = "/etc/telegraf/ca.pem"
#   # ssl_cert = "/etc/telegraf/cert.pem"
#   # ssl_key = "/etc/telegraf/key.pem"
#   ## Use SSL but skip chain & host verification
#   # insecure_skip_verify = false
#
#   ## Data format to consume.
#   ## Each data format has it's own unique set of configuration options, read
#   ## more about them here:
#   ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
#   data_format = "influx"
  data_format = "value"
  data_type = "float"

Die Konfiguration von MQTT in der <Application>_mqtt_config/_data/mosquitto.conf müssen die folgenden Zeilen angefügt werden:

listener 1883
protocol mqtt
listener 9001
protocol websockets

Durch das aktivieren des websocket Ports ist es möglich die Einstellungen wie PowerLimit und PowerState direkt aus Grafana heraus einzustellen. 

Grafana ist nun über http://<ip des NAS>:3000 im Browser verfügbar. Initiales Passwort für den Benutzer admin ist ebenfalls admin.

In Grafana muss nun noch die Verbindung zur InfluxDB eingerichtet werden:

Nun kann noch ein Panel zur Visualisierung angelegt werden. An diesem Beispiel muss 7981 durch die ID des Wechselrichters und 192.168.178.47 durch die IP des NAS ersetzt werden.

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "panel",
      "id": "geeksrus-mqtt-panel",
      "name": "mqtt-panel",
      "version": "1.0.0"
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "6.7.1"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": null,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB}",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "pluginVersion": "6.2.2",
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "groupBy": [],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Energy"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Erzeugt gesamt",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB}",
      "format": "watth",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 3,
        "y": 0
      },
      "id": 10,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "alias": "Erzeugt",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT max(\"value\") - min(\"value\") FROM \"mqtt_consumer\" WHERE (\"topic\" = 'SMI/7981/Energy') AND $timeFilter",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "max"
              },
              {
                "params": [
                  "-"
                ],
                "type": "math"
              }
            ],
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "min"
              },
              {
                "params": [
                  "-"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Energy"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Erzeugt",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB}",
      "format": "watt",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 4,
        "x": 6,
        "y": 0
      },
      "id": 8,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "groupBy": [],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Power"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Aktuell",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "cacheTimeout": null,
      "colorBackground": false,
      "colorValue": false,
      "colors": [
        "#299c46",
        "rgba(237, 129, 40, 0.89)",
        "#d44a3a"
      ],
      "datasource": "${DS_INFLUXDB}",
      "decimals": 2,
      "format": "currencyEUR",
      "gauge": {
        "maxValue": 100,
        "minValue": 0,
        "show": false,
        "thresholdLabels": false,
        "thresholdMarkers": true
      },
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 10,
        "y": 0
      },
      "id": 12,
      "interval": null,
      "links": [],
      "mappingType": 1,
      "mappingTypes": [
        {
          "name": "value to text",
          "value": 1
        },
        {
          "name": "range to text",
          "value": 2
        }
      ],
      "maxDataPoints": 100,
      "nullPointMode": "connected",
      "nullText": null,
      "postfix": "",
      "postfixFontSize": "50%",
      "prefix": "",
      "prefixFontSize": "50%",
      "rangeMaps": [
        {
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "sparkline": {
        "fillColor": "rgba(31, 118, 189, 0.18)",
        "full": false,
        "lineColor": "rgb(31, 120, 193)",
        "show": false
      },
      "tableColumn": "",
      "targets": [
        {
          "groupBy": [],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              },
              {
                "params": [
                  " / 1000 *0.28"
                ],
                "type": "math"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Energy"
            }
          ]
        }
      ],
      "thresholds": "",
      "timeFrom": null,
      "timeShift": null,
      "title": "Ersparnis",
      "type": "singlestat",
      "valueFontSize": "80%",
      "valueMaps": [
        {
          "op": "=",
          "text": "N/A",
          "value": "null"
        }
      ],
      "valueName": "avg"
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "gridPos": {
        "h": 3,
        "w": 3,
        "x": 13,
        "y": 0
      },
      "id": 16,
      "maxValue": 100,
      "minValue": 0,
      "mode": "Switch",
      "mqttProtocol": "ws",
      "mqttServer": "192.168.178.47",
      "mqttServerPort": 9001,
      "mqttTopicPublish": "SMI/7981/PowerOn/Set",
      "mqttTopicSubscribe": "SMI/7981/PowerOn",
      "offValue": "0",
      "onValue": "1",
      "step": 0,
      "text": "Power",
      "timeFrom": null,
      "timeShift": null,
      "title": "Power State",
      "type": "geeksrus-mqtt-panel",
      "value": true
    },
    {
      "datasource": "${DS_INFLUXDB}",
      "gridPos": {
        "h": 3,
        "w": 16,
        "x": 0,
        "y": 3
      },
      "id": 14,
      "maxValue": "310",
      "minValue": 0,
      "mode": "Slider",
      "mqttProtocol": "ws",
      "mqttServer": "192.168.178.47",
      "mqttServerPort": 9001,
      "mqttTopicPublish": "SMI/7981/MaxPower/Set",
      "mqttTopicSubscribe": "SMI/7981/MaxPower",
      "offValue": "false",
      "onValue": "true",
      "step": "1",
      "targets": [
        {
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "text": "Limit",
      "timeFrom": null,
      "timeShift": null,
      "title": "Einspeisebegrenzung",
      "type": "geeksrus-mqtt-panel",
      "value": "280"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 6
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "connected",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Erzeugung",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Power"
            }
          ]
        },
        {
          "alias": "Limit",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/MaxPower"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "SMI260 Terrasse",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "watt",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "watt",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB}",
      "fill": 1,
      "fillGradient": 0,
      "gridPos": {
        "h": 8,
        "w": 24,
        "x": 0,
        "y": 15
      },
      "hiddenSeries": false,
      "id": 6,
      "legend": {
        "avg": false,
        "current": false,
        "max": false,
        "min": false,
        "show": true,
        "total": false,
        "values": false
      },
      "lines": true,
      "linewidth": 1,
      "links": [],
      "nullPointMode": "null",
      "options": {
        "dataLinks": []
      },
      "percentage": false,
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "Power On",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/PowerOn"
            }
          ]
        },
        {
          "alias": "DC Voltage",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/DCVoltage"
            }
          ]
        },
        {
          "alias": "Frequency",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/Frequency"
            }
          ]
        },
        {
          "alias": "Temp DC DC",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "D",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/TemperatureDCDC"
            }
          ]
        },
        {
          "alias": "Temp DC AC",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "mqtt_consumer",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "E",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "topic",
              "operator": "=",
              "value": "SMI/7981/TemperatureDCAC"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "Messwerte",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "5s",
  "schemaVersion": 22,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": []
  },
  "time": {
    "from": "now/d",
    "to": "now/d"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "",
  "title": "Solar",
  "uid": "x9xy1FnZk",
  "variables": {
    "list": []
  },
  "version": 23
}

2 Gedanken zu „SMI260 Standalone Logger“

  1. Hi Steve,

    erstmal vielen Dank für die Mühe, die Du Dir hier gemacht hast. Für mich wäre das die perfekte Kombination, denn ich habe sowohl den SMI260 nebst USB-Stick als auch ein QNAP TS-251D. Nur leider krieg ich’s nicht hin. Die Container mit Hilfe der passenden Compose-Datei einzurichten hat geklappt. Das einzige, was ich geändert habe, war, die ID des Wechselrichters im Skript korrekt einzutragen. Von den Containern werden alle gestartet, lediglich telegraf nicht. Im Terminal bekomme ich die Meldung:

    2023-05-21T14:22:56Z W! [outputs.influxdb] When writing to [http://influxdb:8086]: database “telegraf” creation failed: Post “http://influxdb:8086/query”: dial tcp: lookup influxdb on 127.0.0.11:53: no such host
    2023-05-21T14:22:56Z E! [telegraf] Error running agent: starting input inputs.mqtt_consumer: network Error : dial tcp: lookup mqtt on 127.0.0.11:53: no such host

    Das scheint aber nicht der einzige Fehler zu sein, denn MQTT meldet:

    1684679398: Client SMI260MQTTGateway disconnected, not authorised.

    Dein Skript selbst scheint (halbwegs) zu funktionieren, es sagt:

    ——————————————–
    [2023-05-21 13:43:20.908994] query SMI 7654
    ——————————————–
    [2023-05-21 13:43:20.930597] data received
    ——————————————–
    [2023-05-21 13:43:20.978841] data received
    Manufacturer: b4b0
    Address: 7654
    Exception :
    ‘7654’

    Hast Du mir vielleicht irgendwelche Tipps? Danke schonmal!

    Carsten

  2. Hallo Carsten,

    das ist schwer zu sagen. Irgendwie sieht es so aus als würden sich deine Container untereinander nicht sehen. Du kannst mal prüfen ob die im QNAP Netzwerkmanager alle mit eine virtuellen Switch verbunden sind. Evtl. Netzwerk nochmal löschen und neu aufbauen lassen. Schwer aus der ferne zu diagnostizieren.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.