Door automation with tts to sonos

Hi and thanks for the membership.
Im a total newbee at node-red.
I am trying to get my automations from within Home Assistant to Node Red
Seen alot of youtube an google but I am struggling with one..

Is there a kind soul here that can help me..

the automation is.
A magnet door/window sensor (a binary_sensor in HA) is open > A snapshot of a sonos unit is made > then a volume level made at 50% of that sonos unit and a google nest mini > then the TTS_cloud in da-DK with the message "Bryggersdøren er åben" with a repeat with 5 sec between on that sonos and google unit, until the door sensor is closed > and last a sonos restore.

it is way to complicated for a newbee as me..
i do not know how to write in Json

Hope anyone can help me out here..and maybe open my eyes a bid more for Node-Red

In Node-RED you work with flows and Nodes supporting various "stuff". I understand from your question you would like to "migrate" your HA solution into a Node-RED solution?

I would advice you as first thing to get familiar with Node-RED in general, there are many good guides and examples available in the documentation part. Next you should investigate if there are Nodes available supporting the "stuff" you want. For sure there are Nodes for "Delays", "Sonos", various sensors etc etc

Try then to build your first flow. Start to get the magnetic sensor working, add other Nodes you belive you need and share your flow here so people can help you reach the target. You have the "recipe" from HA that you can follow

Hi
I allready did most of my automations in node-red. but like I said Im having trouble with this one (see code in the buttom)

I think some of the automation has to be written in the "data" field in the nodes. And I do not speak Json

the ones in the picture I made myself by watching youtube and yes they may be simple but it took hours for me :woozy_face:

