Call multiple services in sequence

I want to make an automation, that when the doorbell rings, the following should happen:

  1. Save Sonos state
  2. Set comfortable volume
  3. Play doorbell audio sound
  4. Restore Sonos state

However, running this in sequence doesn’t seem to work. Individually it works, but I need all nodes to wait for the last one to finish, but it now just runs through all in under half a second, so the audio never plays.

How do I connect these nodes so they will work together?

you can use delay node from function category to set, for example 250ms delays and see whether it works for you. Once you set them up, just adjust the delay until you are happy with it.

Otherwise, you can use status node to listen for events from the nodes that you are working with. If they are publish status events once they are done, you can act based on those status messages.

Hello there I have somethings similar that I need to do.

They are all using the same Entity but not the same call service.
I was wondering if there is a way in the DATA to make all those call service into one.
Also can I had those delay as well in the service? What is the exact syntax for delay?

Thanks!

Not sure if you achieve it yet but I was able to do something similar with function

[{"id":"6c6f8f3b5cb8c76b","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"fd1e7c0a2369b95c","type":"api-call-service","z":"6c6f8f3b5cb8c76b","name":"","server":"32b5eb9d.1cbe84","version":5,"debugenabled":false,"domain":"{{payload.domain}}","service":"{{payload.service}}","areaId":[],"deviceId":[],"entityId":["{{payload.target.entity_id}}"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1070,"y":560,"wires":[[]]},{"id":"1e1ad248796bf6eb","type":"function","z":"6c6f8f3b5cb8c76b","name":"function 1","func":"\nvar velocidad = {payload:\n    {\n        \"domain\": \"climate\",\n        \"service\": \"set_fan_mode\",\n        \"target\": {\n            \"entity_id\": [\n                \"climate.c67428b9\"\n            ]\n        },\n        \"data\": {\n            \"fan_mode\": \"auto\"\n        }\n    }\n}\nnode.send(velocidad);\nvar temperatura = {\n    payload:\n    {\n        \"domain\": \"climate\",\n        \"service\": \"set_temperature\",\n        \"target\": {\n            \"entity_id\": [\n                \"climate.c67428b9\"\n            ]\n        },\n        \"data\": {\n            \"temperature\": 20\n        }\n    }\n}\nnode.send(temperatura);\nvar preset = {\n    payload:\n    {\n        \"domain\": \"climate\",\n        \"service\": \"set_preset_mode\",\n        \"target\": {\n            \"entity_id\": [\n                \"climate.c67428b9\"\n            ]\n        },\n        \"data\": {\n            \"preset_mode\": \"boost\"\n        }\n    }\n}\nnode.send(preset);\nvar swing = {\n    payload:\n    {\n        \"domain\": \"climate\",\n        \"service\": \"set_swing_mode\",\n        \"target\": {\n            \"entity_id\": [\n                \"climate.c67428b9\"\n            ]\n        },\n        \"data\": {\n            \"swing_mode\": \"vertical\"\n        }\n    }\n}\nnode.send(swing);\nreturn;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":560,"wires":[["fd1e7c0a2369b95c"]]},{"id":"320ca178f6b878dc","type":"inject","z":"6c6f8f3b5cb8c76b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":640,"y":560,"wires":[["1e1ad248796bf6eb"]]},{"id":"32b5eb9d.1cbe84","type":"server","name":"Home Assistant","version":4,"addon":true,"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":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]


image