Categories
the VSCP Daemon VSCP

VSCP driver MQTT topics

For the new VSCP daemon drivers uses mustach escaped topics. It is possible to use this in many ways. For a driver publish config as this one

where the last to topic defines is of interest here.

The first of the two publish events on JSON format. Driver guid/event class/event type/and node nickname is dynamically put into the topic when an event is received by the driver (vscp/…).

This looks like this for events from the VSCP socketcan driver

If we instead want the symbolic names for the vscp-class and vscp-type the second configuration line can be used. This will be published as the last topic in the picture above (vscp2/…).

Of course it is possible to use many other escapes and even set up your own.

Also look at the vscp-daemon topic. At this location VSCP server information is displayed. This is information like available interfaces, discovered nodes etc. You can see that drivers are actually running and alive here.

Just a teaser…

Categories
the VSCP Daemon VSCP

VERY SIMPLE Control Protocol

Sitting here and documenting the VSCP daemon configuration file i must smile for myself. Even the simplest tools need a quite complex configuration file.

VERY SIMPLE? Sure.

Don’t be afraid. There are many options. Most people just need a few of them.

{
    "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",
    "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" : "info",
        "file-pattern" : "[vscp] [%^%l%$] %v",
        "file-path" : "/var/log/vscp/vscpd.log",
        "file-max-size" : 5242880,
        "file-max-files" : 7,
        "console-enable-log": false,
        "console-log-level" : "info",
        "console-pattern" : "[vscp] [%^%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",  
        "publish-format" : "json",
        "subscribe-format" : "auto",
        "qos" : 1,
        "bcleansession" : false,
        "bretain" : false,      
        "keepalive" : 60,
        "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": "Last Will",
            "qos": 0,
            "retain": false,
            "payload": "This is the end"
        },
        "subscribe": [
            {
                "topic": "test1/topic/A",
                "qos": 0,
                "v5-options": 0,
                "format": "auto"
            },
            {
                "topic": "test2/topic/B",
                "qos": 0,
                "v5-options": 0,
                "format": "auto"
            },
            {
                "topic": "test/#",
                "qos": 0,
                "v5-options": 0,
                "format": "auto"
            },
            {
                "topic": "test2/#",
                "qos": 0,
                "v5-options": 0,
                "format": "auto"
            }
        ],
        "bescape-pub-topics": true,
        "user-escapes": {
            "escape1": "valu1",
            "escape2": "valu2"
        },
        "publish": [
            {
                "topic" : "publish/topic/json",
                "qos" : 0,
                "retain" : false,
                "format": "json"
            },
            {
                "topic" : "publish/topic/xml",
                "qos" : 0,
                "retain" : false,
                "format": "xml"
            },
            {
                "topic" : "publish/topic/string",
                "qos" : 0,
                "retain" : false,
                "format": "string"
            },
            {
                "topic" : "publish/topic/binary",
                "qos" : 0,
                "retain" : false,
                "format": "binary"
            },
            {
                "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                "qos" : 0,
                "retain" : false,
                "format": "json"
            }    
        ],      
        "v5" : {
            "user-properties": {
                "prop1" : "value",
                "prop2" : "value"    
            } 
        }
    },

    "drivers" : {
        "level1" : [
            {
                "enable" : false,
                "name" : "logger",
                "config" : "/tmp/canallog.txt",
                "flags" : 1,
                "translation" : 2,
                "path" : "/var/lib/vscp/drivers/level1/vscpl1drv-logger.so",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:01",

                "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-logger-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "can4vscp",
                "config" : "/dev/ttyUSB0",
                "flags" : 0,
                "translation" : 2,
                "path" : "/var/lib/vscp/drivers/level1/vscpl1drv-can4vscp.so",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:02",

                "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,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : true,
                "name" : "socketcanl1",
                "config" : "can0",
                "flags" : 0,
                "translation" : 2,
                "path" : "/var/lib/vscp/drivers/level1/vscpl1drv-socketcan.so.1.1.1",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:03",

                "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-socketcan-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "can232",
                "config" : "/dev/ttyS0;19200;0;0;125",
                "flags" : 0,
                "translation" : 2,
                "path" : "/var/lib/vscp/drivers/level1/vscpl1drv-can232.so",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:01:00:00:00:00:00:00:04",

                "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-can232-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            }
        ],
        "level2" : [
            {
                "enable" : false,
                "name" : "Logger",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-logger.so",
                "path-config" : "/var/lib/vscp/vscpd/logger2.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:02:00:00:00:00:00:00:01",

                "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-level2-logger-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "lmsensors",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-lmsensors.so",
                "path-config" : "/var/lib/vscp/vscpd/lmsensors.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:06:00:00:00:00:00: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-level2-lmsensors-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "socketcan",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-socketcan.so",
                "path-config" : "/var/lib/vscp/vscpd/socketcan.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:07:00:00:00:00:00: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-level2-socketcan-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "mqtt",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-mqtt.so",
                "path-config" : "/var/lib/vscp/vscpd/mqtt.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:08:00:00:00:00:00: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-level2-mqtt-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "tcpiplink",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-tcpiplink.so",
                "path-config" : "/var/lib/vscp/vscpd/tcpiplink.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:09:00:00:00:00:00: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-level2-tcpiplink-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "rawethernet",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-raweth.so",
                "path-config" : "/var/lib/vscp/vscpd/raweth.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:0A:00:00:00:00:00: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-level2-rawethernet-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "sim",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-sim.so",
                "path-config" : "/var/lib/vscp/vscpd/sim.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:0B:00:00:00:00:00: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-level2-simulation-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            },
            {
                "enable" : false,
                "name" : "1-wire",
                "path-driver" : "/var/lib/vscp/drivers/level2/vscpl2drv-wire1.so",
                "path-config" : "/var/lib/vscp/vscpd/wire1.conf",
                "guid" : "FF:FF:FF:FF:FF:FF:FF:F5:0C:00:00:00:00:00: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-level2-one-wire-driver",  
                    "publish-format" : "json",
                    "subscribe-format" : "auto",
                    "qos" : 1,
                    "bcleansession" : false,
                    "bretain" : false,      
                    "keepalive" : 60,
                    "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": "Last Will",
                        "qos": 0,
                        "retain": false,
                        "payload": "This is the end"
                    },
                    "subscribe": [
                        {
                            "topic": "test1/topic/A",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/topic/B",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        },
                        {
                            "topic": "test2/#",
                            "qos": 0,
                            "v5-options": 0,
                            "format": "auto"
                        }
                    ],
                    "bescape-pub-topics": true,
                    "user-escapes": {
                        "escape1": "valu1",
                        "escape2": "valu2"
                    },
                    "publish": [
                        {
                            "topic" : "publish/topic/json",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        },
                        {
                            "topic" : "publish/topic/xml",
                            "qos" : 0,
                            "retain" : false,
                            "format": "xml"
                        },
                        {
                            "topic" : "publish/topic/string",
                            "qos" : 0,
                            "retain" : false,
                            "format": "string"
                        },
                        {
                            "topic" : "publish/topic/binary",
                            "qos" : 0,
                            "retain" : false,
                            "format": "binary"
                        },
                        {
                            "topic" : "publish/topic/{{datetime}}/{{user}}/C",
                            "qos" : 0,
                            "retain" : false,
                            "format": "json"
                        }    
                    ],      
                    "v5" : {
                        "user-properties": {
                            "prop1" : "value",
                            "prop2" : "value"    
                        } 
                    }
                },
            }
        ]
    }
}

