Pass over msg.payload to html

im trying topass over the answer from my modbus reader to a html page which i can read with my samsung smartthings device.

the debug on the modbus reader shows my so called PV Power Value (e.g. [1223])
but i can not pass the value over to html page

[{"id":"509fe3f3.ed4fcc","type":"modbus-read","z":"b674ccb9.e4634","name":"PV Leistung in Watt","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"1","dataType":"HoldingRegister","adr":"40067","quantity":"1","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"2a37966f.8a7eea","x":165,"y":197.3088870048523,"wires":[["9defc885.442278","16de300a.4bf8f"],[]]},{"id":"42f0b148.f4ea1","type":"http in","z":"b674ccb9.e4634","name":"","url":"/bbat","method":"get","upload":false,"swaggerDoc":"","x":249.43756103515625,"y":363.99999237060547,"wires":[["16de300a.4bf8f"]]},{"id":"16de300a.4bf8f","type":"template","z":"b674ccb9.e4634","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"","output":"str","x":435.4375648498535,"y":317.0000009536743,"wires":[["f0b63f49.4071f","26b0f85f.2a7ab8"]]},{"id":"f0b63f49.4071f","type":"change","z":"b674ccb9.e4634","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"application/json","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":599.4375610351562,"y":363.99999237060547,"wires":[["f92e563e.932688"]]},{"id":"f92e563e.932688","type":"http response","z":"b674ccb9.e4634","name":"","x":759.4375610351562,"y":363.99999237060547,"wires":[]},{"id":"26b0f85f.2a7ab8","type":"debug","z":"b674ccb9.e4634","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":613.4375686645508,"y":224,"wires":[]},{"id":"9defc885.442278","type":"ui_text","z":"b674ccb9.e4634","group":"31d27e.7e2f7d82","order":0,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload}}","layout":"row-spread","x":399.0376205444336,"y":132,"wires":[]},{"id":"2a37966f.8a7eea","type":"modbus-client","z":"","name":"E3DC S10 Hauskraftwerk","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"192.168.178.60","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"31d27e.7e2f7d82","type":"ui_group","z":"","name":"Default","tab":"adb4fc7c.30a73","disp":true,"width":"6","collapse":false},{"id":"adb4fc7c.30a73","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Hi and welcome to the forum.

Just a note, Not everyone will install morbus nodes to test your flow. And it's even more unlikely they will have the same device to get data from.

You are more likely to get assistance if you provide a flow with various injects that simulate the data.

You can easily achieve this by using the copy button from the debug output, put the result into JSON payload in the inject and press it. If you get the same format data in the debug window as the data from your morbus device, then paste that flow (minus the morbus stuff).

Anyhow, I think you might as this yourself. Have a read of this. It has invaluable information to help you "get it"

1 Like

Hi,

sorry, i didnt get you ... if i understand you right i must copy the debug outlut (e.g. [1233]) to inject node ?

image

this is my output from modbus ...

and this value (248) i want to pass over to html ?

im not an it guy - i already read the link you provided .. sorry my stupid question and bad english and thank you so much for your help !

Your value:

array[1]

As per documentation, example:

  • Array - [1,2,3,4]

payload.Phone[2].type

Can you fill in the blanks ?

this must be

msg.payload[0]

how can i output that now on html ?

Use a dashboard label
Or
Use a ui_template node

They both have built in instructions. Give it a go.

You may need to drop the msg. part.

i must have the value provided within a GET Request ... iam requesting ip/bbat and log /use the whole $response

i dropped msg.
now i get

[object Object]

Ah ok. So...

You'll have to store the value somewhere ready for the GET request. Connect your morbus output to a change node and set a flow variable e.g. flow.data from msg.payload[0]. That will keep a copy.

Next add a http in and out node with a change node between them setting msg.payload from flow.data.

it works with your hint ! thank you so much ! ive been working on this since weeks :stuck_out_tongue_winking_eye: ... i will showyou my result later !

1 Like