To-Do List to Text Sensor - How to send text data as a array back to HA

Hi, I’m trying to call the todo.get_items service in Node-Red, then parse the data, and then resubmit it ot a sensor. And within ESPHome, I’m calling this to display it on a screen.

The Node-Red JSON is in the postscript.

I wanted to ask how I could send this back to Home Assistant as an array so I don’t have to split it up on the ESP Home end as at the moment I am only able to send it back as a comma-delimited line via a Text Sensor.

[{"id":"979f7107afdf4817","type":"ha-api","z":"0b760eb9a04f74c8","name":"","server":"6e1391854e2895e5","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"{\t \"type\": \"execute_script\",\t \"sequence\": [\t {\t \"service\": \"todo.get_items\",\t \"data\": {\t },\t \"target\": {\t \"entity_id\": [\t \"todo.196_to_do\"\t ]\t },\t \"response_variable\": \"service_result\"\t },\t {\t \"stop\": \"done\",\t \"response_variable\": \"service_result\"\t }\t ]\t}","dataType":"jsonata","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":410,"y":1120,"wires":[["1f71d300fc18f279"]]},{"id":"1f71d300fc18f279","type":"function","z":"0b760eb9a04f74c8","name":"function 9","func":"var temp = msg.payload.response[\"todo.196_to_do\"]\n\nvar temp1 = []\nfor (let i = 0; i < temp.items.length; i++){\n temp1[i]=temp.items[i].summary\n}\nvar out=temp1.join(';');\n\nmsg.payload=out\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":1120,"wires":[["0f5824798f1c1d76"]]},{"id":"0f5824798f1c1d76","type":"ha-text","z":"0b760eb9a04f74c8","name":"","version":1,"debugenabled":false,"inputs":1,"outputs":1,"entityConfig":"62966410af62e002","mode":"set","value":"payload","valueType":"msg","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"value"},{"property":"previousValue","propertyType":"msg","value":"","valueType":"previousValue"}],"x":830,"y":1120,"wires":[[]]},{"id":"6e1391854e2895e5","type":"server","name":"196","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false},{"id":"62966410af62e002","type":"ha-entity-config","server":"6e1391854e2895e5","deviceConfig":"8040d9e09ab3ce36","name":"ToDo_NodeRed","version":"6","entityType":"text","haConfig":[{"property":"name","value":""},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"mode","value":"text"},{"property":"min_length","value":""},{"property":"max_length","value":""},{"property":"pattern","value":""}],"resend":false,"debugEnabled":false},{"id":"8040d9e09ab3ce36","type":"ha-device-config","name":"Todo_List_NodeRed","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]

You can use an Action node instead of the API node to retrieve the data. To send the data to Home Assistant, use the Sensor node and store the data in an attribute. The state value can be anything.