i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

Payload media example #18

Closed Anjerlaan closed 4 years ago

Anjerlaan commented 4 years ago

Hi,

Node-red newbie here Does anyone has an example flow of what nodes to use to get the output of the Media example? With contrib-cast I use the change node, but I have no idea how to this with the shown examples

i8beef commented 4 years ago

You might be able to do that still, but I would personally recommend always using a function node and just building a new msg object from scratch.

return {
    payload: {
        type: "TTS",
        text: "text to speech example"
    }
};

Im not sure what you mean by "get the output" but if you want to see what its returning, just pop a debug node on the end.

Anjerlaan commented 4 years ago

Well, I tried it with a change node but the debug node never shows the result as the examples...so just add a funtion node and typ between the return brackets the feed according tot the format of the examples?

One other thing, can the castv2 node remove the cast from my Mini with the CLOSE type?

i8beef commented 4 years ago

Sounds more like you have an error. It is a good idea to always have a catch node dumping into a debug node on every flow so that you see errors when they happen. That'll spit out an actual error you could deal with then.

Yes, CLOSE should close the running DefaultMediaReceiver on the mini. Otherwise, once whatever is playing is finished, it will close itself after some timeout.

Anjerlaan commented 4 years ago

Sounds more like you have an error. It is a good idea to always have a catch node dumping into a debug node on every flow so that you see errors when they happen. That'll spit out an actual error you could deal with then.

No I think I just build up the incoming msg in a wrong way in a change node, because this is working when I am using the node-red-contrib-cast node. I will try the function node the moment i have time to test, thanx for the info sofar.

Is it also possible to set the type:VOLUME, when a type:MEDIA is send in one msg or are those 2 different messages? Let’s say I want to create a doorbell with a local mp3 file, and when this msg is triggered the volume is temporarily set to a certain value, when the msg is finished the volume is set back to original level

Anjerlaan commented 4 years ago

Working, thanx. I have created for each type a function and use a “queue” node to send the functions in a sequence to goggle home. Or is there a more effent way?

Anjerlaan commented 4 years ago

Is there a way to get rid of the annoying notification sound the Google home (mini) plays before a castv2 or cast message is played? It looks like it only happens when the Google home device is set to a kind off “idle” state, when there is no activity. This time is quite short I noticed. I checked this when sending an empty payload to get the google home status. First time injecting the empty payload generates the sound...the next series of injections don’t until it is idle again.

i8beef commented 4 years ago
  1. You cannot send multiple commands at one time, no.
  2. Not really a better way, no. This is meant to provide a communication channel, not implement logic. You'll have to do that in node-red itself.
  3. I don't think there's a way around that. I think Homes play that before its about to play a casted audio / video media object, so I don't think there's a way to avoid that. It likely happens by default when an app is launched, in this case, the DefaultMediaReceiver handler.