Categories
the VSCP Daemon VSCP

VSCP daemon – next version peek

It is now possible to use tokens instead of numbers in events published topics from a driver and from the VSCP daemon itself. This is accomplished by using {{class-token}} and {{type-token}} instead off {{class}} / {{type}} so a topic for the above can look like

vscp/{{guid}}/{{class-token}}/{{type-token}}/{{nickname}}

Note that also {{nickname}} is set here to make it easy to filter on events from a specific node.

The current list of substitutions that can be used is

{{driver-name}} – Name of driver receiving ten event,
{{guid}} – Full GUID on standard form.
{{guid0}}{{guid0}} – A specific GUID position.
{{guid.msb}} – MSB of GUID.
{{guid.lsb}} – LSB of GUID = nickname for can4vscp.
{{ifguid}} – GUID for interface the event is received on.
{{nickname}} – Nickname for node sendning event.
{{class}} – VSCP class
{{type}} – VSCP type.
{{class-token}} – VSCP class token.
{{type-token}} – VSCP type token.
{{head}} – VSCP event head.
{{obid}} – VSCP event obid.
{{timestamp}} – VSCP event timestamp.
{{dt}} – VSCP UTC datetime string.
{{year}} – VSCP event year.
{{month}} – VSCP event month.
{{day}} – VSCP event day.
{{hour}} – VSCP event hour.
{{minute}} – VSCP event minute.
{{second}} – VSCP event second.
{{clientid}} – Client id set for driver.
{{user}} – User set for driver.
{{host}} – Host set for driver.

