Node Red - Event Result - Todoist Task

I am trying to wrap my head around an automation to assist with my old Roomba.

I have a Roomba connected to HA as well as a Todoist Integration.

I have Node Red setup and connected and I can create a new Task in Node Red using new_task.

Here is the automation I am trying to establish:

  1. If dustbin is full then create new_task “empty the dust bin”
  2. If battery is < 10% create new_task “place Roomba on the docker”
  3. If vacuum status is stuck create new_task “place Roomba on the docker”

I know I can create three separate triggers with three separate Todoist new_task commands, however it would be simpler to have the 3 separate triggers create a task message based upon the trigger.

Here is an example of the flow.

To better ask the question: how can I organize the flow so that the Todoist message parameter changes based upon the triggering state?

I think that the easiest way would be to use a function node in between where you set the beloning parameters

If you’re using a newer version of the HA nodes. The events: state node has customizable output properties. You can set a different msg.payload for each node and then use it in the call-service node.

Output Properties:
msg.payload = empty dust bin

Data Field of call-service node

{
   "content": payload
}

I changed the output property as you said, here is my service call:

{ "content": payload, "project": "inbox"}

My result is:

"Call-service error. extra keys not allowed @ data['0']"

What’s the data field type set to? If it’s J: Expression it should work as is. If it JSON you’ll need to use a mustache template to insert the data.

{ "content": "{{payload}}", "project": "inbox"}

https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/call-service.html

You can also turn on the debugging in the call-service to see output sent to HA.

Yes! Got it. I am a newbie. Thanks for the prompt and kind response.

Hey guys,

Just trying to work this out myself.

What do I need for the entity ID?

The calendar?

image

I’ve tried nothing and the calendar, but nether work :frowning:

EDIT!

Its all good guys, NO IDEA WHY, but it just went from “no connection” as the error, to working fine.

Who knows lol