Working with a Todoist Reminder (also learning)

A challenge I have with my smart vacuums is to constantly keep track of whether they are charging or stuck someplace in the house. Therefore I created (tried) an automation that would remind me, via Todoist, to go get the vacuum at bedtime when stuck.

The challenge I have is that I am not doing so well with grabbing the various attributes of the device AND I also receive an error message in the logs related to the API. The practical result right now is I receive a reminder (actually a lot of reminders) with an empty device name and status. Can anyone assist with the following Flow:


[{"id":"32c219dc.a7307e","type":"server-state-changed","z":"50957880.0bf298","name":"Kitchen Mop","server":"8efa78ba.f10338","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"vacuum.kitchen_mop","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"running","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":200,"wires":[["5f897886.83f0f8"],[]]},{"id":"5f897886.83f0f8","type":"ha-get-entities","z":"50957880.0bf298","name":"Which Vacuum","server":"8efa78ba.f10338","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"vacuum.","valueType":"str"},{"property":"state","logic":"does_not_include","value":"on, cleaning, returning, docked, paused, idle","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":440,"y":100,"wires":[["ae241fcf.558a78"]]},{"id":"ccaf8493.3d07a","type":"server-state-changed","z":"50957880.0bf298","name":"Dining Room Vacuum","server":"8efa78ba.f10338","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"vacuum.dining_room","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"running","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":180,"y":60,"wires":[["5f897886.83f0f8"],[]]},{"id":"f3ffd7b7.3fb39","type":"server-state-changed","z":"50957880.0bf298","name":"House Vacuum","server":"8efa78ba.f10338","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"vacuum.house_vacuum","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"running","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":100,"wires":[["5f897886.83f0f8"],[]]},{"id":"92a268df.2a53d8","type":"server-state-changed","z":"50957880.0bf298","name":"Upstairs Vacuum","server":"8efa78ba.f10338","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"vacuum.upstairs_bedroom","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"running","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":160,"wires":[["5f897886.83f0f8"],[]]},{"id":"df9f6fb6.8b163","type":"inject","z":"50957880.0bf298","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":200,"wires":[["5f897886.83f0f8"]]},{"id":"ae241fcf.558a78","type":"api-call-service","z":"50957880.0bf298","name":"Remind Me to Fix","server":"8efa78ba.f10338","version":3,"debugenabled":false,"service_domain":"todoist","service":"new_task","entityId":"","data":"{\"content\":\"Fix {{payload.entity_id}} because it is {{payload.state} } and the battery level is {{payload.attributes.battery_level}}%\",\"project\":\"House\",\"labels\":\"Bedtime\",\"priority\":4,\"due_date_string\":\"in 2 hours\",\"due_date_lang\":\"en\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":100,"wires":[["593dfacd.1531c4"]]},{"id":"593dfacd.1531c4","type":"debug","z":"50957880.0bf298","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":740,"y":60,"wires":[]},{"id":"8efa78ba.f10338","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

The resulting error is as follows:

"Call-service error. ('86230eb8-fd0e-11eb-9762-0211322105d1', {'error': 'Sync item already processed. Ignored', 'error_code': 37, 'error_extra': {}, 'error_tag': 'ALREADY_PROCESSED', 'http_code': 400})"

What are the state messages you are interested in? Use a switch node to filter the state you need instead of get entities. Finally just use the message location not the full path.

{{payload.entity_id}}

use

{{entity_id}}

[{"id":"ae241fcf.558a78","type":"api-call-service","z":"f80b6c338afd5483","name":"Remind Me to Fix","server":"","version":3,"debugenabled":false,"service_domain":"todoist","service":"new_task","entityId":"","data":"{\"content\":\"Fix {{entity_id}} because it is {{state}} and the battery level is {{battery_level}}%\",\"project\":\"House\",\"labels\":\"Bedtime\",\"priority\":4,\"due_date_string\":\"in 2 hours\",\"due_date_lang\":\"en\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3090,"y":540,"wires":[["593dfacd.1531c4"]]},{"id":"582c7cda9801d621","type":"switch","z":"f80b6c338afd5483","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stuck","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":2850,"y":540,"wires":[["ae241fcf.558a78"]]}]

If you wanted to check every night @10 you could use get enties to find which vacuum is in what state. Using the event for a trigger will send the message when it happens. Using an inject node you can set a specific time.

[{"id":"5f897886.83f0f8","type":"ha-get-entities","z":"f80b6c338afd5483","name":"Which Vacuum","server":"6b1110b5.183a4","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"vacuum.","valueType":"str"},{"property":"state","logic":"does_not_include","value":"on, cleaning, returning, docked, paused, idle","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":2980,"y":720,"wires":[["ae241fcf.558a78"]]},{"id":"df9f6fb6.8b163","type":"inject","z":"f80b6c338afd5483","name":"check at a specific time","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":2730,"y":720,"wires":[["5f897886.83f0f8"]]},{"id":"ae241fcf.558a78","type":"api-call-service","z":"f80b6c338afd5483","name":"Remind Me to Fix","server":"6b1110b5.183a4","version":3,"debugenabled":false,"service_domain":"todoist","service":"new_task","entityId":"","data":"{\"content\":\"Fix {{entity_id}} because it is {{state}} and the battery level is {{battery_level}}%\",\"project\":\"House\",\"labels\":\"Bedtime\",\"priority\":4,\"due_date_string\":\"in 2 hours\",\"due_date_lang\":\"en\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":3210,"y":720,"wires":[[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]