There will probably be more added as we walk the path against a release.

Categories
the VSCP Daemon

vscpd install problem workaround

If you get

Created symlink /etc/systemd/system/multi-user.target.wants/vscpd.service → /lib
/systemd/system/vscpd.service.
Job for vscpd.service failed because the service did not take the steps required
by its unit configuration.
See "systemctl status vscpd.service" and "journalctl -xe" for details.

when installing the VSCP daemon the install program did not install the directory structure needed for the VSCP subsystem. The workaround is easy. Just run

sudo vscpd -s

and then terminate immediately and all should be alright. This will create the necessary folders. You need to issue

sudo systemctl start vscp

to start the VSCP daemon after doing this. As an alternative you can reboot.

I will fix this in the next release.

Categories
the VSCP Daemon VSCP

Version vscpd 14.0.5 Silicon released

A new version vscpd 14.0.5 Silicon of VSCP & Friends has been released. It’s available for download here. This release mainly fixes a resource allocation problem that appears on Raspberry Pi and similar devices. If you have experienced connection problems on this or other platforms you should upgrade. Full list of changes is on the release page.

Enjoy!
/Ake

Categories
the VSCP Daemon VSCP

New vscpd release

Categories
CAN4VSCP CAN4VSCP Frankfurt RS-232 the VSCP Daemon VSCP X CAN4VSCP Frankfurt RS-232

vscpl1drv-can4vscp 1.1.1 released

Categories
CAN4VSCP Paris the VSCP Daemon

How to schedule events/schemas with the daemon #Iot #m2m #vscp

I got the following question from a VSCP users

  • How to turn on lights at sunset.
  • How to turn off the lights at a specified time (either sunset + x hrs, or for example at YY:ZZ).
  • How to turn on at a certain time.
  • How to turn off at sunrise.

So the easiest way to demonstrate this capability of the VSCP daemon  is to show the setup I have here in our house for this. Oh well part of it of course, we should not go to far away from the topic.

Some background

Yes I use VSCP based devices for some things here in the house but just as the shoemakers children have holes in there shoes I am often stuck at fixing things for others before I can do something for myself.  So here it is a lot of  my setups are test setups that are replaced by other test setups that are replaced by even other test setups  etc in a never ending story. Its the just the way it is  for makers I guess.

But some things I use here at least and that is I schedule the lamps in the house so they turn on at sunset and turn off at sunrise and some other things. So the questions above is easily by explaining my own setup.

Now I could have used a Paris module to control lamps and I actually do here in the office but just in a test setup . In our house and for lamps on the  outside I use low cost wireless modules from Nexa and Proove

