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.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Solved HomeyScript
Ok Homey, What's the Current Day Number?
LyoshaDovolen
Member
How to make Homey sent me a push (or tell me when I ask) "the number of the current day"?
"Today is 19 of 365"
https://www.epochconverter.com/daynumbers
"Today is 19 of 365"
https://www.epochconverter.com/daynumbers
Tagged:
Comments
Above is a nice Try, but probably failing when Homey is not online at midnight and without notice one day behind...
I think the best solution is to let HomeyScript calculate the day on request.
To use the calculated number in a Flow you can use Better Logic.
(not possible with the build in Logic at the moment, see note.)
So install HomeyScript and Better Logic on your Homey.
Create a Better Logic Variable named 'DayOfYear' of type number.
Create a HomeyScript at https://homeyscript.athom.com/
Name it for example getDayOfYear.js
Past the script below:
Create a Flow to test:
By using it as a Dummy condition (...and...) it will calculate "just is time" the actual day number once again and set the Better Logic Variable for you to use in the Action (...Then)
Test it:
(Although I like BetterLogic, I tried without but setting (Homey) Tags from HomeyScript is not possible at the moment. See GH Issue https://github.com/athombv/homey/issues/2171)
Edit: Math.round for result Varies ~ 0.04 on non-DST vs DST days
Edit 2: updated to use HomeyScript Tags, Better Logic is not necessary anymore.
Better Logic is not necessary anymore.