Create function with multiple outputs send in a sequence


I am creating an Alarm Clock using the castv2 node.

A function node (advised by castv2 maker) is used to send a message in a special format to the Google Home device(s).
Each message contains a command to control a cast [MEDIA, TTS, STOP, PLAY, VOLUME, CLOSE etc.]

Now for the Alarm Clock I have to send the following commands VOLUME, MEDIA:

  • Set volume to 50
    (wait a few seconds to finish the VOLUME command)
  • Cast a Media file (internet radio stream)

In my current flow this are 2 function nodes which have to be send in the listed order and with a certain delay, because the commands overrule eachother on the casting device(s). Now I use a QUEUE node for sequencing the commands to the castv2 Node.

Since I use domoticz as software I use a Switch to trigger the Alarm Clock.
Switches in domoticz have timer options (which I use to set the Alarm at certain times)
Also here a function node is used to filter the IDX of the domoticz switch:
When IDX=243 && nvalue=1 (switch on), the 2 function nodes (castv2 commands) are activated.

This are 3 function nodes. Is there a more efficient way to combine the functions and queue node?
Because I also want to STOP and CLOSE the MEDIA (again 3 sepparate commands) when the Domoticz switch is set to off (nvalue=0)

[{"id":"6790ef2e.5739e","type":"function","z":"cf6cdf2b.f9a03","name":"If IDX is Radio Wekker Switch ","func":"if (msg.payload.idx == '243' && msg.payload.nvalue == '1') {\n        return msg;\n}\n","outputs":1,"noerr":0,"x":420,"y":200,"wires":[["37d57466.242c2c","a9e556fb.bda478"]]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.