large

nexa-infalld-fjarrstrombrytare-1000-w

Well you all recognize them. Low cost single way communication modules working over 433 MHz.  Reliable enough for lights IMO. But they could of course equally well have been Z-Wave, KNX, X10 or some other solution.

The CAN4VSCP Roma module will control these things and it sits on my desk at the moment working pretty well. It will be available in the store also one day I hope.

At the moment I us a Tellstick  from Telldus AB to control  lights connected this way. There are other similar products available and Arduino solutions that can do it as well

TellStick_1-600x600_0

Well this solution just let me execute a binary on a Linux machine to turn on/off a group of lamps.  There are similar devices available for all other vertical solutions. So to control KNX units with the VSCP daemon find an executable that can do that and the same for Z-Wave (OpenZwave) or whatever solution you want to integrate. Or write your own script or executable that does it. It is usually not a big deal.

But it of course does not end with an executable. The VSCP daemon can do many other things. Call an URL/send events/start timers etc etc. You can add anything and you should be able to add everything because the world consist and will consist of many different things,

Turn on lights at sunset

So lets look at the first point. This can be done in many ways of course but if you enter the coordinates for your location in the VSCP daemon configuration file  (dm.xml) in the Automation section  the decision matrix will be feed with two events that are of interest for this  type of control

CLASS1.INFORMATION, Type=45, Sunset

Sent when astronomical sunset happens at the location set by the coordinates.

CLASS1.INFORMATION, Type=35, Sunset-Twilight

Sent when astronomical sunset-twilight happens at the location set by the coordinates. The definition of twilight is

Nautical twilight is the period when the center of the Sun is between 6 and 12 degrees below the horizon, when bright stars are still visible in clear weather and the horizon is becoming visible. It is too dark to do outdoor activities without additional lighting.

You have to enable the events also if they are disabled in the configuration file.

Restating the VSCP daemon with

/etc/init.d/vscpd restart

and then opening

http://192.168.1.6:8080/vscp/configure

in your web browser (replacing 192.168.1.6 with your server ip) will show you the calculated times

Screenshot from 2016-01-31 16:17:53

We see that today when this is written the sunset is at 15:57 and the sunset twilight is at 16:44 two times one can use to turn on lights because it’s getting dark outside.

For indoor light I use sunset and for outdoor light I use twilight sunset for this.  It all of course depends on how dark one want it to be before lights are turned on.

So setting this up in the web interface

Screenshot from 2016-01-31 16:25:23

Priority has flags set to zero so we don’t care about it.

Class is set to 20 which is CLASS1.INFORMATION and corresponding  flags are set to 0xFFFF meaning all bits should be checked.

Type is set to 45 which is Sunset and corresponding  flags are set to 0xFFFF meaning all bits should be checked.

GUID has mask all set to zero so we don’t check it.

On control we see that we don’t check index/zone/subzone but that we enable this row.

So at this point we say that events of type   CLASS1.INFORMATION, Type=45, Sunset  will perform what ever action we choose.

Screenshot from 2016-01-31 16:25:37

In the “when-section” we select when the action should happen. Her from the beginning of time to the the end of time and all weekdays and all times.  As you see it is possible to have different schemas for different weekdays and for different time of year.

Screenshot from 2016-01-31 16:25:48

And then we have the action to perform. In my case I execute an external file and turn on lamps in section 1. But there are many actions to choose from and Send Event is one. Typically used in his case to send to a group of Paris modules to instruct them to switch some relays on.

You can have many rows that trigger on the same event and therefore easily mix technology and control KNX, Z-wave, VSCP and other alongside each other.

The XML row for this scenario looks like this

