Send message once

Hi

I want to know whether the temperature overnight drops below a particular value and then send a notification to my phone. The rule basically works, except that the temperature is checked every hour, so I can wake up to a load of messages. How do I get the rule to only send 1 notification on the first time the required threshold is met?

Thanks

There's probably a smarter way of achieving this, but use a Hub Variable or virtual switch that you set when you send the notification and use in an expression for your rule. If that makes sense...

1 Like

There are many ways to go about doing this, but I would recommend something similar, using Rule Machine:

ā€”ā€”-
Required Expression: Private Bookean = false true
Trigger: sensor temperature < threshold
Rule:
Set Private Boolean to true false
Send notification
Wait for event: time of day
Set Private Boolean to false true
ā€”ā€”-

The wait is necessary to reset the variable so the rule will run again the next day.

Does this help?

2 Likes

Thanks @sburke781 and @Sebastien. I did wonder if using a variable was the way to go. Haven't used them before so will give it a try.

2 Likes

Actually that won't work. See this thread. You can use the private boolean, but you would need to reverse the logic, as the private Boolean starts out true when first used.

3 Likes

Ah! Thanks for that @terminal3! I had forgotten about that. Iā€™ve gone and updated my original post to reverse the value.

Take a look at the inbuilt Notifications app. It has options to control the number of notifications. Quick example:

2 Likes

Thanks @ritchierich Unfortunately I am not using a sensor to check the temperature so I can't use this method.

@Sebastien I have written the rule based on your instructions and it works - many thanks

2 Likes