Bur when I look at device 190 I notice that it last update was March 6.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."}
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": ""
}
]