Hallo,
ich habe hier in Anfängermanier etwas zusammengebaut und vielleicht könnte sich das jemand mir mehr Ahnung ansehen.
Der Flow funktioniert dann, wenn ich einen Deploy manuell starte, nachdem ich z.B. eine kleine Änderung gemacht habe(z.B. Node etwas verschoben)
Es wird dann currentbrightness, upperirthreshold und lowerirthreshold korrekt ausgelesen und die Switche des entsprechenden Modus(Tagmodus oder Nachtmodus) ausgeführt.
Das Problem:
Wenn ich jetzt manuell über die Instar WebUI upperirthreshold und lowerirthreshold ändere, dann sehe ich die Änderungen auch im Debug Code von Node-RED, aber der Switch zu Tag- bzw. Nachtmodus wird nicht mehr ausgeführt. Meine Vermutung ist, daß es im Flow dann keine Rückmeldung zu currentbrightness gibt und somit die Funktion Tagmodus oder Nachtmodus nicht mehr ausgeführt wird.
Brauche ich sowas in der Art wie permanentes Polling der Zustände, oder wie mache ich das?
Über Hinweise wäre ich dankbar!
Danke und viele Grüße
Klaus
[{"id":"bea250fa.891a18","type":"tab","label":"Tagmodus-Nachtmodus-Bereiche","disabled":false,"info":""},{"id":"372d52b3.0dcca6","type":"mqtt in","z":"bea250fa.891a18","name":"currentbrightness","topic":"instar/10D1DC222161/status/features/nightvision/currentbrightness","qos":"2","datatype":"auto","broker":"485c4f66.ce892","x":100,"y":320,"wires":[["79defb31.62b81c"]]},{"id":"f04b7e49.4b85a","type":"function","z":"bea250fa.891a18","name":"Tagmodus","func":"var currentbrightness = flow.get(\"currentbrightness\");\nvar upperirthreshold = flow.get(\"upperirthreshold\");\ncurrentbrightness = Number(currentbrightness);\nupperirthreshold = Number(upperirthreshold);\n\nif (currentbrightness < upperirthreshold)\n{\n msg.payload = 'Tagmodus';\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":280,"wires":[["6aed39ea.441a3","8bf3ee61.f385c8","874d4399.193808"]]},{"id":"7ab4ffb3.98966","type":"function","z":"bea250fa.891a18","name":"Nachtmodus","func":"var currentbrightness = flow.get(\"currentbrightness\");\nvar lowerirthreshold = flow.get(\"lowerirthreshold\");\ncurrentbrightness = Number(currentbrightness);\nlowerirthreshold = Number(lowerirthreshold);\n\nif ( currentbrightness > lowerirthreshold )\n{\n msg.payload = 'Nachtmodus';\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":360,"wires":[["97e17ad2.e2045","cb97600c.8bf03","874d4399.193808"]]},{"id":"dcb1d945.3c8098","type":"mqtt in","z":"bea250fa.891a18","name":"upperirthreshold","topic":"instar/10D1DC222161/status/features/nightvision/upperirthreshold","qos":"2","datatype":"auto","broker":"485c4f66.ce892","x":100,"y":120,"wires":[["fa1ac640.74df6"]]},{"id":"b42a6678.299f9","type":"mqtt in","z":"bea250fa.891a18","name":"lowerirthreshold","topic":"instar/10D1DC222161/status/features/nightvision/lowerirthreshold","qos":"2","datatype":"auto","broker":"485c4f66.ce892","x":100,"y":180,"wires":[["79d176a3.42b2b"]]},{"id":"79d176a3.42b2b","type":"function","z":"bea250fa.891a18","name":"formatlower","func":"msg.topic = \"lowerirthreshold\";\n\nvar lowerirthreshold = msg.payload.replace(/^\\D+|\\D+$/g, \"\")\n\nmsg.payload = Number(lowerirthreshold);\nflow.set('lowerirthreshold', msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":180,"wires":[["874d4399.193808"]]},{"id":"fa1ac640.74df6","type":"function","z":"bea250fa.891a18","name":"formatupper","func":"msg.topic = \"upperirthreshold\";\nvar upperirthreshold = msg.payload.replace(/^\\D+|\\D+$/g, \"\")\n\nmsg.payload = Number(upperirthreshold);\nflow.set('upperirthreshold', msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":120,"wires":[["874d4399.193808"]]},{"id":"cb97600c.8bf03","type":"change","z":"bea250fa.891a18","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"off\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":380,"wires":[["323f969b.72924a"]]},{"id":"323f969b.72924a","type":"mqtt out","z":"bea250fa.891a18","name":"alarm/actions/linkareas","topic":"instar/10D1DC222161/alarm/actions/linkareas","qos":"1","retain":"false","broker":"485c4f66.ce892","x":860,"y":440,"wires":[]},{"id":"6aed39ea.441a3","type":"change","z":"bea250fa.891a18","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"on\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":300,"wires":[["323f969b.72924a"]]},{"id":"413b39f.4fa71c8","type":"mqtt out","z":"bea250fa.891a18","name":"alarm/area1/enable","topic":"instar/10D1DC222161/alarm/area1/enable","qos":"1","retain":"false","broker":"485c4f66.ce892","x":850,"y":200,"wires":[]},{"id":"8bf3ee61.f385c8","type":"change","z":"bea250fa.891a18","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"1\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":260,"wires":[["413b39f.4fa71c8","5c5f8ef9.ff2da8","4c450efe.378b38","6b90a3e8.8b5194"]]},{"id":"97e17ad2.e2045","type":"change","z":"bea250fa.891a18","name":"0","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"val\":\"0\"}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":340,"wires":[["6b90a3e8.8b5194","4c450efe.378b38","5c5f8ef9.ff2da8","413b39f.4fa71c8"]]},{"id":"5c5f8ef9.ff2da8","type":"mqtt out","z":"bea250fa.891a18","name":"alarm/area2/enable","topic":"instar/10D1DC222161/alarm/area2/enable","qos":"1","retain":"false","broker":"485c4f66.ce892","x":850,"y":260,"wires":[]},{"id":"4c450efe.378b38","type":"mqtt out","z":"bea250fa.891a18","name":"alarm/area3/enable","topic":"instar/10D1DC222161/alarm/area3/enable","qos":"1","retain":"false","broker":"485c4f66.ce892","x":850,"y":320,"wires":[]},{"id":"6b90a3e8.8b5194","type":"mqtt out","z":"bea250fa.891a18","name":"alarm/area4/enable","topic":"instar/10D1DC222161/alarm/area4/enable","qos":"1","retain":"false","broker":"485c4f66.ce892","x":850,"y":380,"wires":[]},{"id":"874d4399.193808","type":"debug","z":"bea250fa.891a18","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":520,"y":140,"wires":[]},{"id":"79defb31.62b81c","type":"function","z":"bea250fa.891a18","name":"formatcurrent","func":"msg.topic = \"currentbrightness\";\n\nvar currentbrightness = msg.payload.replace(/^\\D+|\\D+$/g, \"\")\n\nmsg.payload = Number(currentbrightness);\nflow.set('currentbrightness', msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":320,"wires":[["f04b7e49.4b85a","7ab4ffb3.98966","874d4399.193808"]]},{"id":"485c4f66.ce892","type":"mqtt-broker","z":"","name":"IN-8009-FHD-PoE","broker":"192.168.179.39","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]