Can anyone here tell me how the "on_or_off function-node" could be merged with the "ChangeLightState template-node", leaving the ChangeLightState-node in its current position.
Here is my flow:
[{"id":"85f4e1c9.1710d8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"dfd0784a.77a588","type":"websocket in","z":"85f4e1c9.1710d8","name":"rhasspywebsocket","server":"9b8318ef.a6f0e8","client":"","x":110,"y":140,"wires":[["b66dec54.3e3128"]]},{"id":"b66dec54.3e3128","type":"json","z":"85f4e1c9.1710d8","name":"","property":"payload","action":"","pretty":false,"x":230,"y":260,"wires":[["4d244953.608ed","5bc73af1.edfa94"]]},{"id":"b29d42d5.d4aef8","type":"change","z":"85f4e1c9.1710d8","name":"Unknown intent","rules":[{"t":"set","p":"payload","pt":"msg","to":"Wat zei u?","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":260,"wires":[["41f4b7d8.caec38"]]},{"id":"41f4b7d8.caec38","type":"http request","z":"85f4e1c9.1710d8","name":"text to speech","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://rhasspy:12101/api/text-to-speech","tls":"","persist":false,"proxy":"","authType":"","x":900,"y":280,"wires":[[]]},{"id":"b7e7def1.8a264","type":"template","z":"85f4e1c9.1710d8","name":"ChangeLightState","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Ik zet de {{ payload.slots.name }} {{ payload.slots.state}}","output":"str","x":630,"y":320,"wires":[["41f4b7d8.caec38"]]},{"id":"4c3f90e6.23fdf8","type":"mosca in","z":"85f4e1c9.1710d8","mqtt_port":"1883","mqtt_ws_port":8080,"name":"","username":"","password":"","dburl":"","x":110,"y":60,"wires":[[]]},{"id":"8007f30c.a1c978","type":"inject","z":"85f4e1c9.1710d8","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":220,"y":3240,"wires":[["be9d9f76.d76508"]]},{"id":"be9d9f76.d76508","type":"http request","z":"85f4e1c9.1710d8","name":"Relay off","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.85/cm?cmnd=POWER OFF","tls":"","persist":false,"proxy":"","authType":"","x":420,"y":3240,"wires":[[]]},{"id":"3619cc3a.ffdf8c","type":"inject","z":"85f4e1c9.1710d8","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":220,"y":3280,"wires":[["bd20226d.2f788"]]},{"id":"bd20226d.2f788","type":"http request","z":"85f4e1c9.1710d8","name":"Relay on","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.85/cm?cmnd=POWER ON","tls":"","persist":false,"proxy":"","authType":"","x":420,"y":3280,"wires":[[]]},{"id":"9f674c76.a2fc78","type":"http request","z":"85f4e1c9.1710d8","name":"Relay toggle","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.85/cm?cmnd=POWER TOGGLE","tls":"","persist":false,"proxy":"","authType":"","x":430,"y":3320,"wires":[[]]},{"id":"aa85d8be.d8afa8","type":"inject","z":"85f4e1c9.1710d8","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":220,"y":3320,"wires":[["9f674c76.a2fc78"]]},{"id":"59d12f94.53baa8","type":"http request","z":"85f4e1c9.1710d8","name":"Status","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.85/cm?cmnd=STATUS","tls":"","persist":false,"proxy":"","authType":"","x":410,"y":3380,"wires":[["62373e0f.750f4"]]},{"id":"8e69f1fc.ea425","type":"inject","z":"85f4e1c9.1710d8","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":220,"y":3380,"wires":[["59d12f94.53baa8"]]},{"id":"62373e0f.750f4","type":"debug","z":"85f4e1c9.1710d8","name":"","active":false,"console":"false","complete":"false","x":610,"y":3380,"wires":[]},{"id":"d3ea82e7.1fef7","type":"comment","z":"85f4e1c9.1710d8","name":"HTTP control","info":"Controlling the relay via HTTP\nHTTP API in the admin page need to be turned off\nCopy the api key from the admin page\n\nURL http://<ip>/api/relay/0?apikey=<api key>&value=0\naccepted values (at the end):\n0: off\n1: on\n2: toggle","x":170,"y":3200,"wires":[]},{"id":"4d244953.608ed","type":"switch","z":"85f4e1c9.1710d8","name":"","property":"payload.intent.name","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"},{"t":"eq","v":"ChangeLightState","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":300,"wires":[["b29d42d5.d4aef8"],["b7e7def1.8a264"]]},{"id":"28237f32.3292f","type":"mqtt out","z":"85f4e1c9.1710d8","name":"","topic":"cmnd/sonoffsalon/power","qos":"0","retain":"","broker":"f56d1a7c.e35768","x":770,"y":600,"wires":[]},{"id":"3db4e9f7.6e8086","type":"inject","z":"85f4e1c9.1710d8","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"off","payloadType":"str","x":410,"y":720,"wires":[["28237f32.3292f"]]},{"id":"fc34bb30.af20c","type":"inject","z":"85f4e1c9.1710d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"on","payloadType":"str","x":410,"y":760,"wires":[["28237f32.3292f"]]},{"id":"1accfeb0.f4c2a9","type":"comment","z":"85f4e1c9.1710d8","name":"MQTT control","info":"Controlling the relay via MQTT\n\nroot topic followed by relay/0/set\naccepted messages:\n0: off\n1: on\n2: toggle","x":410,"y":680,"wires":[]},{"id":"5bc73af1.edfa94","type":"function","z":"85f4e1c9.1710d8","name":"on_or_off","func":"\n if ((msg.payload.slots.state==\"aan\") && (msg.payload.slots.name==\"salonverlichting\"))\n {\n msg.payload=\"on\";\n } else {\n if ((msg.payload.slots.state==\"uit\") && (msg.payload.slots.name==\"salonverlichting\"))\n {\n msg.payload=\"off\";\n }\n } \n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":600,"wires":[["28237f32.3292f"]]},{"id":"9b8318ef.a6f0e8","type":"websocket-listener","z":"","path":"ws://rhasspy:12101/api/events/intent","wholemsg":"false"},{"id":"f56d1a7c.e35768","type":"mqtt-broker","z":"","name":"localhost:1883","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
kind regards,
Hugo