Rule machine help

Hey gang!

I have to admit I have not spent much time with Rule Machine as for what Ive needed, basic rules have filled my needs.

I am trying to create a new rule and I fear that Rule Machine is the only way to accomplish it and I feel lost.

Basically I am looking for the following:

  1. Motion detected on Ring doorbell
  2. Check to see if Sony TV is on
  3. If yes, switch TV input to HDMI 2
  4. If no, leave the TV off.

Seems like a simple enough setup and I do have the Sony Rest driver installed and my TV shows up as a device.

My issue is that no matter what I try to select as my "action" I cant find anything that would switch the TV input. I assume since that command is available in the Sony driver that it would be available SOMEWHERE in setting up the automation.

Any advice?

I'm not familiar with the sony driver but did you try run custom action?

3 Likes

I dont see that as a choice in the action dialog?

It's ~2/3 down -- the "Set variable, Mode or File, Run Csutom Action"

RM documentation may be helpful to use as a reference:

4 Likes

Assuming it is the same Sony Rest driver that I use, you just need to select a simple conditional action. Have your TV being on as the first part, and then selecting a custom action.

Trigger
Motion on Ring Doorbell

Action
If Sony TV Switch is on, Run Custom Action - Switch - Sony TV - InputSelect - String - HDMI2

The rule:

The custom action:

5 Likes

I think I'm close @JB10 but my condition is flagged as UNUSED? Would that go away once I got the IF part figured out?

I am familiar with IF/THEN programing for the most part but these "conditions" and just the general wording of stuff seem unnecessarily confusing? At least to this old brain!

Any other insight would be appreciated as I feel like I am almost there.

Thanks also @hydro311 - Would have bit me in the ■■■ if it was any more obvious!

Also dont I want the condition to be Sony TV(off) is on TRUE?

I only want the custom action to run if I am actively watching TV.

BTW - What is the (off) in parenthesis? Is that just showing the current state of the device?

That sounds correct. But although you've created a condition, you haven't actually used it anywhere in the rule yet -- that's why it says "unused".

That condition could be used as a conditional trigger or in a conditional If-Then action statement.

ETA -- the reason for that condition "corral" is that some folks like to create their condirtions ahead of time as part of their rule-building process -- then once you get in the the action-related steps, you just use the conditions you already built. Alternatively, you can build conditions as you go -- either way, they end up in that corral.

And that's useful because if you later edit the rule, you just need to modify the condition(s) from w/in the corral -- you don't have to dig into the guts of the rule itself to modify them. In longer/complex rules or in rules where the same condition is used in multiple places, that can be a godsend.

Correct - that shows the current state. And that's why your condition shows False at the moment -- the condition isn't currently true.

2 Likes

So I think I got it.

Will try it out tonight.

You guys are the best! Thank you so much for taking the time to walk me through this!

3 Likes

Hi Hardax,

See the screenshot below [you can enlarge it by clicking on it]. I am also including the general outline of steps. The steps may appear to be out of step order but are listed in desired order of operation for this use case. This is an example where I have a security rule run when motion is detected at various end-points within and around the perimeter of the residence.

Step 1 - In my case various sensors are tripped [Doors, Sheds, Motion, Decks, Gates, Attic, etc.] This would be equivalent to your ring doorbell detecting motion. This would be defined as a trigger event to start the rule running.

Step 4 - If the TV is off write an exit rule statement. You don't want to do anything.

Step 2 - TV must already be on or the scrip would have exited above. So don't do any checking here. No need to this step at all. Caveat here, no power savings, sleep, mode, or other settings that need to be considered here. If so this could be handled by power sensing equipment. I do this with wash & dryer. Very inexpensive and easy.

Step 3 - As you can see, Conditions naturally fall through here, are met, and the actions are taken. In my case the main part that is comparable to you is that I send commands to the TV via a Broadlink Bridge that begin with sendSaveCode.......Power On, HDMI2......HDMI1, etc. You would need to replaced the BroadLink commands with those you use to manipulate your TV.

I hope this gives you some additional insight of the command flow and sections to use within HE.

  • Don

Wow @user837 thank you so much for the additional insight. I’m learning a lot.

I go the rule working when I hit the test button the input changes as expected and even more importantly, it does NOT turn the TV on if I’m not watching it.

Only issue I’m having now is with the reporting of the Ring doorbell motion alert. Hubitat just isn’t picking it up or not picking it up fast enough to make this rule useful.

I may have to look into getting some other motion detection devise that works with Hubitat natively?

What device is on HDMI 2? Can you also post the logs of the rule? The latter would give us an idea on how long it takes to run.

An Apple TV is on the HDMI port. When running the actions, the switch over is instant.

I’m pretty certain it’s the Ring polling as there is a section right in the Ring app dedicated to it. They suggest using IFTTT to report the motion detection which now costs money or set the app polling at around every 15 seconds which is way too long for this to make what I’m trying to do.

I was in a similar position when we bought our home (Sony TV and Apple TV with a Ring Doorbell). I ended up putting in a wired Nest Doorbell since we use both Google and Apple Home along with a Starling Box. Since Apple TV is our primary box, Starling allows for a local camera stream rather than going to Google’s cloud. It works really well.

If you have Alexa, you could use a virtual switch turning on as trigger in Hubitat; otherwise, you might need something to complement the Ring Doorbell (like other motion sensors).

Yep. The Alexa virtual switch idea occurred to me earlier this evening and I’m happy to report did the trick!

Before that I was planning on just mounting an unused Samsung motion sensor I have laying around near my front door and use that as my trigger which I may still do if the virtual switch solution ends up being unreliable.

2 Likes

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