I was trying to get a now.GetDayOfWeek rule to work.
It seemed like it was not working(as if I didn’t know what numbers 1-7 correlated to.
That’s question 1: GetDayOfWeek 1-7 is that Sun-Sat?
In order to try to figure out what it was returning i wrote a test rule that would email me the value returned for today’s day in integer format. I keep getting an error in the log when it runs:
2017-02-25 00:46:42.380 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Test Rule’: An error occured during the script execution: The name ‘.GetDayOfWeek’ cannot be resolved to an item or type.
Question 2: What am i doing wrong here?
var int todayint
rule "Test Rule"
when
Item TestRule received command ON
then
todayint = now.GetDayOfWeek
if (now.getDayOfWeek>1 && now.getDayOfWeek<7) {
sendMail("test@gmail.com", “Office Hue Weekday” + todayint + “”,“Office Hue Weekday”)
}
else{
sendMail("test@gmail.com", “Office Hue Weekend”,“Office Hue Weekend”)
}