How to enter query/funtion to secure Modbus read with CronePlus

Hello.
Using several flows to read data from Modbus device -> data are stored in influxdb.
Using CronePlus or inject node to trigger the read with a modbus-getter node. Read durations are different -> some 15s / every 15min / 1 time per 24h

Issue:
Getting problems when i would like to collect the data 1x / 24h or every 15min - looks like the device is in sleep or not ready.

Therefore I would like to implement a function/query to secure the data are read and stored in influxdb.
How could I integrate a function or something else to check?

Please - need some help for a smart way.
Thx.

Following flow as an example.

[
    {
        "id": "c454cc2a06e55e7e",
        "type": "tab",
        "label": "Flow 5",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "5f544df279f3bdc4",
        "type": "modbus-getter",
        "z": "c454cc2a06e55e7e",
        "name": "Tiefenbohrung_EIN_AUS",
        "showStatusActivities": false,
        "showErrors": false,
        "logIOActivities": false,
        "unitid": "1",
        "dataType": "HoldingRegister",
        "adr": "529",
        "quantity": "4",
        "server": "82be51f24ff6f9e9",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": true,
        "keepMsgProperties": false,
        "x": 610,
        "y": 240,
        "wires": [
            [
                "2861e297a45dbdcd"
            ],
            []
        ]
    },
    {
        "id": "2861e297a45dbdcd",
        "type": "buffer-parser",
        "z": "c454cc2a06e55e7e",
        "name": "",
        "data": "responseBuffer.buffer",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "floatle",
                "name": "Tiefenbohrung_Ein",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "floatle",
                "name": "Tiefenbohrung_Aus",
                "offset": 4,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "swap16",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "output",
        "multipleResult": true,
        "fanOutMultipleResult": true,
        "setTopic": true,
        "outputs": 2,
        "x": 870,
        "y": 240,
        "wires": [
            [
                "ffc01717643e7f2c",
                "fadf47f850783c4a"
            ],
            [
                "05605fca6b978349",
                "fadf47f850783c4a"
            ]
        ]
    },
    {
        "id": "ffc01717643e7f2c",
        "type": "debug",
        "z": "c454cc2a06e55e7e",
        "name": "Tiefenbohrung_EIN",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1110,
        "y": 240,
        "wires": []
    },
    {
        "id": "05605fca6b978349",
        "type": "debug",
        "z": "c454cc2a06e55e7e",
        "name": "Tiefenbohrung_AUS",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1120,
        "y": 280,
        "wires": []
    },
    {
        "id": "fadf47f850783c4a",
        "type": "join",
        "z": "c454cc2a06e55e7e",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "num",
        "reduceFixup": "",
        "x": 1090,
        "y": 200,
        "wires": [
            [
                "da5112150a27b07c"
            ]
        ]
    },
    {
        "id": "50f6d9dfd3f57599",
        "type": "influxdb out",
        "z": "c454cc2a06e55e7e",
        "influxdb": "52608438d6b07280",
        "name": "InfluxDB_Write",
        "measurement": "Tiefenbohrung_EIN_AUS",
        "precision": "ms",
        "retentionPolicy": "",
        "database": "test",
        "precisionV18FluxV20": "s",
        "retentionPolicyV18Flux": "",
        "org": "GuE_InfluxDB",
        "bucket": "WP_Database",
        "x": 1520,
        "y": 200,
        "wires": []
    },
    {
        "id": "1aadfcc9ef44e517",
        "type": "cronplus",
        "z": "c454cc2a06e55e7e",
        "name": "Cron-Plus-Trigger",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "TriggerKeinBetriebTrue",
                "topic": "TriggerKeinBetriebTrue",
                "payloadType": "bool",
                "payload": "true",
                "expressionType": "cron",
                "expression": "*/15 * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 230,
        "y": 240,
        "wires": [
            [
                "5f544df279f3bdc4"
            ]
        ]
    },
    {
        "id": "da5112150a27b07c",
        "type": "switch",
        "z": "c454cc2a06e55e7e",
        "name": "KeinBetrieb_TRUE",
        "property": "BetriebszustandArray.KeinBetrieb",
        "propertyType": "global",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1310,
        "y": 200,
        "wires": [
            [
                "50f6d9dfd3f57599"
            ]
        ]
    },
    {
        "id": "82be51f24ff6f9e9",
        "type": "modbus-client",
        "name": "RS232_MOXA_NP5110",
        "clienttype": "serial",
        "bufferCommands": false,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "192.168.100.18",
        "tcpPort": "950",
        "tcpType": "TCP-RTU-BUFFERED",
        "serialPort": "/dev/ttyr00",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "50",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": false
    },
    {
        "id": "52608438d6b07280",
        "type": "influxdb",
        "hostname": "127.0.0.1",
        "port": "8086",
        "protocol": "http",
        "database": "database",
        "name": "WP_Database",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "2.0",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    }
]

I noticed in the Modbus node that you shared that you have "Empty msg on Modbus fail" enabled.

image

Maybe it would be better to uncheck this option so if the device goes to sleep and Modbus fails you will not get a msg .. that would also cause buffer parser to fail and also send unneeded values to influxdb

Also .. do you need that Join node after Buffer parser ? you could set the parser node's Output as Key/value

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.