This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to

This forum is now read-only for archive purposes.
Closed Flows

[FLOW] [Example] Trigger XX Minutes before Sunset

GeurtDijkerGeurtDijker Member
edited April 2018 in Archive
I want to contribute and document the way to trigger something fe almost half an hour before Sunset  ....
Actually we are triggering on XX minutes after the last Sunset, so it varies a couple of minutes and is tested only once a minute. 

All Credits to @Phuturist and the fabulous search engine on the forum (that makes this actual "re-post" necessary to find something for new Homey Owners ). 
Original Post:

I hope this will help others / new Homey Owners to find the solution faster....

Prerequisites/ What I have:

  • Homey ;-)
  • BetterLogic App
  • Android App to Push Repporting.
  • Someting else to execute 
Create a Better Logic Variable: BeforeSunSet 
Type: Number


I Created the Following Flows:
  • SunSet
  • SunSetInHalfHour
When - The Sun Sets
And - []
Then - Execute Math.js expression: [$timenow$ + 84600] [BeforeSunSet] + Enable a Flow [SunSetInHalfHour]

When - Every 1 minute
And - Math.js expression is true [$BeforeSunSet$ < $timenow$]
Then - Send A Push Notification to [User] Msg:[Sunset in Half an Hour !! <time] !! ]+ Disable a Flow [SunSetInHalfHour]

Enabling /disabling is necessary to prevent half an hour every minute a trigger / push msg. 

The math.js function in the first action card is $timenow$ + 84600 (where 84600 is one day minus half an hour)



This discussion has been closed.