Handling the Fibaro motion sensor for lighting

In one of my room, I have one Fibaro motion sensor. I would like to create a basic rule that switch ON the light in this room when motion is detected and switch OFF the light after 2 minutes when motion is no more detected in the room.
Currently my rule is only based on the variable “Tripped”. It is working well except when I stay in the room. The light is switched OFF after the delay even if I am still in the room and moving.
I believe the reason is that the variable “Tripped” in the Vera is not set again to 1 when already set to 1 or the Mios binding does not see this new value set ?
Should I use the variable “LastTrip” rather than the variable “Tripped” ?

Ok I did not get echo to my problem :slight_smile:

I just investigate a little more, looking at openHAB logs and my current feeling is that Vera Control is, one time again, not handling correctly this device. I hope that the problem is not in the MiOS binding because I have only checked the result in openHAB.

The variable Tripped seems to be correctly handled. It is set to 1 as soon as a movement is detected by the Fibaro sensor. If a new movement is detected again, the variable is not set again. And if no movement is detected in a timeframe of 30 seconds, the variable is set to 0. No problem with this behavior, that looks as it should be.

The problem is the variable LastTrip. The variable is set only when the other variable Tripped is set. So when the variable Tripped is set to 1, the variable LastTrip is set to the current time. First problem, if there is a new movement detected after 20 seconds for example, the variable is not updated. Second major problem, when the variable Tripped is set to 0, the variable LastTrip is set to the current time too !

As a conclusion, the basic rule I want to define (switch ON a light when movement is detected and switch it OFF when no new movement is detected in a certain delay) looks very hard to implement ! I think I have a solution but absolutely not natural.

Here is a solution:

[code]var Timer timerChambre

rule “D?tection mouvement chambre”
when
Item DetecteurChambre changed
then
if (previousState.toString == “CLOSED” && DetecteurChambre.state.toString == “OPEN”) {
var Number luminosite = LuminositeChambre.state as DecimalType
if (luminosite < 30) {
if (timerChambre != null) {
timerChambre.cancel
timerChambre = null
}
LampeChambre.sendCommand(ON)
}
}
else if (previousState.toString == “OPEN” && DetecteurChambre.state.toString == “CLOSED”) {
if (timerChambre != null) {
timerChambre.cancel
timerChambre = null
}
timerChambre = createTimer(now.plusSeconds(90)) [|
LampeChambre.sendCommand(OFF)
]
}
end[/code]

I could probably avoid using this timer by updating one setting of the Fibaro in the Vera. Probably the setting that is set to 30 seconds by default that I should update to 120 seconds to have the tripped status reset after 2 minutes rather than 30 seconds with no movement.

Finally, I setup through the Vera UI the setting number 6 to 120 (2 minutes) for my Fibaro motion sensor.

Now my openHAB rule is just:

rule "D?tection mouvement chambre" when Item DetecteurChambre changed then if (previousState.toString == "CLOSED" && DetecteurChambre.state.toString == "OPEN") { var Number luminosite = LuminositeChambre.state as DecimalType if (luminosite < 30) { LampeChambre.sendCommand(ON) } } else if (previousState.toString == "OPEN" && DetecteurChambre.state.toString == "CLOSED") { LampeChambre.sendCommand(OFF) } end

No need of additional timer.

lolodomo <----- I am having the same problem as you did here with these sensors… I love them but it just won’t stay on even when in the room. Can you in detailed steps explain how to fix this and where I make changes and put any type of codes? I just want to be sure not to mess up a good sensor. Thanks for your help.

[quote=“lolodomo, post:4, topic:185745”]Finally, I setup through the Vera UI the setting number 6 to 120 (2 minutes) for my Fibaro motion sensor.

Now my openHAB rule is just:

rule "D?tection mouvement chambre" when Item DetecteurChambre changed then if (previousState.toString == "CLOSED" && DetecteurChambre.state.toString == "OPEN") { var Number luminosite = LuminositeChambre.state as DecimalType if (luminosite < 30) { LampeChambre.sendCommand(ON) } } else if (previousState.toString == "OPEN" && DetecteurChambre.state.toString == "CLOSED") { LampeChambre.sendCommand(OFF) } end

No need of additional timer.[/quote]

I am having the same problem as you did here with these sensors… I love them but it just won’t stay on even when in the room. Can you in detailed steps explain how to fix this and where I make changes and put any type of codes? I just want to be sure not to mess up a good sensor. Thanks for your help.

I just updated (through Vera UI) the device parameter number 6 to set it to 120 (120 seconds) while the default value is 30 seconds.
If there is no motion detected during this delay of 2 minutes, the Vera (v1.5.632) will update the state of the device from tripped to to untripped.

You can also adjust the device parameter 40 for luminosity reporting. I set it to 50.

[quote=“lolodomo, post:7, topic:185745”]I just updated (through Vera UI) the device parameter number 6 to set it to 120 (120 seconds) while the default value is 30 seconds.
If there is no motion detected during this delay of 2 minutes, the Vera (v1.5.632) will update the state of the device from tripped to to untripped.

You can also adjust the device parameter 40 for luminosity reporting. I set it to 50.[/quote]

Ok when you say “number 6” where exactly is that? I am using ui7 1.7.649 if this matters. I’m sorry to bother and sound stupid but this new layout is confusing but not as bad as that sensor turning off after 30sec in a room while still in there. Thanks for the help

Can anyone else follow up on this with me… Thanks for the help

You may need to take that part of the question outside the openHAB sub-forum, since it’s more about how to use the advanced settings in UI7 (and less folks here will have that due to its instabilities)

I understand but take it where? I just need to know where the codes go?

Since it’s a question about the Advanced UI elements of UI7, probably the General section. Either that, or the Lock, Motion & Security Control section for another UI7 user that may have done the same thing in the UI.

I’m on UI5, so I’m afraid I can’t help directly since setting parameters is slightly different, but this should point you in the right direction:
http://forum.micasaverde.com/index.php?topic=30728.0

The parameters and values to be entered will depend on your device and specific desired setup