How to send a object by button click

By clicking on the button I want send this object :
image
not sure if i can do it directly in button properties:

I asked this question a couple of times, but had no response. As a work around you can pass it in the topic, by moving it to topic and after button moving it back.
e.g.

[{"id":"4e4030f2.dfd108","type":"inject","z":"bf9e1e33.030598","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"topic_test","payload":"{\"test\":1}","payloadType":"json","x":200,"y":840,"wires":[["4484635c.03cf24"]]},{"id":"4484635c.03cf24","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"[$$.topic,$$.payload]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":840,"wires":[["6c09a28.a79875c"]]},{"id":"6c09a28.a79875c","type":"ui_button","z":"bf9e1e33.030598","name":"","group":"2d4fe667.28f8ba","order":23,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":630,"y":840,"wires":[["5741f42.5864a0c"]]},{"id":"5741f42.5864a0c","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"topic[1]","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"topic[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":900,"wires":[["1923b48a.75b083"]]},{"id":"1923b48a.75b083","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":900,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

I'm thinking to send by button click a buffer and then with parse buffer do what I need, but is there any more easy way ?

[{"id":"b23eb81b5d848a85","type":"debug","z":"bc76ab2f.9bc068","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":2880,"wires":[]},{"id":"cd57c6f61719fffc","type":"ui_button","z":"bc76ab2f.9bc068","name":"","group":"3da36874.a9b2c8","order":3,"width":0,"height":0,"passthru":false,"label":"button","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"[\"0x10\",\"0x01\",\"0xD2\",\"0xFF\"]","payloadType":"bin","topic":"topic","topicType":"msg","x":440,"y":2880,"wires":[["533f2e74ea7508a4"]]},{"id":"533f2e74ea7508a4","type":"buffer-parser","z":"bc76ab2f.9bc068","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint8","name":"item1","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"item2","offset":1,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"item3","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"item4","offset":3,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":610,"y":2880,"wires":[["b23eb81b5d848a85"]]},{"id":"3da36874.a9b2c8","type":"ui_group","name":"Hosté","tab":"befeb13c.bfa17","order":1,"disp":true,"width":4,"collapse":false,"className":""},{"id":"befeb13c.bfa17","type":"ui_tab","name":"TOPENÍ ETATHERM","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

If the buffer is static just enter it in the payload field after selecting buffer,. If it is dynamic and a incoming payload, you will have to do as in example above.
If this does not answer your query, then please explain a bit more what you are trying to do.

if you litterialy want to pass that data, select the 'json' option


This is the output:
Screen Shot 2022-02-17 at 5.09.10 AM

and Hexadecimal ? This : {"DLE":0x00,"SOH":0x00,"BUSH":0x00}
isn't working

That is not valid JSON.

{"DLE":0,"SOH":0,"BUSH":0}

This is :point_up:

yes, but 0xDC no chance to send directly

You could send like this - {"DLE":"0x00","SOH":"0x00","BUSH":"0x00"}

0xDC is simply 220. Use that if hard coded

Or, if dynamic, you can convert to integer using parseInt('0xDC')

ok, I will stay with this solution:

[{"id":"4938353d0b0cc294","type":"ui_button","z":"bc76ab2f.9bc068","name":"","group":"8c11279992e11f1f","order":5,"width":6,"height":1,"passthru":false,"label":"test","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"[\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x11\",\"0x23\",\"0x00\",\"0x19\",\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x00\",\"0x00\"]","payloadType":"bin","topic":"topic","topicType":"msg","x":410,"y":2960,"wires":[["c10b57cd21eab1a3"]]},{"id":"c10b57cd21eab1a3","type":"buffer-parser","z":"bc76ab2f.9bc068","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"uint8","name":"DLE","offset":0,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"SOH","offset":1,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"BUSH","offset":2,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"BUSL","offset":3,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"RAMH","offset":4,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"RAML","offset":5,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"DC","offset":6,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"D0_TMP_data","offset":7,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"D1_STime","offset":8,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"D2_STime","offset":9,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"D3_ETime","offset":10,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"D4_ETime","offset":11,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"ADDS","offset":12,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"XORS","offset":13,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"END","offset":14,"length":1,"offsetbit":0,"scale":"1","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":true,"setTopic":false,"outputs":1,"x":690,"y":3000,"wires":[[]]},{"id":"8c11279992e11f1f","type":"ui_group","name":"OPERATIVNÍ ZMĚNY","tab":"befeb13c.bfa17","order":41,"disp":true,"width":6,"collapse":false,"className":""},{"id":"befeb13c.bfa17","type":"ui_tab","name":"TOPENÍ ETATHERM","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

With this I can send different instructions from different sources

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