I’m trying the whole day to get a motion sensor timer code running with my fibaro fgms 001 motion sensor and milight bulbs, but I guess I need some help…
This is what I have so far:
.items
//EZ_Auge
Number EZ_Lux "Motion Sensor [%.2f Lux]" <sun> (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:sensor_luminance" }
Number EZ_Battery "Motion Sensor [%d %%]" <battery> (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:battery-level" }
Number EZ_Temp "Motion Sensor [%.1f C]" <temperature> (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:sensor_temperature" }
Switch EZ_Motion "Motion Sensor Motion [%s]" (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:sensor_binary" }
Contact EZ_MotionC "Motion Sensor MotionC [%s]" (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:sensor_binary" }
Switch EZ_Alarm "Motion Sensor Alarm [%s]" <fire> (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:alarm_general" }
Switch EZ_Burglar "Motion Sensor Alarm b [%s]" <fire> (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:alarm_burglar" }
Number EZ_Seismic "Motion Sensor Seismic [%f]" (ZwaveEye1) { channel="zwave:device:5b97d7f6:node4:sensor_seismicintensity" }
.rules
//EZ Auge
var Number counter = 0
var Number lastCheck = 0
rule "EZ Auge - Licht An"
when
Item EZ_Motion changed from ON to OFF
then
counter = counter + 1
//if(EZ_Lux.state < 40) {
sendCommand(Scene_EZ, 3)
}
end
rule "EZ Auge - Licht Aus"
when
Time cron "0 * * * * ?"
then
if(lastCheck == counter) {
counter = 0
lastCheck = -1;
sendCommand(Scene_EZ, 1)
sendCommand(EZ_Motion, OFF)
} else {
lastCheck = counter
}
end
// Scenes EZ
rule "Scene EZ"
when
Item Scene_EZ received command
then
/*Aus*/ if (receivedCommand==1) {
/*Aus*/ sendCommand(Scene_ColorSelect_EZ_Deckenlampe, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0)))
/*Aus*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Buecherregal, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0)))
/*Aus*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Sideboard, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0)))
}
/*Normal*/ if (receivedCommand==2) {
/*Weiss*/ sendCommand(Scene_ColorSelect_EZ_Deckenlampe, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(70)))
/*Aus*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Buecherregal, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0)))
/*Aus*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Sideboard, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(0)))
}
/*Hell*/ if (receivedCommand==3) {
/*Weiss*/ sendCommand(Scene_ColorSelect_EZ_Deckenlampe, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100)))
/*Weiss*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Buecherregal, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100)))
/*Weiss*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Sideboard, new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100)))
}
/*Stimmung*/ if (receivedCommand==4) {
/*Lila*/ sendCommand(Scene_ColorSelect_EZ_Deckenlampe, new HSBType(new DecimalType(300),new PercentType(100),new PercentType(100)))
/*Grün*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Buecherregal, new HSBType(new DecimalType(130),new PercentType(100),new PercentType(100)))
/*Türkis*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Sideboard, new HSBType(new DecimalType(190),new PercentType(100),new PercentType(100)))
}
/*Grün*/ if (receivedCommand==5) {
/*Grün*/ sendCommand(Scene_ColorSelect_EZ_Deckenlampe, new HSBType(new DecimalType(130),new PercentType(100),new PercentType(100)))
/*Grün*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Buecherregal, new HSBType(new DecimalType(130),new PercentType(100),new PercentType(100)))
/*Grün*/ Thread::sleep(500) sendCommand(Scene_ColorSelect_EZ_Sideboard, new HSBType(new DecimalType(130),new PercentType(100),new PercentType(100)))
}
end
The scene rules are working manually with some buttons.