<row enable=”true” groupid=”Tellstick” >
<mask priority=”0″
class=”65535″
type=”65535″
GUID=” 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00″ > </mask>
<filter priority=”0″
class=”20″
type=”45″
GUID=” 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00″ >
</filter>
<control>0x0</control>
<action>0x10</action>
<param>/usr/local/bin/tdtool –on 1
<comment>Turn on window ligts when sun goes down</comment>
<allowed_from>0000-01-01 00:00:00</allowed_from>
<allowed_to>9999-12-31 23:59:59</allowed_to>
<allowed_weekdays>mtwtfss</allowed_weekdays>
<allowed_time>*-*-* *:*:*</allowed_time>
<index bMeasurement=”false” > 0</index>
<zone>0</zone>
<subzone>0</subzone>
</row>

Turn off at sunrise

To turn off lights at sunrise just trigger on CLASS1.INFORMATION, Type=44, Sunrise or  CLASS1.INFORMATION, Type=52, sunrise twilight time.  The rest is the same as the above case.

Turn off the lights at a specified time

Here in this house I turn of some lights for the night at 02:00 regardless. This is how that is done

Screenshot from 2016-01-31 16:55:11

Priority is not used and therefore it’s corresponding  flags are set to zero.

Class is set t 65535 which is CLASS2.VSCP. The corresponding flags are set to all ones or 0xffff.

Type is set to 6 and that means we will trigger on CLASS2.VSCP, Type=6, Minute events. This event is feed through the matrix every minute. The corresponding flags are set to all ones or 0xffff.

GUID has mask all set to zero so we don’t check it.

On control we see that we don’t check index/zone/subzone but that we enable this row.

Screenshot from 2016-01-31 16:55:30

Again in the “when-section” we select when the action should happen. Her from the beginning of time to the the end of time and all weekdays.  The difference here frm the previous example is the

*-*-* 02:00:00/10/20/30/4/50

The

*-*-*

says the action will be triggered on every date.  If we want a specific thing to happen just on x-as eve we enter that here.

02:00:00/10/20/30/4/50

This part could have just been

02:00:00

meaning trigger at that time. But here we added some more times we now trigger on

02:00:00
02:00:10
02:00:20
02:00:30
02:00:40
02:00:50

that is on several times ten second apart.  A way to enter this without having a new DM row for each. This is possible on all fields in allowed time. So it is easy to do things at certain days of the month etc.

For the curious I did this so lights definitely will be turned off as I had some interference with the radio signal some times.

Screenshot from 2016-01-31 17:12:19

And then again we have the action which in this case turn off section 1 instead of on.

And yes turning on something at a certain time is just the same but with another action and also here one can send events or do other things.

The xml line looks like this

<row enable=”true” groupid=”” >
<mask  priority=”0″  class=”65535″  type=”65535″  GUID=” 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00″ > </mask>
<filter  priority=”0″  class=”65535″  type=”6″  GUID=” 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00″ > </filter>
<control>0x0</control>
<action>0x10</action>
<param>/usr/local/bin/tdtool –off 1;
<comment>Turn off window lights @ 02:00</comment>
<allowed_from>0000-01-01 00:00:00</allowed_from>
<allowed_to>9999-12-31 23:59:59</allowed_to>
<allowed_weekdays>mtwtfss</allowed_weekdays>
<allowed_time>*-*-* 02:00:00/10/20/30/40/50</allowed_time>
<index  bMeasurement=”false”  > 0</index>
<zone>0</zone>
<subzone>0</subzone>
</row>

 

The future

Time time is a resource that is limited.  When I did the DM of the VSCP daemon a long time ago an external nice and user friendly interface to edit it was planed. Not the web based interface that is available to day which is targeting a technical user.  Actually editing is possible remotely also today so it is only the UX code missing.  That will probably come in place one day. Giving this functionality the attention and usability it deserves.

An even more exciting feature that will come to this functionality, probably in the next release, is scripting right inside the VSCP daemon. That will make this an extremely cool cat.

Hopefully this gave some lights of the magic’s of the VSCP daemon DM.