Populate To-Do list via NodeRed

Do we have any options to Populate and/or update a To-Do list via Node Red?

I’d like to monitor my Battery powered sensors and populate a To-Do list via NodeRed.

To-Do List is a base integration for other integrations to use.

In HA the lists can be shown using a To Do list card.
The list entity state is the count of uncompleted item on the list.

There are a range of service calls provided that can be called from HA or by using the HA WebSocket service call node in Node-RED.

https://www.home-assistant.io/integrations/todo/#services

As will be the way going forward, there are no attributes to a To Do List entity - the actual current list is obtained by performing the service call To-do list: Get to-do list items. The version of HA WebSocket nodes I am currently using does not support service call returns, so I am waiting for the next Node-RED addon release, which should include Node-RED v3.1.1 and the latest WebSocket node version. Hopefully then service call return values will become available and it should be possible to get a to-do list back into Node-RED.

You can get the current items from the todo list by using the API node. You need to set data up like this:

msg.payload.data = {
    "type": "execute_script",
    "sequence": [
        {
            "service" : "todo.get_items",
            "target" : {
                "entity_id" : entity
            },
            "data" : {
                "status" : status
            },
            "response_variable" : "service_result"
        },
        {
            "stop" : "done",
            "response_variable": "service_result"
        }
    ]
}

‘entity’ being the todo list entity and status being either ‘completed’ or ‘needs_action’. Status can be left blank if you want both.

1 Like