diff --git a/.vscode/launch.json b/.vscode/launch.json index ac3c35339..2abb3f5b2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -72,7 +72,7 @@ "type": "cppdbg", "request": "launch", "program": "/home/akhe/development/VSCP/build/vscpd", - "args": ["-s","-c/home/akhe/development/VSCP/vscpl2drv-tcpiplink/debug/linux/vscpd.json"], + "args": ["-s","-c /home/akhe/development/VSCP/vscpl2drv-tcpiplink/debug/linux/vscpd.json"], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], diff --git a/database b/database index e65e1b2fc..cd985f17d 100644 Binary files a/database and b/database differ diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 707e81b2b..15419eec3 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,9 +1,9 @@ * Introduction - * [Start](start.md) - * [Introduction](introduction.md) + * [Start](start.md) + * [Introduction](introduction.md) * Setup -* [Setting up the system](setting_up_the_system.md) + * [Setting up the system](setting_up_the_system.md) * Configure * [The configuration file](configuring_the_vscp_daemon.md) diff --git a/docs/configuring_the_vscp_daemon.md b/docs/configuring_the_vscp_daemon.md index 540db3e6c..4c6545c7e 100644 --- a/docs/configuring_the_vscp_daemon.md +++ b/docs/configuring_the_vscp_daemon.md @@ -2,7 +2,7 @@ The configuration file is used to tell which drivers should be used and how the VSCP daemon should operate. From version 15.0 this file has changed format from XML to JSON. -As always with configuration files it easy to make changes that make the system nonfunctional. Sp be careful when you edit the file and keep to the JSON standard. Most important keep a backup so that yo can go back to a working copy if something goes wrong. +As always with configuration files it easy to make changes that make the system nonfunctional. So be careful when you edit the file and keep to the JSON standard. Most important keep a backup so that yo can go back to a working copy if something goes wrong. It is very convenient to use one of the online JSON validators to validate the JSON file when doing a lot of changes. There are many available and a good one is [this one](https://jsonformatter.curiousconcept.com/). Just copy the content of the file in the box and validate. @@ -20,7 +20,80 @@ ps aux | grep vscpd to see if the VSCP daemon is running or not. +The sample configuration file that is installed holds a lot of information. You can use degaults for most of it. A minimum configuration file looks like this +'''json +{ + "runasuser": "vscp", + "debug": 0, + "guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01", + "servername": "The VSCP daemon on HOST", + "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": "test.mosquitto.org", + "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": "", + "password": "", + "clientid": "", + "publish-format": "json", + "subscribe-format": "auto", + "qos": 1, + "bcleansession": false, + "bretain": false, + "keepalive": 60, + "bjsonmeasurementblock": true, + "topic-daemon-base": "vscp-daemon/status/{{guid}}/", + "topic-drivers": "drivers", + "topic-discovery": "discovery", + "will": { + "topic": "vscp-daemon/status/will/", + "qos": 1, + "retain": true, + "payload": "VSCP Daemon is down" + }, + "subscribe": [ + { + "topic": "vscp/mydaemon", + "qos": 0, + "v5-options": 0, + "format": "auto" + } + ], + "publish": [ + { + "topic": "vscp/{{guid}}", + "qos": 0, + "retain": false, + "format": "json" + } + ] + } +} +''' ## Location of the configuration file @@ -71,7 +144,7 @@ In the general section you find settings that are common to all components of th "runasuser" : "vscp", "debug" : 0, "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01", -"servername" : "The VSCP daemon", +"servername" : "The VSCP daemon on HOST", "classtypedb" : "/var/lib/vscp/vscpd/vscp_events.sqlite3", "maindb" : "/var/lib/vscp/vscpd/vscp.sqlite3", "discoverydb" : "/var/lib/vscp/vscpd/vscp.sqlite3", @@ -87,9 +160,60 @@ In the general section you find settings that are common to all components of th "console-enable-log": false, "console-log-level" : "info", "console-pattern" : "[vscp %c] [%^%l%$] %v" +}, + "mqtt": { + "host": "test.mosquitto.org", + "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": "", + "password": "", + "clientid": "", + "publish-format": "json", + "subscribe-format": "auto", + "qos": 1, + "bcleansession": false, + "bretain": false, + "keepalive": 60, + "bjsonmeasurementblock": true, + "topic-daemon-base": "vscp-daemon/status/{{guid}}/", + "topic-drivers": "drivers", + "topic-discovery": "discovery", + "will": { + "topic": "vscp-daemon/status/{{srvguid}}/will", + "qos": 1, + "retain": true, + "payload": "VSCP Daemon is down" + }, + "subscribe": [ + { + "topic": "vscp/mydaemon", + "qos": 0, + "v5-options": 0, + "format": "auto" + } + ], + "publish": [ + { + "topic": "vscp/{{guid}}", + "qos": 0, + "retain": false, + "format": "json" + } + ] + } } ``` +this will start up the daemon but do noting. You need to add a driver to get some work done. + ### debug :id=config-gerneral-debug The debug entry is a 64-bit number (each bit is a flag) that enable (if set) a specific debugging capability of the VSCP daemon. If you have problem you should enable the relevant bits to be able to detect the cause for the problem. @@ -293,6 +417,8 @@ This is the password to use to login on the MQTT broker. Leave blank to use no c ### clientid :id=config-mqtt-clientid Set the client id of this client. Note that **all client id's should be unique to a broker**. If not the client with the duplicate client id will be disconnected. If you leave this blank a random client id will be generated. The standard max length for client id's is 23 characters but most brokers accept longer client id's. +From version 15.0.3 you can use {{rnd}} in the client name to get a random 16 hex character string generated for the mustache tag. + ### publish-format :id=config-mqtt-general-publish-format This is the format the VSCP daemon will use to publish it's information if not set specially for the publish topic. There are four formats available diff --git a/docs/setting_up_the_system.md b/docs/setting_up_the_system.md index 839fc763a..8e705e599 100644 --- a/docs/setting_up_the_system.md +++ b/docs/setting_up_the_system.md @@ -1,6 +1,6 @@ # Setting up the System -The VSCP Daemon is easy to setup. Just install the server and then configure the drivers you want to use. It is recommended to set up a local MQTT broker also but one can use one of the [public MQTT brokers](https://mntolia.com/10-free-public-private-mqtt-brokers-for-testing-prototyping/) for testing. +The VSCP Daemon is easy to setup. Just install the server and then configure the drivers you want to use. It is recommended to set up a local MQTT broker also but one can use one of the [public MQTT brokers](https://mntolia.com/10-free-public-private-mqtt-brokers-for-testing-prototyping/) for testing. Mosquitto is a very populöar choice that we recommend. ## Setting up the system on Linux diff --git a/docs/variables.xml b/docs/variables.xml index 25a57a0f5..8f0c0d675 100644 --- a/docs/variables.xml +++ b/docs/variables.xml @@ -1,4 +1,4 @@ - 2021-09-22 15:13 - 15.0.0-1 Phosphorus + 2024-04-07 18:31 + 15.0.3-1 Phosphorus \ No newline at end of file diff --git a/resources/database/vscp_events.sqlite3 b/resources/database/vscp_events.sqlite3 index e65e1b2fc..cd985f17d 100644 Binary files a/resources/database/vscp_events.sqlite3 and b/resources/database/vscp_events.sqlite3 differ diff --git a/resources/linux/vscpd.json b/resources/linux/vscpd.json index ae65dc605..9a06ee69d 100644 --- a/resources/linux/vscpd.json +++ b/resources/linux/vscpd.json @@ -2,7 +2,7 @@ "runasuser": "vscp", "debug": 0, "guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01", - "servername": "The VSCP daemon", + "servername": "The VSCP daemon TEST at HOST", "classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3", "maindb": "/var/lib/vscp/vscpd/vscp.sqlite3", "discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3", @@ -41,7 +41,7 @@ "bretain": false, "keepalive": 60, "bjsonmeasurementblock": true, - "topic-daemon-base": "vscp-daemon/{{guid}}/", + "topic-daemon-base": "vscp-daemon/status/{{guid}}/", "topic-drivers": "drivers", "topic-discovery": "discovery", "reconnect": { @@ -63,10 +63,10 @@ "psk-identity": "" }, "will": { - "topic": "vscp-daemon/{{srvguid}}/will", + "topic": "vscp-daemon/status/{{guid}}/will", "qos": 1, "retain": true, - "payload": "VSCP Daemon is down" + "payload": "VSCP Daemon HOST is down" }, "subscribe": [ { diff --git a/resources/linux/vscpd.json.min-example b/resources/linux/vscpd.json.min-example index f83061e77..3578f0939 100644 --- a/resources/linux/vscpd.json.min-example +++ b/resources/linux/vscpd.json.min-example @@ -2,7 +2,7 @@ "runasuser": "vscp", "debug": 0, "guid": "FF:FF:FF:FF:FF:FF:FF:F5:00:00:00:00:00:00:00:01", - "servername": "The VSCP daemon", + "servername": "The VSCP daemon on HOST", "classtypedb": "/var/lib/vscp/vscpd/vscp_events.sqlite3", "maindb": "/var/lib/vscp/vscpd/vscp.sqlite3", "discoverydb": "/var/lib/vscp/vscpd/vscp.sqlite3", @@ -19,7 +19,6 @@ "console-pattern": "[vscp: %c] [%^%l%$] %v" }, "mqtt": { - "bind": "", "host": "test.mosquitto.org", "port": 1883, "mqtt-options": { @@ -41,11 +40,11 @@ "bretain": false, "keepalive": 60, "bjsonmeasurementblock": true, - "topic-daemon-base": "vscp-daemon/{{guid}}/", + "topic-daemon-base": "vscp-daemon/status/{{guid}}/", "topic-drivers": "drivers", "topic-discovery": "discovery", "will": { - "topic": "vscp-daemon/{{srvguid}}/will", + "topic": "vscp-daemon/status/{{srvguid}}/will", "qos": 1, "retain": true, "payload": "VSCP Daemon is down" diff --git a/src/vscp/common/vscp_class.h b/src/vscp/common/vscp_class.h index 7f77ba072..988ade483 100644 --- a/src/vscp/common/vscp_class.h +++ b/src/vscp/common/vscp_class.h @@ -47,7 +47,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2023-04-19 20:30:52.856369 + Generated: 2024-04-08 08:39:19.257091 */ #ifndef VSCP_CLASS_H diff --git a/src/vscp/common/vscp_hashclass.h b/src/vscp/common/vscp_hashclass.h index f9790222f..22f5efb83 100644 --- a/src/vscp/common/vscp_hashclass.h +++ b/src/vscp/common/vscp_hashclass.h @@ -2,7 +2,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2023-04-19 20:30:53.791061 + Generated: 2024-04-08 08:39:20.197532 */ m_hashClass[ 0 ] = _("CLASS1_PROTOCOL"); diff --git a/src/vscp/common/vscp_hashtype.h b/src/vscp/common/vscp_hashtype.h index b26ffcabb..10aec4a05 100644 --- a/src/vscp/common/vscp_hashtype.h +++ b/src/vscp/common/vscp_hashtype.h @@ -2,7 +2,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2023-04-19 20:30:54.255034 + Generated: 2024-04-08 08:39:20.640516 */ diff --git a/src/vscp/common/vscp_type.h b/src/vscp/common/vscp_type.h index 16af73ff8..5dba8a5c8 100644 --- a/src/vscp/common/vscp_type.h +++ b/src/vscp/common/vscp_type.h @@ -48,7 +48,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2023-04-19 20:30:53.290665 + Generated: 2024-04-08 08:39:19.726474 */ #ifndef VSCP_TYPE_H diff --git a/src/vscp/daemon/devicelist.cpp b/src/vscp/daemon/devicelist.cpp index c7015be97..93a05cee9 100644 --- a/src/vscp/daemon/devicelist.cpp +++ b/src/vscp/daemon/devicelist.cpp @@ -240,7 +240,7 @@ CDeviceItem::stopDriver() pthread_join(m_deviceThreadHandle, NULL); pthread_mutex_unlock(&m_mutexdeviceThread); - spdlog::error("CDeviceItem: Driver stopping. {}\n", m_strName); + spdlog::info("CDeviceItem: Driver stopping. {}\n", m_strName); } else { if (!m_bEnable) { diff --git a/src/vscp/daemon/devicethread.cpp b/src/vscp/daemon/devicethread.cpp index 0d0e4c2a7..85a520905 100644 --- a/src/vscp/daemon/devicethread.cpp +++ b/src/vscp/daemon/devicethread.cpp @@ -498,7 +498,7 @@ deviceThread(void *pData) pDeviceItem->m_bQuit = true; if (gDebugLevel & VSCP_DEBUG_DRIVERL1) { - spdlog::error("{}: [Device tread] Level I work loop ended.", pDeviceItem->m_strName); + spdlog::info("{}: [Device tread] Level I work loop ended.", pDeviceItem->m_strName); } } else { @@ -506,7 +506,7 @@ deviceThread(void *pData) // * * * * Non blocking version * * * * if (gDebugLevel & VSCP_DEBUG_DRIVERL1) { - spdlog::error("{}: [Device tread] Level I NON Blocking version.", pDeviceItem->m_strName); + spdlog::info("{}: [Device tread] Level I NON Blocking version.", pDeviceItem->m_strName); } while (!pDeviceItem->m_bQuit) { @@ -595,14 +595,14 @@ deviceThread(void *pData) } // if blocking/non blocking if (gDebugLevel & VSCP_DEBUG_DRIVERL1) { - spdlog::debug("{}: [Device tread] Level I Work loop ended.", pDeviceItem->m_strName); + spdlog::info("{}: [Device tread] Level I Work loop ended.", pDeviceItem->m_strName); } // Close CANAL channel pDeviceItem->m_proc_CanalClose(pDeviceItem->m_openHandle); if (gDebugLevel & VSCP_DEBUG_DRIVERL1) { - spdlog::debug("{}: [Device tread] Level I Closed.", pDeviceItem->m_strName); + spdlog::info("{}: [Device tread] Level I Closed.", pDeviceItem->m_strName); } pDeviceItem->m_bQuit = true; @@ -751,7 +751,7 @@ deviceThread(void *pData) pDeviceItem->m_proc_VSCPClose(pDeviceItem->m_openHandle); if (gDebugLevel & VSCP_DEBUG_DRIVERL2) { - spdlog::debug("{}: [Device tread] Level II Closed.", pDeviceItem->m_strName); + spdlog::info("{}: [Device tread] Level II Closed.", pDeviceItem->m_strName); } pDeviceItem->m_bQuit = true;