Page 1 of 1

Text not updating

Posted: Thursday 31 March 2022 11:31
by EdwinK
I see this in my debug-log file
2022-03-31 11:20:05.155 Debug: MQTT Auto Disc: Topic: domoticz/in, Message: {"command":"udevice","idx":190,"nvalue":2,"svalue":"Kans op gladheid door sneeuwval."}
Bur when I look at device 190 I notice that it last update was March 6.

this is what I have in Node-Red.

Code: Select all

[
    {
        "id": "37cc8291989eb8a8",
        "type": "tab",
        "label": "MeteoAlarm KNMI",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "6c6dcd5fb912ade7",
        "type": "http request",
        "z": "37cc8291989eb8a8",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://cdn.knmi.nl/knmi/xml/rss/rss_KNMIwaarschuwingen.xml",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 350,
        "y": 160,
        "wires": [
            [
                "74b6e54b66b937f2"
            ]
        ]
    },
    {
        "id": "206e54fce96bfcf8",
        "type": "inject",
        "z": "37cc8291989eb8a8",
        "name": "10 Minute tick",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 140,
        "y": 160,
        "wires": [
            [
                "6c6dcd5fb912ade7"
            ]
        ]
    },
    {
        "id": "74b6e54b66b937f2",
        "type": "xml",
        "z": "37cc8291989eb8a8",
        "name": "",
        "property": "payload",
        "attr": "",
        "chr": "",
        "x": 530,
        "y": 160,
        "wires": [
            [
                "f1c7fef468771b6a"
            ]
        ]
    },
    {
        "id": "f1c7fef468771b6a",
        "type": "function",
        "z": "37cc8291989eb8a8",
        "name": "Function",
        "func": "var i;\nvar desc;\nvar mod_desc;\nvar al_txt;\nvar no_al_txt;\nfor (i = 0; i < msg.payload.rss.channel[0].item.length; i++) {\n    if (msg.payload.rss.channel[0].item[i].title[0] === \"Waarschuwingen Zuid-Holland\") {\n        desc = msg.payload.rss.channel[0].item[i].description[0];\n        mod_desc = desc.replace(/(<([^>]+)>)/ig, '.'); // Modified description without HTML tags. Tags replaced by . (dot)\n        no_al_txt = mod_desc.substring((mod_desc.indexOf(\".\") + 2), (mod_desc.indexOf(\".\", (mod_desc.indexOf(\".\") + 1)) + 1));\n        al_txt = mod_desc.substring((mod_desc.indexOf(\"..\") + 2), (mod_desc.indexOf(\"..\", (mod_desc.indexOf(\"..\") + 1)) + 1));\n    }\n}\nswitch (desc.substring(5,desc.indexOf(\".\"))) {\n    case \"Groen\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 190, \"nvalue\": 1, \"svalue\": no_al_txt };\n        break;\n\n   case \"Geel\" :\n        msg.payload = { \"command\": \"udevice\", \"idx\": 190, \"nvalue\": 2, \"svalue\": al_txt };\n        break;\n\n    case \"Oranje\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 190, \"nvalue\": 3, \"svalue\": al_txt };\n        break;\n\n    case \"Rood\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 190, \"nvalue\": 4, \"svalue\": al_txt };\n        break;\n\n    default:\n        msg.payload = { \"command\": \"udevice\", \"idx\": 190, \"nvalue\": 0, \"svalue\": \"No Data available\" };\n        break;\n}\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 160,
        "wires": [
            [
                "5b307902260f6b0a"
            ]
        ]
    },
    {
        "id": "5b307902260f6b0a",
        "type": "mqtt out",
        "z": "37cc8291989eb8a8",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "2d06e6e96ce54335",
        "x": 890,
        "y": 160,
        "wires": []
    },
    {
        "id": "cae751d6c4047878",
        "type": "comment",
        "z": "37cc8291989eb8a8",
        "name": "Meteoalarm KNMI",
        "info": "",
        "x": 570,
        "y": 100,
        "wires": []
    },
    {
        "id": "2d06e6e96ce54335",
        "type": "mqtt-broker",
        "name": "MQTT_Server",
        "broker": "192.168.0.11",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

Re: Text not uodating

Posted: Thursday 31 March 2022 15:47
by FireWizard
Hello @EdwinK,

If I look to your debug file, I see:
Debug: MQTT Auto Disc
The Node RED flow for KNMI Weather Alarm has never been prepared to use Auto Discovery and will not work as the topic is "domoticz/in"
The message (at least today) is correct and should be send every 10 minutes.

What have you done on March 6? Did you configure MQTT Auto Discovery on that date?
Check that.

Regards

Re: Text not updating

Posted: Thursday 31 March 2022 18:59
by EdwinK
O. I didn't know that it couldn't be used with the autodiscovery plugin. So, if I use the normal MQTT plugin it should work?
Can't remember what I did on that day, but i'll try to figure it out.

Re: Text not updating

Posted: Thursday 31 March 2022 19:03
by FireWizard
Hello @EdwinK,
So, if I use the normal MQTT plugin it should work?
YES

I never made that to be used by Auto Discovery. That requires a specific topic structure,

Regards

Re: Text not updating

Posted: Thursday 31 March 2022 19:11
by EdwinK
Okay,. Well, I just found out it indeed does. Guess that I learn every day ;) Next thing is to see if there is a 'Pollen alert' system somewhere to use in Domoticz ;)

Re: Text not updating

Posted: Thursday 31 March 2022 19:17
by FireWizard
Hi@EdwinK
Next thing is to see if there is a 'Pollen alert' system somewhere
There is: https://hooikoortsradar.nl/ or https://pollennieuws.nl/ or https://www.hooikoortsalert.nl/

Regards