Hi,
I have tried to create a rule that turns my living room lights on when movement is detected but only if the Lux is less the 7.
Another rule is supposed to turn them off again if no movement is detected or if the Lux increases but only if there is no smoke alarm.
Both are failing. Can anyone help.
The devices are;
Security_Motion_LR = Switch
Light_All_LR = Dimmer for all 4 MiLight zones
Environment_Lux_LR = Number
gSafetyAlarms = Switch
This is my poor attempt;
rule "lightsAutoLR_ON"
when
Item Security_Motion_LR changed to ON
then
if(Environment_Lux_LR.state <=6 && Light_All_LR.state = 0) {
sendCommand(Light_All_LR, 100)
}
end
rule "lightsAutoLR_OFF"
when
Item Security_Motion_LR changed from ON to OFF or
Item Environment_Lux_LR changed
then
if (gSafetyAlarms == OFF && Light_All_LR > 0 && Environment_Lux_LR > 8) {
sendCommand(Light_All_LR,0)
}
end
Maybe to start with, it may help if you posted your item and group definitions too; your log file; and maybe even before all of that, add some log statements so that you can see if you rule gets even triggered; it would good to know whether the rule trigger failed or the send_Command; and while you are at it, you may want to log also your lux_state to make sure that you see what sensor values you are getting back.
Thanks Matt. Putting the double equal kicked the rule into life as it wasn’t being triggered.
I changed the first test to <==6 and the second to ==0 The first rule now errors with;
2018-08-03 19:14:20.348 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'auto_lights_LR.rules' has errors, therefore ignoring it: [5,30]: missing ')' at '<'
[5,31]: no viable alternative at input '=='
[5,63]: mismatched input ')' expecting 'end'
2018-08-03 19:14:21.578 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'auto_lights_LR.rules' has errors, therefore ignoring it: [5,30]: missing ')' at '<'
[5,31]: no viable alternative at input '=='
[5,63]: mismatched input ')' expecting 'end'
Do you have the 0 in Light_All_LR.state == 0 mapped to OFF? If not try changing the o to OFF. Also good to change your send commands to this: Light_All_LR.sendCommand(ON)
I sent that before seeing the Light_All_LR as a dimmer, sorry about that. In your code you listed two values for that item 0 and 100, so I assumed 0 to be OFF and 100 to be ON.
I’ve never used dimmers with openhab, how do you control them remotely?
You may want to start with Light_All_LR turning on/off with motion. Get that working then add in each deceive one at a time. That way you narrow down what’s breaking your rule.
https://www.openhab.org/addons/bindings/zwave1/
I looked over the zwave stuff and found lots of devices and they are all configured a bit different. Check your item configuration and look in your logs to see whats happing. Logs are your web ui with :9001 tacked on.
Its a Coolcam PIR. It has both Motion and Lux in the one device. Below is how they are listed in my items file.
The Lux works just fine. I stripped my rule back to if motion on the turn lights on. I added the sensor to my site map as a switch. It appeared with two buttons Activated and UnActivated. When I click the activated button the lights came on and the log showed its state had changed but it doesn’t do anything by itseld. Its LED lights on movement but Openhab sees nothing.
Add :MAP(ONOFF.map) to the end of a switch and check that you have the map transformation installed via paperUi. It may complain about the channel being to long if so remove the sensor_binary and replace with MAP(ONOFF.map).
org.eclipse.smarthome.model.item.BindingConfigParseException: UID segment 'MAP(ONOFF.map)' contains invalid characters. The last segment of the channel UID must match the pattern [A-Za-z0-9_-#]*.
If this is somewhat similar to my Aeotec Multisensor 6, the motion trigger is timed in the device itself, and the timeout value is configurable through a z-wave parameter. (Both from PaperUI and Habmin).
In fact I only use this timer for all my motion rules. Minimum setting is 240s, so while it is in its triggered state, the LED will light up, but no new value is sent, but the device timer is of course restarted.
Yes its similar. It does have the timeout you talkabout. For the Living room I have it set to the maximum to avoid lights going off because I’m sitting to still. I have them set shorter in the hallway and landing.
These just don’t seem to be firing - they worked on my Domoticz setup so I know the hardware is fine.
I’ve posted a message about these sensors in the items section to see if anyone has used them.