RM question - multiple actions

Ok, I am having a senior moment...

Now that we have chromecast integration, I would like to do the following. Anyone have advice on how that would be done in RM?

When front door contact goes OPEN

On Chromecast device specified, do three commands:

  1. setVolume to 50
  2. speak "Front Door Opened"
  3. stop

I need the stop, otherwise my Google Hub stays on the Chromecast screen instead of going back to time/pictures.

I could certainly write an app for this, but it seems like RM should be able to handle this as well (and I'm trying to get better using it instead of writing a custom app for everything).

You have to create a custom command for the set Volume and the Stop as these are not default rule machine commands. Once you have the custom commands set up, you are going to have to do some finagling. The order of execution is working against you in this case. Custom commands execute after the speak command. So, you would have to do a separate command with a delay of a second for the speak and then another for the stop.

However, your life would be much simplified if you took out the volume and the Stop. My Home Hub returns to screensaver without issuing the stop command, so I don't think you need that one. And as far as the set Volume, typically I won't do that simply because whoever is in the room might have it louder or quieter depending on what else is going on.

As far as the speak, it's in the same panel in RM as the notification. You enter the message, toggle the speak message and select the speaker.

How long does it take for your hub to back to picture/screensaver? I ask, because I setup the rule to just do the speak first. Worked fine, but after a minute or two my Google Hub was still at the chromecast screen.

EDIT: It takes 5 minutes for the Hub screen to go from the Chromecast icon display back to the normal Google Home Hub display after sending a message. Kind of long, but maybe I can live with that.

Thanks for the thoughts!

If you do the Stop as a custom command, it will happen after the Speak command is given (just by virtue of the order of doing things in RM). It was the Set Volume that was going to make this more complex. You can put both the Speak and the Stop in the same RM action section, and it should work.

I tested this a minute ago, and can confirm that the Speak and custom Stop command action being in the same RM rule works as expected.

I think I can live without setVolume.

Thank you both for the ideas/comments.

1 Like

@bravenel RM doesn't wait for the speak command to finish before sending the Stop though. So, when I tried this, the announcement was cut off before it completed. So, wouldn't you have to have a separate action invoked by the rule that had a delayed custom command of stop? I tested them together and it doesn't work. My home hub only got about 3 words out before stopping.

Wouldn't it be easier if the device itself issues the stop command after the speaker was done with the announcement? It can read the device's status going to Idle after the message is played. That would be a perfect time to issue the Stop command. If we wanted to do that through rule machine, we'd have to use WATO with a whole bunch of virtual switches. It would be a mess but we could do it.

I know it's against Hubitat's 4th commandment or something but I actually already implemented a webCoRE piston that did exactly that with the Home Hub's status changing to Idle. Worked perfectly. I'd like to make another +1 for custom device attribute access in RM. It would make some of this stuff a lot easier.

EDIT: Actually, I just went into add a WATO for this, and there is no virtual device necessary. You can access the stop command from directly within WATO. So, I have this set up now and it also seems to be working. Thank you @bangali!! WATO to the rescue again! For anyone interested, here's what I have setup in WATO to get the display to turn "off" after a spoken command.

1 Like

+1 on the driver sending stop command after it's done, and I'd like to add that it should also check to make sure the file is done playing before it plays another one. I've had several situations where announcements get cut off by another.

I don't know how you would prevent the multiple messages casting over one another. Part of the functionality of the speaker is that you can cast over the previous device. That's how you get over the 5 min timeout if you want to broadcast from something else. But if the driver could store the second message until the idle status is back, that would be ideal. But I think the Stop, at least for GH Hub, would be ideal.

Also, I'm curious as to why the GH mini's and Insignia speakers show up as video. I tried switching them to the Audio driver but everything stopped working so I switched it back.

I guess that's another plus for the Google Broadcast function. It seems to queue the commands so they don't get cut each other off. Too bad Google has decided that we need the somewhat obnoxious prefix to TTS broadcasts.:neutral_face:

And that the functionality just dropped off for Insignia Speakers. Been seeing a whole bunch of other people experiencing that problem.

Is there any way we could get a "speak with volume" command in rule machine instead of just speak? Also, is there any way we could get the option to speak and resume or stop? These quality of life commands would decrease the amount of additional rules we would need just to setup the real or important rules.

Here are my use cases:

  • At night I set the volume low on several of the announce speakers because they play sleep music and/or white noise. If a leak is detected I speak over the speakers that a leak was detected but if the leak happens at night the volume is low and maybe nobody hears the leak. This is where I would want a "speak with volume" so regardless of the mode or volume important alerts can be heard. I can see this use case for smoke or carbon monoxide warnings as well. In this case I would also want the music to stop.
  • For other scenarios where I announce on the speakers (like when the laundry is done) I wouldn't care what the volume is but I would absolutely want to resume the previous music (if any) that was playing.

Thanks in advance!

There is volume available. Select "music device" instead of "speech device".

The other aspect of your request, to be able to Stop or Resume, can be easily accomplished by a small change in Rule Machine, that I will make. As it is now, player commands are done before notifications. All I have to do is reverse that relative order, and then you could in the same rule play the speech notification and then issue a Stop or Resume command.

Dang, I think I missed that I could use music devices because my speaker groups aren't showing in the music device list for that rule. Should I open another thread/support ticket for that or is that a known issue?

Also, for the other aspect of the request, thank you. I can't think of any use cases where reversing the order would break anything but maybe I am missing something. I would feel so guilty if it ends up breaking somebody else's use case. :frowning:

What driver are you using for your speech device?

The order thing is not going to break anything. If anything, it opens up the possibility you are interested in while currently it has no use.

The group of speakers is set to the "Chromecast Audio" driver. Also, after looking at it today I noticed that one of my speaker groups is showing and two are not. All three speaker groups are set to "Chromecast Audio" as the driver.

In addition, one of my Nvidia Shields is showing and one is not. All of my display devices (Lenovo and Google) are showing. None of my Homes or Home Minis are showing. However, all of these devices show up under speech devices and work correctly as speech devices. They are only missing from music devices.

Would it be possible for actions in a rule to have different delays? This would be really useful, as at the moment I have to setup multiple almost identical rules, each with a different delay.

You can trigger an action from a rule that has it's own delay, instead of writing the exact same rule.