Struggling with RM 5.0 (thought this would be easy)

I'm really struggling here.
Trying to set up a fairly simple routine - I use a wake up where at 0600, I ramp up 2 lamps to 100% over 15 mins., then turn them off at sunset+60 minutes. Easy so far.

Now I want to add a virtual switch, accessible via Alexa, named "Sleep in". so, I want to have the rule do this: IF time is 0600 AND "sleep in" is off, then, (ramp up lamps...) elseif "sleep in" is ON, pause rule, wait for [lamp #1] switch 1 on - resume rule, AND turn off "sleep in"

Cannot figure out how to do this in the RM processes, I can envision it in code, to my best ability, but raw code editing is something I have not found any information on. I even thought if I wrote a broken rule in RM5, maybe I could edit it better as raw code?

I have found many posts where others struggle with editing RM5 apps, especially when faulty logic is accidentally inserted then cannot be easily edited - most have to resort to deleting their work and starting over.

Help is welcome!!

1 Like

Added thought: maybe it would be easier to use a separate app which (if possible) would stop the "morning wake up" RM5 app if "sleep in" is on, and trigger a make-up app to complete the steps?

1 Like

Here's how to do this in Rule 5.1:

Add a Required Expression that is simply 'sleep in' is off. If 'sleep in' is on the rule won't run at 6:00 AM.

Add a second rule with a Required Expression that 'sleep in' is on. This rule will only run when you have turned on 'sleep in'. It's trigger should be lamp #1 turns on, and it has two actions: turn off 'sleep in', and run the actions of the first rule.

Net outcome is if you haven't turned on 'sleep in', it works as usual. If you have turned 'sleep in' on, it won't do anything until lamp #1 turns on, and then it will run as if it were 6:00.

First rule:

Second rule:

6 Likes

Thanks Bruce @bravenel , I'll give this a try tomorrow - I'm spent tonight, but the Lord is good; He will give me rest!! :sleeping:

On a side note, is there a place to edit raw code from these apps? I used to do a lot of BACnet code in OrcaView a while back, as well as some SCADA stuff, might do better in that environment as I progress down this HA road - its a different world than the Insteon realm I cut my teeth on!

Technically yes. You can import/export the RM code. The files are text which you could edit in notepad. Not very practical though.

Just create the 1st rule shown above in RM which is one required expression, one trigger, and one action. Export it and open the file in notepad, you will see what I mean

Another option is to create your own apps in groovy, Their are many tutorials on that but if you find the RM editor daunting then that is probably not something you will want to mess with.

Lastly there is webcore. Some people find its interface more code like, so perhaps that would be something to check into.

I personally prefer the RM editor. I had quite a few webcore pistons when I came over from ST, but ended up converting most to RM.

Also look at the basic automations apps found in add built in apps they step you through automation setups and can probably handle most things you will need.

2 Likes

To add to the above, rule actions aren't really "code" per se--the UI just displays a summary of the actions you've created in a sort of pseudo-code format, but this is for display only, likely because Bruce figured it was the most concise way to summarize the options you've selected. This text is not interpreted or compiled--it's just there so we know what's going on, a human-friendly view of the settings you've created. Like other apps, Rule Machine works by looking at your settings (and other data structures, etc. used by the app) do actually do what it's configured to do. This one just happens to be powerful beast. :smiley:

Editing the app export as suggested hinted at above is not a supported method of rule editing, nor is it supported for any app. Doing so would require familiarity with (at least) the app's internal data structures. I would not recommend this option, as you risk breaking the app and perhaps your entire hub database by doing so.

So: basically, no, the UI you see is the only way to create Rule Machine rules. Certain editing tasks can be a bit "click heavy," but that's the way the current UI works. I'm not if they've publicly teased anything about future possible changes yet, but you may be happy with some of them if you stick around. :slight_smile:

2 Likes

I Absolutely did not suggest he do that.

1 Like

Apologies for reading into that too much, then. I have edited my post to reflect that the possibility was merely alluded to.

In any case, seems we all agree that it's a bad idea. :smiley:

1 Like

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