Can I get a little help? I just can't figure out how to do this.
I have this vitamin jar. I try to eat my vitamins every day but I don't remember to do it every day.
So, I've put Aqara contact sensor to jar's lid. Idea is to get a notification (text and/or audio) if the lid has not been open by a certain time of a day. And if it has been open, no notification needed.
I already tried Rule Machine ans Notifications but I really don't know where to start.
While Rule Machine would ultimately give you more flexibility, it seems like everything you want is also easily doable in the Notifications app. Here's something that will let you know if the sensor stays closed (i.e., hasn't been opened) for more than a day (24 hours times 60 minutes = 1440):
You'll have to configure the "Text Notifications" section (not shown) to select your notification device and the message you want to send, but that part should be easier.
Do note that with this app configured in this way, you'll have to "kick off" the timer by opening (and then closing) the contact sensor once; that's what will start the timer for the first (and any) time.
The countdown starts when the contact sensor reports that it is closed. Then, if it remains closed for more than exactly 24 hours (as I've configured it; you can change that time), it will send a notification. That isn't at a specific time of day, just 24 hours since a "closed" event was reported. I'm not sure if this exactly answers your first question, but I think this is what you meant?
Notifications can do TTS, but if you have a specific file you want to play, you'll probably need RM. That rule wouldn't be too bad to write. Re-reading your original request, I suppose you might actually want this instead if you do want a "specific time of day" thing, but then you'll also have to decide how long it's OK for the sensor to have been closed, too.
Lets say I want to be notified every night at 8 pm only if the jar has been opened. If it has been opened at some point on the day, there should not be any notifications.
So I think that the countdown doesn't work in this case.
I want a rule to check every night at 8 pm if the lid has been opened on any time on that day. If it has been open, all good. If it's not, then a notification.
TTS doesn't work yet because my kids doesn't understand English. Thats why I have custom audios. I've just downloaded Google Translations speech from English to Finnish.
That's about what I was thinking, though you could just use Private Boolean in the "main" rule instead of a virtual device unless you need a device for Dashboard purposes or something (or you could use a global variable with or without a connector, depending again on whether you want a device, if that's clearer). But you definitely need something like that to "track" the sensor, since you can't just evaluate as a single action in a rule whether X happened in the list Y minutes or whatnot.
For the speech, if you have a device that supports the "Play Track" command (check the device page), you can host an audio file on the hub--or anywhere on your network or even the Internet if you prefer. Here's something I have going to a Sonos in this manner (irrelevant things blocked out), hosted from the hub:
If you have a Google Home or an Amazon Echo, you can use also use them to notify you. I have both setup and it works great!
There is a built in app for Google called āChromeCast Integration (Beta)ā. It is very easy to setup.
There is a community app for Amazon Echo called āEcho Speaksā which is a bit more complex to setup and which is currently quite resource intensive, so will slow down your hub a bit (the developer is working on a less resource intensive version...).
The ātimeoutā means that after a certain number of hours/minutes/seconds (16 hours in this case), it will timeout on the waiting - it will stop waiting and execute the next line.
So, essentially what this absolutely awesome code is doing is: At 4am, is starts monitoring your sensor. If you trigger it by opening the jar, it executes the next line where it will find that the jar is not closed and hence it will skip the associated action and the program ends until tomorrow at 4am. (No notification required today since you opened it.)
If 16 hours after 4am - at 8pm - the open even hasnāt been received, it will execute the next line and as long as you donāt open it just at that moment, it will send the notification.