i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

Volume control, speed control and group casting #16

Closed djmvt closed 4 years ago

djmvt commented 4 years ago

2 problems I've been running in to:

1) Is it possible to send a group cast (to a speakergroup)? the difference is the port the cast has to send to. (default is 8009 but group ports cannot be defined)

2) I cannot seem to set the volume in a cast. < msg = { host: "192.168.2.121", payload:{ type: "TTS", text: "De deurbel gaat, er staat iemand aan de deur", speed: 3, language: "NL", volume: 50, metadata: { title: "De deurbel gaat!", },

         }

}

return msg;

With this code the message gets sent but volume goes up to 100% in stead of 50 as put in the code. Also the speed setting doesn't seem to do anything.

So to let it work now I have to send 4 cast messages per google device: 1 set initial volume 2 send message 3 set new volume (defaull lower volume) 4 send STOP to stop casting to devices.

Any idea?

I'm totally new to this so could be I'm approaching this all wrong.

thanks.

i8beef commented 4 years ago
  1. No, single target. You can fake it by just sending the same message to multiple targets with a node per target. Thats how I do some notifications.
  2. That's correct, you can't set volume in a single call. That requires multiple commands. The other cast node trying to allow that was part of the reason it was unstable if I remember right, so I instead expose a more direct API representation and require the caller to coordinate.
  3. Im not sure on the speed thing... thats a goolge tts setting which I just pass through. Looking at the URL it passes through, it looks like I could only get speeds between 0 and 1 to work though.
djmvt commented 4 years ago

Ah that clears some stuff up I guess. Only problem with single target is: if you pair 2 Google devices as stereo pair then they are no longer reachable as a single target. The other points are absolutely fine, I've thought so already speed was a tts issue, maybe it is not even supported in all languages, don't know really. But not that big of a problem.

But at least now I know I'm thinking in the right direction of sending multiple cast messages to get the actions done as I want to. Now to find a way to use the stereo pair as a target.

And you are right, I did have some issues with the other node, node-red did get unstable after srarting multiple flows with that.

djmvt commented 4 years ago

Have been experimenting with both cast and castv2 and you are right: cast is pretty unstable, messages don't get to all devices, volume changes work about 50% of the time.

Since we have 1 hub, 2 mini's and a home pair here I've decided for now to not use the home pair for casting as it is simply not recognised. but at least the other devices shout out when there's someone at the door ;)

Thanks for your help so far!

i8beef commented 4 years ago

Yeah not sure on how the pairing works... definitely not supported here right now, but I accept PR's if you figure out a good way to add it...

i8beef commented 4 years ago

So if I understand the grouping correctly, it's just one of the devices in the group becomes the "master" and creates a new listener on a different port... I will add an option to allow you to specify a different port than the default to communicate with... but FINDING the right port seems to not be straightforward without mDNS discovery... I did play with mDNS discovery to see what is provided, but I couldn't immediately figure out how to get the port from the mDNS responses that I saw with my test group.

So at least if you can find the port, you might be able to just set it to that port and make group casting work...