Push notification with upcoming time

Hi!

I’m trying to make a timer that will remind me to do something 2 hours later. I have created a timer with cronograph which will send me a push notication 2 hours later, so that is all fine. But when the timer is started I would like to send a push notifcation saying that the timer is started and that it will finish a certain time, i.e the current time + 2 hours. Is there any way to use the #time variable + 2 hours to get what that time is?

The ‘Timey’ app might be what you’re looking for.

Or have a look at Better Logic Library App voor Homey | Homey

I solved it with homey script in the end. This was the solution:

// Get the current time in UTC
let now = new Date();

// Convert the current time to local time using Sweden’s time zone
let localTime = new Date(now.toLocaleString(“sv-SE”, { timeZone: “Europe/Stockholm” }));

// Add 2 hours
localTime.setHours(localTime.getHours() + 2);

// Add 30 minutes
localTime.setMinutes(localTime.getMinutes() + 30);

// Format the time without seconds (only HH:MM)
let formattedTime = localTime.toTimeString().split(‘:’).slice(0, 2).join(‘:’);

// Log the result for debugging purposes
console.log(‘Time in 2.5 hours:’, formattedTime);

// Return the result to Homey for further use
return formattedTime;

1 Like

I had to add an extra hour to get the correct time.