There is no other line about it in the log. No idea why
So to what do I need to change the proxy to then, with what do I need to link it ?
The proxy is a item that should capture the state of your lightswitch. In your case its not possible with my rule.
The switch and motion sensor are inputs while your light is the end result but is no seperate device but is also the switch.
Thats why i used a double switch.
It has a switch all function which only turns on when i manually push the switch.
In your case the only solution i see is to work with persistence and timing to define the last item updated / used so you can update a virtual proxy switch that will define wether the light is activated by motion or switch.
Other solution is buy a fibaro dual relay if you have zwave for example.
Well, that would explain why your Rule isnât triggering. Try using changed as the trigger.
Now it works as it should (almost)
The light gets switched on when motion is detected and stays on as long there is movement detected in the 5 minutes timeframe I set.
But ⊠the problem now is that it doesnât turn off after 5 minutes automatically when no movement was detected in the last five minutes. Any idea why that could be ?
regards
Please always post your whole created rule again so we can see what you are doing.
please include the items to.
kindest regards
My rules file:
var Timer md1Timer = null
var boolean override = false
var String whoCalled = "manual"
val int timeoutMinutes = 5
rule "Proxy Commanded"
when
Item WohnzimmerDeckenlicht_1_Proxy received command
then
// Forward ON commands always
if(WohnzimmerDeckenlicht_1_Proxy.state == ON && WohnzimmerLampeDecke.state != ON) WohnzimmerLampeDecke.sendCommand(ON)
// Only send off if not overridden
else if(!override && WohnzimmerLampeDecke.state != OFF) WohnzimmerLampeDecke.sendCommand(OFF)
end
rule "Motion Triggered"
when
Item XiaomiMiMotionSensor1_MotionStatus changed to ON or Item XiaomiMiMotionSensor2_MotionStatus changed to ON
then
if(nightTime.state == ON){
// motion sensor is sending this command
whoCalled = "motion"
// Turn on the light
WohnzimmerDeckenlicht_1_Proxy.sendCommand(ON)
if(md1Timer == null) {
md1Timer = createTimer(now.plusMinutes(timeoutMinutes ), [|
WohnzimmerDeckenlicht_1_Proxy.sendCommand(OFF)
md1Timer = null
])
}
else {
md1Timer.reschedule(now.plusMinutes(timeoutMinutes ))
} }
end
rule "Light received update"
when
Item WohnzimmerLampeDecke received update
then
// Called whenever the Light's state is updated, its purpose is to tell the difference between a Motion triggered
// event and a manual event and set the override accordingly.
// Light was turned ON and whoCalled is "manual", light is overridden
if(WohnzimmerLampeDecke.state == ON && whoCalled == "manual") override = true
// Light was turned OFF, reset override
else override = false
// reset whoCalled back to manual
whoCalled = "manual"
// update the Proxy in case the light was changed at the switch, use postUpdate so rules don't trigger
if(WohnzimmerLampeDecke.state != WohnzimmerDeckenlicht_1_Proxy.state) WohnzimmerDeckenlicht_1_Proxy.postUpdate(WohnzimmerLampeDecke.state)
end
My items:
Switch WohnzimmerLampeDecke "Deckenlicht" (gLight) [ "Lighting" ] { channel="homematic:HM-LC-Sw1PBU-FM:ccu2bridge:OEQ0624006:1#STATE" }
Switch WohnzimmerDeckenlicht_1_Proxy
(The 2 motionsensor items where created via paper ui)
I am not sure where I did the mistake, now the light turns on as it should but it does not turn on after 5 minutes (if no motion detected) as it should.
Where did I made a mistake?
Or is there an better solution with using the expiry binding (never used it before, not sure how it works)
regards,
salexes
Read your rule.
Your timer is not included as you use 2 times if in your rule.
You have toâinclude the timer in the first if action.
For this you can check also the openhab example listed for motion when dark.
Also add some logging so you can tell what it is doing and if the rule is executed completely.
Ps: i still do not see how you will define the difference between turning on the light on the switch or turning it on via motion.
In your rule i can only read that both proxy and switch have to be on to turn on the light.
Can you share your vision on that as it could also be a future blocking factor for your rule.
Maybe i missed something.
This is the log of the current rule:
2018-02-05 07:27:43.181 [vent.ItemStateChangedEvent] - XiaomiMiMotionSensor1_MotionStatus changed from OFF to ON
2018-02-05 07:27:45.178 [ome.event.ItemCommandEvent] - Item 'WohnzimmerDeckenlicht_1_Proxy' received command ON
2018-02-05 07:27:45.189 [vent.ItemStateChangedEvent] - WohnzimmerDeckenlicht_1_Proxy changed from OFF to ON
2018-02-05 07:27:45.207 [ome.event.ItemCommandEvent] - Item 'WohnzimmerLampeDecke' received command ON
2018-02-05 07:27:45.228 [vent.ItemStateChangedEvent] - WohnzimmerLampeDecke changed from OFF to ON
2018-02-05 07:27:46.023 [vent.ItemStateChangedEvent] - XiaomiMiMotionSensor2_MotionStatus changed from OFF to ON
2018-02-05 07:27:46.032 [ome.event.ItemCommandEvent] - Item 'WohnzimmerDeckenlicht_1_Proxy' received command ON
2018-02-05 07:29:43.182 [vent.ItemStateChangedEvent] - XiaomiMiMotionSensor1_MotionStatus changed from ON to OFF
2018-02-05 07:29:46.021 [vent.ItemStateChangedEvent] - XiaomiMiMotionSensor2_MotionStatus changed from ON to OFF
2018-02-05 07:32:46.051 [ome.event.ItemCommandEvent] - Item 'WohnzimmerDeckenlicht_1_Proxy' received command OFF
2018-02-05 07:32:46.060 [vent.ItemStateChangedEvent] - WohnzimmerDeckenlicht_1_Proxy changed from ON to OFF
Well what I basically want is to do is to turn on the lights when motion is detected and be on as long motion is detected in the past 5 minutes, if motion is detected the light stays on.
Only if there was not detected motion in the last 5 minutes, only then the light should turn off.
BUT
if I turn on the light manually it should not be affected by the timer and just stay online as it is till I turn it off manually.
What or how would you suggest to solve it @wolf_from_the_north ?
i allready told you in before explenation its not possible to do this.
reading your rule your are making a rule that states that the proxy can only be turned off on those conditions.
you reuse a same off command in upfollowing rule stating your timer to turn off.
lets say you have 2 real items and 1 proxy.
1: lightswitch = light
2: motion sensor = activator
3: a proxy virtual item.
So when 2 detects motion it will send a ON command towards 3.
when 1 is OFF it will send a ON command to 1.
Then you want to press 1 manually to the ON status which cannot be updated cause itâs allready ON so you tell it to look at the VAL motion or manual.
but nowhere do you define how to check what turned ON 1, this means you have a loop.
you cannot define the state of 1 ( the lightbutton ) cause its allready used to turn on the light by other devices or items.
therefore i said before , you need a lightswitch which contains 2 items. ( in other words) a dual switch.
in that case when motion is detected it can turn on switch 1 and when you press the switch is has a switch all function turned on that you can monitor as beeing the manual interaction.
kindest regards
the only thing you can do is work with persistence and define when your lightswitch has been pushed again and at a later time then the motion detector.
i believe entering a room the motion sensor is always faster.
kindest regards