[{"id":"721f8a4.d7e7174","type":"api-call-service","z":"b2502674.296df8","name":"besked","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"tts","service":"cloud_say","entityId":"media_player.badevaerelse_2, media_player.spisestue1","data":"{\"entity_id\":\"media_player.spisestue1\",\"message\":\"bryggersdøren er åben\",\"language\":\"da-DK\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":940,"y":1120,"wires":[["d174397e.a6ad98"]]},{"id":"487d5e53.aeaff","type":"inject","z":"b2502674.296df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":1140,"wires":[["9cf8c480.b237d8"]]},{"id":"d733f64.68fea08","type":"server-state-changed","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.openclose_21","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":190,"y":1180,"wires":[["9cf8c480.b237d8"],["3107f0.44c8881"]]},{"id":"9cf8c480.b237d8","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"snapshot","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":1120,"wires":[["2184ca40.267cb6"]]},{"id":"2184ca40.267cb6","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.badevaerelse_2","data":"","dataType":"json","mergecontext":"50","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":730,"y":1120,"wires":[["721f8a4.d7e7174"]]},{"id":"3107f0.44c8881","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"restore","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":490,"y":1200,"wires":[[]]},{"id":"d174397e.a6ad98","type":"debug","z":"b2502674.296df8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1200,"y":1120,"wires":[]},{"id":"c215ffdf.5f364","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

So you are well on the way! That's good
Anyway, your flow cannot be imported without knowing what nodes you are using. Seems some kind of Sonos, that's all I can guess for the moment

What is working for you? Do you get the sensor signal into the flow? Can you send text messages to Sonos and hear thenm being played?

You can user debug nodes to verify if messages are sent/received but I guess you already know this?

The nodes im using is Home assistant nodes
Now I got this flow working, when I open the door the message comes in my sonos and google nest
all I need is the TTS to repeat with 5 sec delay between until the door is closed

[{"id":"487d5e53.aeaff","type":"inject","z":"b2502674.296df8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":1140,"wires":[["9cf8c480.b237d8"]]},{"id":"d733f64.68fea08","type":"server-state-changed","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.openclose_21","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":190,"y":1180,"wires":[["9cf8c480.b237d8"],["3107f0.44c8881"]]},{"id":"9cf8c480.b237d8","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"snapshot","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":460,"y":1120,"wires":[["2184ca40.267cb6"]]},{"id":"2184ca40.267cb6","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.spisestue1","data":"{\"entity_id\":\"media_player.spisestue1\",\"volume_level\":\"0.5\"}","dataType":"json","mergecontext":"50","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":730,"y":1120,"wires":[["efcba26d.d86d"]]},{"id":"3107f0.44c8881","type":"api-call-service","z":"b2502674.296df8","name":"","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"restore","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":490,"y":1200,"wires":[[]]},{"id":"d174397e.a6ad98","type":"debug","z":"b2502674.296df8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1230,"y":1120,"wires":[]},{"id":"efcba26d.d86d","type":"api-call-service","z":"b2502674.296df8","name":"message","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"tts","service":"cloud_say","entityId":"media_player.spisestue1, media_player.badevaerelse_2","data":"{\"entity_id\":\"media_player.spisestue1,media_player.badevaerelse_2\",\"message\":\"bryggersdøren er åben\",\"language\":\"da-DK\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":1120,"wires":[["d174397e.a6ad98"]]},{"id":"c215ffdf.5f364","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

So I give you a simple example how you can repeat depending on state

Instead of me installing HA stuff I use standard nodes to simulate :wink:

Try this flow, open/close simulates your door sensor, the trigger node is used to repeat the triggering of you SONOS spoken message until you close the door. For simulation I set it to 5 seconds instead of minutes

image

[{"id":"634983b0.2bf78c","type":"inject","z":"a5118cad.fbe2b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"open","payloadType":"str","x":190,"y":150,"wires":[["9653a7e6.270358"]]},{"id":"9546a6f9.4e1068","type":"inject","z":"a5118cad.fbe2b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"closed","payloadType":"str","x":190,"y":210,"wires":[["9653a7e6.270358"]]},{"id":"9653a7e6.270358","type":"trigger","z":"a5118cad.fbe2b","name":"","op1":"trigger Sonos spoken info ","op2":"","op1type":"str","op2type":"nul","duration":"-5","extend":false,"overrideDelay":false,"units":"s","reset":"closed","bytopic":"all","topic":"topic","outputs":1,"x":440,"y":180,"wires":[["d7be67e1.801448"]]},{"id":"d7be67e1.801448","type":"debug","z":"a5118cad.fbe2b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":180,"wires":[]}]

Think I give up..
I can get the tts to repeat.. but when the door is closed it just turn down the volume but the tts keeps on going.. its like the sonos snapshot and restore does not work.. the radio does not come back on when the door is closed.

[{"id":"d733f64.68fea08","type":"server-state-changed","z":"b2502674.296df8","name":"backdoor sensor","server":"c215ffdf.5f364","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.openclose_21","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"7","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"x":80,"y":1300,"wires":[["9cf8c480.b237d8"],["3107f0.44c8881"]]},{"id":"9cf8c480.b237d8","type":"api-call-service","z":"b2502674.296df8","name":"sonos snapshot","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"snapshot","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":220,"y":1220,"wires":[["2184ca40.267cb6"]]},{"id":"2184ca40.267cb6","type":"api-call-service","z":"b2502674.296df8","name":"volume set","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.spisestue1","data":"{\"entity_id\":\"media_player.spisestue1\",\"volume_level\":\"0.5\"}","dataType":"json","mergecontext":"50","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":410,"y":1200,"wires":[["efcba26d.d86d"]]},{"id":"3107f0.44c8881","type":"api-call-service","z":"b2502674.296df8","name":"sonos restore","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"restore","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":280,"y":1340,"wires":[["42c01bbe.2138b4"]]},{"id":"efcba26d.d86d","type":"api-call-service","z":"b2502674.296df8","name":"message","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"tts","service":"cloud_say","entityId":"media_player.spisestue1, media_player.badevaerelse_2","data":"{\"entity_id\":\"media_player.spisestue1,media_player.badevaerelse_2\",\"message\":\"bryggersdøren er åben\",\"language\":\"da-DK\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":580,"y":1180,"wires":[["b1176558.074fd8","7749ab7.a9c0154"]]},{"id":"b1176558.074fd8","type":"delay","z":"b2502674.296df8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":580,"y":1140,"wires":[["efcba26d.d86d"]]},{"id":"7749ab7.a9c0154","type":"debug","z":"b2502674.296df8","name":"åben","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":1180,"wires":[]},{"id":"42c01bbe.2138b4","type":"debug","z":"b2502674.296df8","name":"lukket","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":1340,"wires":[]},{"id":"c215ffdf.5f364","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

No, no, don't give up yet!
When I look at your flow, I see you did not follow my advice

  1. Instead of a Trigger node, you have used a Delay node, that will not work the same
  2. When the door closes you do not send a message to the Trigger node to stop the triggering

I will try to "modify your flow a bit, just hang on

You can try this flow. When the door opens, the sonos snapchat stuff is triggered and the message is sent played (I understood this already works). Then the trigger node gets triggered, waits 5s and then restarts the sonos snapshot by sending the command "on" (maybe you have to change this). The message is repeated, the trigger node triggered again, waiting 5s,,,,etc until the door is closed

When the door is closed, the trigger node is resetted and the message to sonos stopped

(The "Change" node can actually be eliminated if you configure the Trigger node to be resetted on the actual payload received when the door closes)

[{"id":"7749ab7.a9c0154","type":"debug","z":"a5118cad.fbe2b","name":"åben","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":430,"wires":[]},{"id":"42c01bbe.2138b4","type":"debug","z":"a5118cad.fbe2b","name":"lukket","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":560,"wires":[]},{"id":"d733f64.68fea08","type":"server-state-changed","z":"a5118cad.fbe2b","name":"backdoor sensor","server":"c215ffdf.5f364","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.openclose_21","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":"7","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":true,"x":150,"y":450,"wires":[["9cf8c480.b237d8"],["3107f0.44c8881","cc5b3e50.d026b"]]},{"id":"9cf8c480.b237d8","type":"api-call-service","z":"a5118cad.fbe2b","name":"sonos snapshot","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"snapshot","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":360,"wires":[["2184ca40.267cb6"]]},{"id":"2184ca40.267cb6","type":"api-call-service","z":"a5118cad.fbe2b","name":"volume set","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.spisestue1","data":"{\"entity_id\":\"media_player.spisestue1\",\"volume_level\":\"0.5\"}","dataType":"json","mergecontext":"50","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":430,"wires":[["efcba26d.d86d"]]},{"id":"3107f0.44c8881","type":"api-call-service","z":"a5118cad.fbe2b","name":"sonos restore","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"restore","entityId":"media_player.spisestue1","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":450,"y":560,"wires":[["42c01bbe.2138b4"]]},{"id":"efcba26d.d86d","type":"api-call-service","z":"a5118cad.fbe2b","name":"message","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"tts","service":"cloud_say","entityId":"media_player.spisestue1, media_player.badevaerelse_2","data":"{\"entity_id\":\"media_player.spisestue1,media_player.badevaerelse_2\",\"message\":\"bryggersdøren er åben\",\"language\":\"da-DK\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":810,"y":430,"wires":[["7749ab7.a9c0154","b92fa8f5.16ee38"]]},{"id":"b92fa8f5.16ee38","type":"trigger","z":"a5118cad.fbe2b","name":"","op1":"","op2":"on","op1type":"nul","op2type":"str","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":450,"y":270,"wires":[["9cf8c480.b237d8"]]},{"id":"cc5b3e50.d026b","type":"change","z":"a5118cad.fbe2b","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":210,"wires":[["b92fa8f5.16ee38"]]},{"id":"c215ffdf.5f364","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

If you really want to get rid of HA, you can send directly to SONOS from Node-RED. I have tried to start and stop a mp3 file in my SONOS using the same principle as above and it works fine. You could for instance make a pre-recorded spoken message and play that

thanks but sadly no.. it does not make a restore on sonos..it plays the tts and repeat it, but keeps sonos volume at 50% and thats it. if i then just hit play on the sonos unit it plays my tts ones at 50%

I understand from what you say that the message from door closed does not stop the sonos playing? Then is the command for that wrong or what? Did you see the trigger node getiing triggered when the door opened? And did it reset when you closed the door?

Edit: If there is problem with sonos restore, obviously you are calling this service in HA, then that has first to be verified if it works as expected when used in HA. If it doesn't, no chance it will when calling the same from NR

The automation works just fine in HA
The Way You and I do in Node-Red is like the sonos snapshot is made too late.. and the debug node shows no activity on the restore node
I tryed to put a small delay between the snapshot and tts but same result.

It makes the tts right and it repeating it with 5s delay as I was aiming after.. but I just doent Seem to get it to do the snapshot and restore.
I doent know - maybe its just not posible the Way I want it in node-red🤷🏼‍♂️

Its not my plan to move all away from HA. More like Node-Red to be a co player. And I was hopeing to get to know Node-Red some more.
But this one does not make it easy😳

Yeah, I don't know, maybe is a timing issue. Or could it be an access right problem? I would first try to identify where the problem is. Like testing a setup like below, to give the service in HA time enough to execute the reqeusted functions. Is there any debug info available in HA, a logfile or so, where you can check that the request has arrived correctly?

Also if this fails, I would contact the author of the nodes at github, submit a new issue here:

1 Like

Anyways, thanks for trying, I do apreciate the effort😊

1 Like

Well well well, I think i found it :smiley: not the prettiest workarround but it works :muscle:

[{"id":"9151ca7.cd79e38","type":"trigger","z":"b2502674.296df8","name":"","op1":"trigger Sonos spoken info ","op2":"","op1type":"str","op2type":"nul","duration":"-5","extend":false,"overrideDelay":false,"units":"s","reset":"off","bytopic":"all","topic":"topic","outputs":1,"x":340,"y":2060,"wires":[["e1258e34.dc422"]]},{"id":"678bce7f.e89eb","type":"switch","z":"b2502674.296df8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":110,"y":2120,"wires":[["4b52dc29.0f03c4"],["b06742b7.dfb3","9151ca7.cd79e38"],["14933bf0.f9f884"]]},{"id":"60e3a22e.32f56c","type":"api-call-service","z":"b2502674.296df8","name":"sonos snapshot","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"snapshot","entityId":"media_player.kontor_klinik","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":2180,"wires":[["e9cd4da4.befc9"]]},{"id":"14933bf0.f9f884","type":"trigger","z":"b2502674.296df8","name":"trigger","op1":"trigger Sonos snapshot","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"off","bytopic":"all","topic":"payload","outputs":1,"x":290,"y":2180,"wires":[["60e3a22e.32f56c"]]},{"id":"b06742b7.dfb3","type":"api-call-service","z":"b2502674.296df8","name":"sonos restore","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"sonos","service":"restore","entityId":"media_player.kontor_klinik","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":300,"y":2120,"wires":[["bb184d66.372d9"]]},{"id":"bb184d66.372d9","type":"debug","z":"b2502674.296df8","name":"lukket","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":2120,"wires":[]},{"id":"8966bc81.3d6c5","type":"debug","z":"b2502674.296df8","name":"åben","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":850,"y":2040,"wires":[]},{"id":"e1258e34.dc422","type":"api-call-service","z":"b2502674.296df8","name":"volume set","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.kontor_klinik, media_player.badevaerelse_2","data":"{\"volume_level\":\"0.5\"}","dataType":"json","mergecontext":"50","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":550,"y":2060,"wires":[["4392c658.5fef28"]]},{"id":"4392c658.5fef28","type":"api-call-service","z":"b2502674.296df8","name":"message","server":"c215ffdf.5f364","version":1,"debugenabled":false,"service_domain":"tts","service":"cloud_say","entityId":"media_player.kontor_klinik, media_player.badevaerelse_2","data":"{\"message\":\"bryggersdøren er åben\",\"language\":\"da-DK\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":700,"y":2040,"wires":[["8966bc81.3d6c5"]]},{"id":"4b52dc29.0f03c4","type":"delay","z":"b2502674.296df8","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1980,"wires":[["9151ca7.cd79e38"]]},{"id":"2b71259b.49ad7a","type":"inject","z":"b2502674.296df8","name":"open","props":[{"p":"payload"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":90,"y":2000,"wires":[["678bce7f.e89eb"]]},{"id":"2ae8a8da.24c158","type":"inject","z":"b2502674.296df8","name":"closed","props":[{"p":"payload"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"off","payloadType":"str","x":110,"y":2200,"wires":[["678bce7f.e89eb"]]},{"id":"e9cd4da4.befc9","type":"debug","z":"b2502674.296df8","name":"snapshot","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":2180,"wires":[]},{"id":"c215ffdf.5f364","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Is fine I think, no harm

I just thought about another possible way; you could eventually set up automation rules inisde HA for snapshot and restore and just trigger them via MQTT from NR (if you have worked with MQTT)

But if the solution you have now works fine, great!