-----------------------------------
Just for fun, I got a q how to display the weekday on a dash, and found out this works also:
// Create a date object
var date = new Date();
var week = ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag']; // Create an array of weekday names
await tag("NaamVanDag", week[date.getDay()] ); //creating new HomeyScriptTag 'NaamVanDag'
console.log( "NaamVanDag", week[date.getDay()] ); // Displays the name of today
return(true);
this should be quite simple when using the array of weekdays. Just start the array with a different day
// Create a date object
var date = new Date();
var week = ['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag']; // Create an array of weekday names
var weekTomorrow = ['Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag','Zondag']; // Create an array of weekday names, but one day ahead
await tag("NaamVanDag", week[date.getDay()] ); //creating new HomeyScriptTag 'NaamVanDag'
await tag("NaamVanMorgen", weekTomorrow[date.getDay()] ); //creating new HomeyScriptTag 'NaamVanMorgen'
console.log( "NaamVanDag", week[date.getDay()] ); // Displays the name of today
console.log( "NaamVanMorgen", weekTomorrow[date.getDay()] ); // Displays the name of tomorrow
return(true);
Always fun to hassle with HomeyScript, btw, did you test this also between 00:00h and 02:00h? I had the problem that Homey is using UTC time in HomeyScript, so the day change is at 02:00h in the summer. Thatās the reason for me to use dateHuman.
date|2021-05-14T08:41:54.727Z
dateHuman|vrijdag 14de mei 2021 10:41:54|
Yea, Iām aware of the UTC vs. local time sh*t.
Why did Athom change the system time to UTC. Very impractical for ānormalā @ home use imho.
Well, itās a big discussion about what time to use, this is Geurtās view on it:
So if Hscript Date() returns zulu time, the new day / next day flows which triggers scripts using that, should be running at 02:01AM during Day Saving time,
and at 01:01AM during ānormal local timeā.
My holy, who invented this messš
But, to keep it practical, for me this does the job:
I wonāt need written / spoken weekdays or months before 6:00AM UTC+2
So the flows can run at 02:01AM UTC on my system.
With one idea, you get another one
This script returns the name of the next day (a bit quick ānā dirty, but it works), and it can be run right after midnight (no hassle with UTC times and what not)
//MyCreateTomorrowName-Tag.js
// This script creates tag named NaamVanMorgen and then this script
// updates the value of it with the name of the *the next* weekday.
let SysInfo = await Homey.system.getInfo();
var weekDay = SysInfo.dateHuman.slice(0,(SysInfo.dateHuman.indexOf(' ')));
if ( weekDay == "maandag" ) { weekDay = "dinsdag" } // if contents of 'weekDay' equals [maandag], then overwrite it with [dinsdag]
else if ( weekDay == "dinsdag" ) { weekDay = "woensdag" }
else if ( weekDay == "woensdag" ) { weekDay = "donderdag" }
else if ( weekDay == "donderdag" ) { weekDay = "vrijdag" }
else if ( weekDay == "vrijdag" ) { weekDay = "zaterdag" }
else if ( weekDay == "zaterdag" ) { weekDay = "zondag" }
else if ( weekDay == "zondag" ) { weekDay = "maandag" }
else weekDay = "Unknown until tomorrow..."
await tag("NaamVanMorgen", weekDay ); //creating new HomeyScriptTag 'NaamVanMorgen'
console.log("NaamVanMorgen", weekDay);
return(true);
Thanks Thomas, Iāll try to remember switching to EN first when taking screenshots. Oh crap, I just discover Homey has to restart to change the language
Which post do you like to be Englified @Kindbo?
I want to obtain the result of a calculation in a flow but Iām not being able to achieve what I want.
I want something like this {{tag from power meter * 0.1445+23%}}
That being whatever kws that are in that tag, x 0.1445ā¬ (price of electricity in my country) +23% taxesā¦
But homey does not make that multiplication, i have created a numerical variable in logic with the 0.23 value but even using that tag from logic it doesnāt work, i must be doing something wrong for sureā¦
If someone can explain me how to achieve this Iāll appreciate it.