Skip to content
Åke Hedman edited this page Aug 17, 2021 · 27 revisions

Raspberry Pi node pi4

This is a Raspberry Pi 3+ running Raspberry Pi OS (Debian Buster) with the latest VSCP daemon installed and among other things have a Frankfurt RS-232 module that connects to a CAN bus that is run to our kitchen on the upper floor of our house. Here there are some nodes that control a refrigerator and a fridge.

The Frankfurt RS-232 module is connected to the VSCP daemon with the level I/CANAL CAN4VSCP driver. The configuration file vscpd.json for the VSCP daemon looks like this

{
  "runasuser": "vscp",
  "debug": 18446744073709551615,
  "guid": "25:00:00:00:00:00:00:00:00:00:00:00:06:00:00:00",
  "servername": "The VSCP daemon",
  "classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3",
  "maindb": "/var/lib/vscp/vscpd/vscp.sqlite3",
  "discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3",
  "vscpkey": "/etc/vscp/vscp.key",
  "logging": {
    "file-enable-log": true,
    "file-log-level": "debug",
    "file-pattern": "[vscp: %c] [%^%l%$] %v",
    "file-path": "/var/log/vscp/vscpd.log",
    "file-max-size": 5242880,
    "file-max-files": 7,
    "console-enable-log": true,
    "console-log-level": "debug",
    "console-pattern": "[vscp: %c] [%^%l%$] %v"
  },
  "mqtt": {
    "bind": "",
    "host": "192.168.1.7",
    "port": 1883,
    "mqtt-options": {
      "tcp-nodelay": true,
      "protocol-version": 311,
      "receive-maximum": 20,
      "send-maximum": 20,
      "ssl-ctx-with-defaults": 0,
      "tls-ocsp-required": 0,
      "tls-use-os-certs": 0
    },
    "user": "vscp",
    "password": "secret",
    "clientid": "the-vscp-daemon-pi4",
    "publish-format": "json",
    "subscribe-format": "auto",
    "qos": 1,
    "bcleansession": false,
    "bretain": false,
    "keepalive": 60,
    "bjsonmeasurementblock": true,
    "topic-daemon-base": "vscp-daemon/{{guid}}/",
    "topic-drivers": "drivers",
    "topic-discovery": "discovery",
    "reconnect": {
      "delay": 2,
      "delay-max": 10,
      "exponential-backoff": false
    },
    "tls": {
      "cafile": "",
      "capath": "",
      "certfile": "",
      "keyfile": "",
      "pwkeyfile": "",
      "no-hostname-checking": true,
      "cert-reqs": 0,
      "version": "",
      "ciphers": "",
      "psk": "",
      "psk-identity": ""
    },
    "will": {
      "topic": "vscp-daemon/{{srvguid}}/will",
      "qos": 1,
      "retain": true,
      "payload": "VSCP Daemon is down"
    },
    "subscribe": [
      {
        "topic": "vscp/pi4",
        "qos": 0,
        "v5-options": 0,
        "format": "auto"
      }
    ],
    "bescape-pub-topics": true,
    "user-escapes": {
      "escape1": "value1",
      "escape2": "value2"
    },
    "publish": [
      {
        "topic": "vscp/{{guid}}",
        "qos": 0,
        "retain": false,
        "format": "json"
      }
    ],
    "v5": {
      "user-properties": {
        "prop1": "value",
        "prop2": "value"
      }
    }
  },
  "drivers": {
    "level1": [
      {
        "enable": true,
        "name": "can4vscp",
        "config": "/dev/vscp_serial0",
        "flags": 2147483648,
        "translation": 2,
        "path": "/var/lib/vscp/drivers/level1/vscpl1drv-can4vscp.so.1.1.1",
        "guid": "25:00:00:00:00:00:00:00:00:00:00:00:06:01:00:00",
        "mqtt": {
          "bind": "",
          "host": "192.168.1.7",
          "port": 1883,
          "mqtt-options": {
            "tcp-nodelay": true,
            "protocol-version": 311,
            "receive-maximum": 20,
            "send-maximum": 20,
            "ssl-ctx-with-defaults": 0,
            "tls-ocsp-required": 0,
            "tls-use-os-certs": 0
          },
          "user": "vscp",
          "password": "secret",
          "clientid": "vscp-level1-can4vscp-driver",
          "publish-format": "json",
          "subscribe-format": "auto",
          "qos": 1,
          "bcleansession": false,
          "bretain": false,
          "keepalive": 60,
          "bjsonmeasurementblock": true,
          "reconnect": {
            "delay": 2,
            "delay-max": 10,
            "exponential-backoff": false
          },
          "tls": {
            "cafile": "",
            "capath": "",
            "certfile": "",
            "keyfile": "",
            "pwkeyfile": "",
            "no-hostname-checking": true,
            "cert-reqs": 0,
            "version": "",
            "ciphers": "",
            "psk": "",
            "psk-identity": ""
          },
          "will": {
            "topic": "vscp-daemon/{{srvguid}}/drivers/{{ifguid}}/will",
            "qos": 1,
            "retain": true,
            "payload": "vscpl2drv-energy-p1 driver down"
          },
          "subscribe": [
            {
              "topic": "vscp/{{guid}}/can4vscp",
              "qos": 0,
              "v5-options": 0,
              "format": "auto"
            }
	  ],
          "user-escapes": {
            "host": "pi4",
            "drv": "can4vscp"
          },
          "publish": [
            {
              "topic": "vscp/{{guid}}/{{class}}/{{type}}/{{nickname}}/{{data[0]}}",
              "qos": 0,
              "retain": false,
              "format": "json"
            }
          ],
          "v5": {
            "user-properties": {
              "prop1": "value",
              "prop2": "value"
            }
          }
        }
      }
    ],
    "level2": [
    ]
  }
}
Clone this wiki locally