Assistance with NOT *changed* trigger

I'm moving my rules over from Reactor for Vera into RM and I'm still learning as I go. So thank you in advance for all my questions. I tried searching for this, but didn't see anything.

In Reactor, I have a trigger that if my Inside Temp has NOT changed for 3 hours, then power off my Netatmo device, wait 10 seconds, and power it back on. (Sometimes the base unit needs a kick in the pants.) I thought I could do this with an If rule Then Condition, but I don't have the changed option like I do with the trigger. And there isn't a NOT changed options with the trigger. I'm sure this is due to my learning curve, but...

  1. Is there a way to do a NOT trigger?
  2. Am I correct that I could do this with an If/Then rule? And could I get some help to get me started?

Current Reactor rule:

A trigger relies on an event happening; an arrival, moment in time, change of state, etc. You could probably set up a rule to check a state of a device periodically if that helps. I’m sure that others will chime in that have experience with your particular device.

1 Like

Triggers are events, a moment in time, and as mentioned above, they thus rely on something happening. A "rule" in the sense of IF (rule) THEN is a condition or combination of them--a state you can check at a specific time (when that action is reached). So, "changed" doesn't make sense there (nor does "AND" make sense in triggers, sort of the opposite of this and a question that also comes up sometimes).

Do you just want to do something if the sensor hasn't reported a new temperature in 3 hours? If so, trigger on "temperature changed," then make your first action a "Wait for event: elapsed time" for 3 hours. Triggers cancel waits, so you'll only get to the next action if it's been that long since the temperature changed. In this next action (and as many after a you need), you can then do what you want to do in this case.

3 Likes

Correct. So based on your feedback I built the following rule. Am I correct in reading it as...

  • When the temp changes, start this rule, but wait 3 hours.
  • When the 3 hours have been met, turn off the module the Netatmo is plugged into.
  • Wait another 15 seconds and then turn it back on.
  • However if the temp has changed during the 3 hour wait, then the rule is canceled and restarted with a new 3 hour wait.

image

That's all true--but do note that if the temperature changes during that 15-second wait it will also be canceled, and the Rule actions will start over. If that is a problem, there are a couple ways I can think of to avoid it (I can expand on this, but either a predicate rule plus some condition you can set or check, possibly Private Boolean; or conditional actions and a delay instead of a wait, with delays needing to be explicitly canceled).

1 Like

Thank you very much!

I ended up removing that restart piece and creating a second rule that if the Switch goes off, turn it back on after a 15 second delay. I also added a Periodic schedule to this second rule to turn the switch back on. In the event of a power outage, the outlet module does not return to its prior state. So at most, the switch will be off 4 minutes after power has been restored.

What do you recommend in the way of notifications? I see there is a built in notification app. I've been using Telegram for Reactor, but open to something better, or native. That's the last piece of this rule migration. Then I have 5 or 6 other rules. All should be easy except for my door lock. But I've been mentally planning that one for a few days now.

Netatmo Updates:
image

Netatmo Restarts:
image

That should work! (At least if you don't care how long it's off for, just that it's at least a few seconds. If you're just aiming to effectively restart it, it sounds like that should do.)

For notifications, one option is the Hubitat mobile app (assuming you're asking about how to actually get them, and not what to do on the hub side to cause them to get sent--that part is easy). It's completely optional (this is sometimes shocking to people who come from app-first platforms, but last time I used Vera, it was similar and I could do everything I needed from the web interface, just like Hubitat). But one feature it does give you is the ability to receive notifications. It will create a device on your hub after you log into the app, then you can use that device in any app that wants you to select a "notification device"--somewhere to send the notifications to. It's not the only option; lots of people like Pushover (and it has some features the app doesn't, like priority notifications), but it is free and easy.

On the hub side to get the notifications, the Notifications app is one way. Rule Machine also has an action you can use to send a notification, and if you want to do it in response to something you're doing in the Rule anyway, that's probably what I'd do. (And in general, several apps have the ability to send notifications; you just need something to send them to, which the device created on your hub by the Hubitat app is one way to do.)

Nice. I hadn't registered my device yet with the new hub yet. I had with my other hub though. So the Send/Speak option wasn't there yet.

Now... Since I have 2 hubs, Home and Cabin, and I am currently logged into Home. Will I get the app notifications? Or do I need to be logged into that hub to get them?

Alas, the app can only be "associated" with one hub at a time. (Yuo can sign out and back in at will, but that won't help if you want notifications from any hub at any time.) If they were on the same LAN, you could share the notification device from one hub to the other with Hub Mesh; over the Internet, you'll have to use something like HubConnect (not officially abandoned but unlikely to get much attention at this point...). I suppose you could use a Rule with a cloudendpoint trigger to do the same just for this purpose, too...I think you can get parameters out of HTTP calls now (like your notification text), but I haven't tested.

What a lot of people will recommend instead is just using a different notification method on the second hub. Pushover, again, is a popular option (cheap but not free). There are a few others, as well, though some may need community drivers to work.

1 Like