Refresh the template

Hi

ESP32 sends the IP address using MQTT.
Node-Red receives IP.

Then, in Template, it shows the image using the following code.
(However, Node-Red should be refesh.)

When I received IP address as MQTT, how can I set the IP to Template and refresh?

[{"id":"3b02cbd8.63b414","type":"tab","label":"test","disabled":false,"info":""},{"id":"27e75e0b.f651e2","type":"mqtt in","z":"3b02cbd8.63b414","name":"","topic":"iot_device","qos":"2","datatype":"auto","broker":"bbceadd3.f1d4e","x":130,"y":300,"wires":[["87673929.e6d958"]]},{"id":"1ee72f3b.254e31","type":"ui_template","z":"3b02cbd8.63b414","group":"4765c354.bc2a3c","name":"","order":2,"width":12,"height":9,"format":"<img src={{msg.payload}} width=\"600\" height=\"400\">","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":660,"y":300,"wires":[[]]},{"id":"87673929.e6d958","type":"json","z":"3b02cbd8.63b414","name":"","property":"payload","action":"","pretty":false,"x":330,"y":300,"wires":[["e98b4b11.9d24f8"]]},{"id":"e98b4b11.9d24f8","type":"function","z":"3b02cbd8.63b414","name":"","func":"msg.payload = \"http://\" + msg.payload.ip;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":300,"wires":[["1ee72f3b.254e31","2f6a51d3.66546e","95513536.eea448"]]},{"id":"2f6a51d3.66546e","type":"debug","z":"3b02cbd8.63b414","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":220,"wires":[]},{"id":"95513536.eea448","type":"ui_text","z":"3b02cbd8.63b414","group":"4765c354.bc2a3c","order":1,"width":12,"height":1,"name":"","label":"Ip Address :","format":"{{msg.payload}}","layout":"row-spread","x":680,"y":160,"wires":[]},{"id":"bbceadd3.f1d4e","type":"mqtt-broker","name":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4765c354.bc2a3c","type":"ui_group","name":"camera","tab":"4a936a6e.c33414","order":1,"disp":true,"width":12,"collapse":false},{"id":"4a936a6e.c33414","type":"ui_tab","name":"Camera","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

thanks

put quotes around the src attribute value in your template.

bad...

<img src={{payload}} width="600" height="400">

good...

<img src="{{payload}}" width="600" height="400">

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