In certain rooms, there is no specific time when I enter. Instead I use the motion sensors to activate the lighting. When I enter, the motion sensor detects movement and sends this to the lights, which will then turn on. This is how I programmed it in vs-code:
/* when the motiondetector goes on in the bathroom, do the following:*/
when
Item HueTemperatureSensor1_Motion changed to ON
then
/* define the hour of the day*/
var Number hour = now.getHourOfDay
/* if it is darker then 40 lux in the bathroom the light goes on*/
if ((HueAmbientLightSensor1_Illuminance.state as Number) < 40.0){
KNXDevice12_.sendCommand (ON)
/* after 10 minutes past the motion detected the bathroom light switches off*/
createTimer (now.plusMinutes(10), [ |KNXDevice12_.sendCommand (OFF)])}
/* if it is between 7 and 8 in the morging and there is motion in the bathroom, the tosti ijzer goes on*/
if (hour >7 && hour <8){TostiIjzer_Switch.sendCommand (ON)}
if (LocalSun_Position_Elevation.state <3){createTimer(now.plusMinutes(13),[|KNXDevice10_.sendCommand (ON)])}
{createTimer(now.plusMinutes(13), |HueAmbianceCeiling1_Brightness.sendCommand (0)])}
end