Hi
I’m trying to make a daylight rythm with tunable white Hue lamps.
I have two dimmer items, one for the color temperature and one for the brightness
The color temperature should change over time, so in the morning the warm color is on, and at 12PM the color is cold. so the color should change a little every 15 minutes.
And again changing slowly to warm, so at afternoon the color should be warm again.
So if i turn on the light on the wall switch it should trigger the my rule and then turn on the light at the right color temperature, and as long as the light is on, the color should change evert 15 minutes.
I did try to make a rule, but I do not know if this is the easiest or best way to do this, I did’t make the rule, but only for an example of how I intended to do,
// Dynamisk lys
rule "Dynamic rule"
when
Time cron "0 15/1 0 ? * * *" or //Run every 15 minute
Item ihc_outlet1 changed //my test switch
then
var Number minutes = now.getMinuteOfDay
logInfo("Dynamic light", "SayText: {}","It is time to change color temperature, the minutes of the day is now " + minutes)
if (minutes >= 1 && minutes <=14) // the time is between 00:00 - 00:14
{
logInfo("Dynamic light", "SayText: {}","The time is between 00:15 & 00:30, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 15 && minutes <=30) // the time is between 00:15 - 00:30
{
logInfo("Dynamic light", "SayText: {}","The time is between 00:15 & 00:30, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 31 && minutes <=44) // the time is between 00:31 - 00:44
{
logInfo("Dynamic light", "SayText: {}","The time is between 00:31 & 00:44, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 45 && minutes <=59) // the time is between 00:45 - 00:59
{
logInfo("Dynamic light", "SayText: {}","The time is between 00:45 & 00:59, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 60 && minutes <=74) // the time is between 01:00 - 01:14
{
logInfo("Dynamic light", "SayText: {}","The time is between 01:00 & 00:14, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 75 && minutes <=89) // the time is between 01:15 - 01:29
{
logInfo("Dynamic light", "SayText: {}","The time is between 01:15 & 01:29, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 90 && minutes <=105) // the time is between 01:30 - 01:44
{
logInfo("Dynamic light", "SayText: {}","The time is between 01:30 & 01:44, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 106 && minutes <=119) // the time is between 01:45 - 01:59
{
logInfo("Dynamic light", "SayText: {}","The time is between 01:45 & 01:59, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
if (minutes >= 120 && minutes <=134) // the time is between 02:00 - 02:14
{
logInfo("Dynamic light", "SayText: {}","The time is between 02:00 & 02:14, exactly " + Ntp.state.format("%1$tR") )
// Save the state to later use when the light turns on by the switch
}
//and so on......
end