Store a date at a specific time and add 7 days

Good morning,

I’ve been looking for a while how to store a date at a specific time and add 7 days to it to send me a notification that day.

Anyone got a solution?

The better logic app has some features for saving variables and converting them (back) into date objects.

You can use expressions etc within flowcards.

(Altho, you can also use homeyscript i suppose)

Do you have some examples ?

Well, this for example:
Create a (i would say ) Number variable in Better Logic (This can be easily done by adding a Set [number] to card and pressing save, or goto the BLL app Settings).

image
After Flowsave, the variable is created.

Now, replace this card with the Set [name] to Expression (BLL expression).
image

Now, to fill the variable with the current time(stamp), fill it with the expression Date.now()
image

This is how you can save a DateTime into a variable.

To use it and add 7 days, you could do something like this:

image

image

new Date([[DateTime]]).setDate(new Date([[DateTime]]).getDate() + 7)

Now, the question is, how do you want to use this date?

For storing energie data in google I created a variable dagnummer (daynumber) Every day at 00:01 it restores it. You can also do this wirh year , month etc.

1 Like

@Arie_J_Godschalk

I will keep sending myself a push message on this new date

[image]

I dont see an image?

So, you don’t need the specific time?
Only a way to start a pushmessage in 7 days?

Then i think you can better use @Paul_van_Ulft 's example.

it is an image error.

No exact time just send a message 7 days later

Maybe you can do something in HomeyScript, here is an example:

Good morning @JPe4619

yes I could but I would like to avoid scripts as much as possible for personal reasons.

1 Like

(With use of the Better Logic Library and Chronograph apps)

When I understand your question correctly, this sends a notification exactly after 7 days at the same hour, along with the trigger’s timestamp:

  • Example output when I use a timer duration of minutes instead of days:
    Screenshot from 2023-02-07 03-02-00

(Note, this will survive Homey reboots, but probably the time when Chronograph app is not running gets lost. But, the running state gets saved.
Example, when Chronograph is not running for 30 minutes during a reboot, the timeline notification will be delayed by also 30 minutes → In theory, NOT tested here
See reply by Arie below).

Not completly, chronograph calculates the finishing time.
So, if you reboot, the time wil “keep running” untill finished or booted.

1 Like

I guess this fresh new app can also be used for this:

Create a homey alarm (or schedule device for homey pro 2023) and adjust the alarm time to today + 7 days.
And when alarm goes, send message.

EDIT: Only time change possible at this moment, so this is no solution (yet) :flushed:

@Arie_J_Godschalk ,

Thanks, I will test this.

It seems to work even after a reboot.

How to do then so that when the timer is over the action only continues at a scheduled time

Cool! Didn’t know / tested that yet, Arie :cowboy_hat_face:

I can’t create that with the available flow cards.
Can you show how you did that?

Good morning,

I think I found the solution to my problem :slight_smile:

Thank you all

1 Like

Well, to be honest, I don’t use this app by myself at this moment, but based on these descriptions, I assumed it would be possible:

Homey Alarms: Adjust an alarm’s trigger time from a flow to get dynamic alarms.

With the action (Then) card you can modify an existing alarms scheduled time. See the sample advanced flows at the end of this post.

So tested it right away, but you’re right, this is time change only, mea culpa :flushed:

Maybe in future:

Does not support schedule for dates or months (for now).

1 Like

Thanks, no mea culpa needed :wink: I just thought I overlooked things. There are cards which takes minutes as value, but they calculate backwards instead of forwards in time at the moment. Thanks for the input though!

2 Likes