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

The Homey Community has been moved to https://community.athom.com.

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: https://forum.athom.com/discussion/comment/15118/#Comment_15118

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

Flows:

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

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)

Tagged:

Comments

This discussion has been closed.