Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 4

HC3 no motion for X time = lights off, how to?


Pete123

Question

Hi,

 

How do you configure a scene that will turn on lights when motion and does not turn off until motion sensor has been safe for X time?

I am looking for both Lua and block options, if available.

Until now I have only found option for "delay" meaning lights will turn off after given time no matter if there has been motion during "delay" period.

 

Hope someone has found a solution for this.

Link to comment
Share on other sites

Recommended Posts

  • 0
1 hour ago, jgab said:

 

No problems, 

and you're right. It should be a function that is part of the standard conditions test for scenes.

Made a small improvement to stateWatcher.

value=R00:05/2/88:on

A starting 'R' (as in 'Repeat') indicates that the rule should continue to fire events every 5min the expression is true.

Normally, the expression has to become false before it starts to watch for true again.

Good to have if you want to have notification and reminders if a door/window is left open.

Link to comment
Share on other sites

  • 0
W dniu 21.03.2020 o 15:25, jgab napisał:

Made a small improvement to stateWatcher.

value=R00:05/2/88:on

A starting 'R' (as in 'Repeat') indicates that the rule should continue to fire events every 5min the expression is true.

Normally, the expression has to become false before it starts to watch for true again.

Good to have if you want to have notification and reminders if a door/window is left open.


Is there any way to add variable weather conditions?
It would be nice to use YR Weather (for those who do not have a weather station) to control the heating associated with opening windows ... for example:
00: 05: 00/1/201: off & 204: off & 207: off & 198: off & YRtemp <10 & YRwind <10 & YRhumidity> 30

W dniu 15.02.2020 o 22:07, Pete123 napisał:

Hi,

 

How do you configure a scene that will turn on lights when motion and does not turn off until motion sensor has been safe for X time?

I am looking for both Lua and block options, if available.

Until now I have only found option for "delay" meaning lights will turn off after given time no matter if there has been motion during "delay" period.

 

Hope someone has found a solution for this.

You can use QA written by @jgab it works great- 

 

Edited by michal85pl
Link to comment
Share on other sites

  • 0
35 minutes ago, michal85pl said:


Is there any way to add variable weather conditions?
It would be nice to use YR Weather (for those who do not have a weather station) to control the heating associated with opening windows ... for example:
00: 05: 00/1/201: off & 204: off & 207: off & 198: off & YRtemp <10 & YRwind <10 & YRhumidity> 30

You can use QA written by @jgab it works great- 

 

 

Well, it works already.

00:05:00/1/201:off & 204:off & 207:off & 198:off & fibaro.getValue(3,'Temperature') <10 & fibaro.getValue(3,'Wind') <10 & fibaro.getValue(3,'Humidity')> 30

 

However, did an update that treats <ID>:<Property> as fibaro:getValue(<ID>,<Property>)

So, this works

00:05:00/1/201:off & 204:off & 207:off & 198:off & 3:Temperature <10 & 3:Wind <10 & 3:Humidity > 30

this will allow to get any property from any device with a shorter syntax

Please login or register to see this attachment.

 

Edited by jgab
  • Like 1
Link to comment
Share on other sites

  • 0
21 minut temu, jgab napisał:

However, did an update that treats <ID>:<Property> as fibaro:getValue(<ID>,<Property>)

So, this works

00:05:00/1/201:off & 204:off & 207:off & 198:off & 3:Temperature <10 & 3:Wind <10 & 3:Humidity > 30

this will allow to get any property from any device with a shorter syntax

great thanks for that

Link to comment
Share on other sites

  • 0

Just in case anyone wants their light Dim/High based on time:

 

local landingLight = 142
local landingMotion = 144
local dimLevelLow = 3 -- Night Dim Level
local quietStart = 21 -- 9pm - from
local quietEnd = 07 -- 7am - To
local maxTime = 30  -- max time the sensor should be safe before turning off
local sleepTime = 5   -- time in seconds between each check of the sensor
local currentDate = os.date("*t")
 
-- Code to tun on light
if (currentDate.hour >= quietEnd) and (currentDate.hour <= quietStart) then
    fibaro.call(landingLight, "turnOn")
    fibaro.debug("LandingLight""Turning on Landing Light = High"
else
    fibaro.call(landingLight, 'setValue'26)
    fibaro.debug("LandingLight","Turning on landing light = Low")
end
 
-- Turn off light no motion
local safeTime = 0
while safeTime < maxTime do
  fibaro.sleep(sleepTime*1000)                 
  safeTime=safeTime+sleepTime                   -- count up safeTime
  fibaro.debug("LandingLight","Counting up safeTime ",safeTime,maxTime)
  if fibaro.getValue(landingMotion,'value'then -- motion breached
     safeTime=0                                 -- reset safeTime
     fibaro.debug("LandingLight","Reset")
  end
end 
  
fibaro.debug("LandingLight","Turning off")
fibaro.call(landingLight,"turnOff"
  • Like 1
Link to comment
Share on other sites

  • 0
On 3/10/2020 at 6:08 PM, jimicr said:

@robw, remove the check if lights are on:

Please login or register to see this code.

to:

Please login or register to see this code.

Same goes for turning off

 

Jim

@jimicr Why should this make a difference?  I'm curious because i have some of the same spooky issues as @robw . I have non consequent behaviour, sometimes the lights goes off, sometimes it does not go out. The strange thing is, i have the exact same code running on 4 different rooms with the only difference that in the 'spooky' room i have a qubino dimmer, in al the 3 other rooms i have 3 ecodim dimmers.

I have a feeling that it has something to do with the call to the qubino dimmer. still investigating and trial and error logging here.....

What brand of dimmer are you using @robw?

Link to comment
Share on other sites

  • 0
8 hours ago, okidoki said:

@jimicr Why should this make a difference?  I'm curious because i have some of the same spooky issues as @robw . I have non consequent behaviour, sometimes the lights goes off, sometimes it does not go out. The strange thing is, i have the exact same code running on 4 different rooms with the only difference that in the 'spooky' room i have a qubino dimmer, in al the 3 other rooms i have 3 ecodim dimmers.

I have a feeling that it has something to do with the call to the qubino dimmer. still investigating and trial and error logging here.....

What brand of dimmer are you using @robw?

Goodmorning @okidoki.

 

I have no idea what is happening on your setup. ATM I am using this scene in one room: fibaro double switch and an Aeotec MS6 for motion.

Hopefully today I'll add support for (Fibaro) dimmer 2's.

And will monitor if I get a ghost as well.

 

Jim

Link to comment
Share on other sites

  • 0

in next update we will add block scene with that option, below screenshoot

Please login or register to see this image.

/monthly_2020_05/obraz.png.5c659809e4e17868101851952e5b71c0.png" />

Link to comment
Share on other sites

  • 0

Could anyone help point me to the beginning and where to start. I have the same original question, and read the whole thread but there are some gaps and assumptions through the thread which i'm missing to be able to piece this together. For example i don't know how to print or create the Hometable if necessary. Its tricky to identify the device names in the example codes as some are in a different language, so i can't tell the code, device names from language :) Just starting out so apologies for not being able to follow 

 

I would specifically like from my HC3: when the light level is low  (in a single room) the light(s) to turn on with motion, off again after a certain period of time unless motion is re-detected still, or the switch is manually pressed. I am using Fibaro dimmer 2 lights (some hue lights) and a Aeotec MS6 (USB Powered). A bones would be to be able set the light brightness depending on the corresponding Lux level :)

Link to comment
Share on other sites

  • 0

You can start simple. If it works, you can always make it better.

 

Add a lua scene

 

Use this for declarions

Please login or register to see this code.


Use this for Actions

 

Please login or register to see this code.


in this code 254 is my motion sensor,

256 is my lux sensor and

251 is the light switch.

You have to fill in the ID’s of your setup. 

 

“value = 3” represents the lux value. So in this code <= 3 lux (and motion) will turn on the light. You can experiment with this value, which lux value suites you the best in your setup. 
 

local maxTime = 1*60” represens the time the light stays on, in this case 60 seconds (and longer if there is still motion, motion resets the timer). 

 

 

  • Thanks 1
Link to comment
Share on other sites

  • 0

@SmartHomeEddy Thank you, thats super! 

 

I've got that working and just testing the behaviour now. I moved the Lux up to 500 and extended the time to 180 seconds: The lights are still switching off even though i'm sitting here in the room as i'm not moving so much. This scene is for the kitchen, quite a busy area, what's the best timing to use from your experience? is it worth adjusting the parameters on the sensor itself too to get the sweet spot?

 

Also - how do i trigger multiple lights, something like this below (total guess)

Please login or register to see this code.

Link to comment
Share on other sites

  • 0

That won’t work yet. But I think with some adjustment

 

Normaly I need some trial and error ?, hope this works in one try. 

 

Please login or register to see this code.


And yes, you can adjust the motion sensor sensitivity to get the right behavior. 
 

And the more times you are in the kitchen, the higher I would set the timer. Otherwise the light will go on and off all the time. 
 

Edited by SmartHomeEddy
added “
  • Thanks 1
Link to comment
Share on other sites

  • 0

Yep that worked - you were really close, just missed a " after Light scene towards the end.

 

have you needed to adjust the parameters on the sensor to get it to work properly, adjusting the blind time for example?

Link to comment
Share on other sites

  • 0

Just one “ That’s a record for me ?

 

I experimented somewhat with the sensitivity and pulse counter (although it’t not recommended to change the pulse counter). But I needed to lower the motion sensor reactions (it’s outside on the driveway)

Link to comment
Share on other sites

  • 0

Assuming you're using a Aeotec MS6 - I reduced parameter 3 to 10s and 111 to 240s

 

I'll test the behaviour and feedback, thanks for your help!

 

how do i level it up then? :)

Link to comment
Share on other sites

  • 0

@theuksbest

 

My switch overrides the scene. So the light stays on, if I use the switch. I don’t want it to go off, if I switch it manually. That drives me crazy if I want to work in the garage ?
 

(But to use the switch, I am in range of the motion sensor) 

 

The declaration is now

lux less than AND motion

 

Maybe you could change the declarations with this logic

 

switch on

OR

(lux less than AND motion)

 

Within the action there is only a check for motion. So if you turn on the light manually, it goes off after the timer unless there is motion, no matter the lux. 

 

Edited by SmartHomeEddy
  • Like 1
Link to comment
Share on other sites

  • 0

@SmartHomeEddy i've been digesting your last points for the last couple of days, whilst testing the behaviour of what i have so far. There is an error showing up in the logs, but it only reports: [30.06.2020] [20:32:03] [ERROR] [SCENE40]:   and nothing reported after it - Any ideas, do i need to worry about it???

 

As far as i can tell the lights are coming on and going off as expected. The only strange thing is i'm not confident the set Lux level is really making a difference, but it's hard to be sure since there is no lux check in the action.

 

my declaration;

Please login or register to see this code.

and action:

 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

I have tested the scene and indeed I also saw the short error message. 

 

I have added some info tot the action, so you can see the current Lux level. That way you maybe can experiment somewhat more with the lux levels. And after the changes I got the strange error not any more. 

 

You can test with the lux level in the declaration. In the action the lux has no meaning. Because in de declaration if there is motion (that is the trigger), the lux level has to be less or equal to the number you fill in. Btw 300 is a lot. My Hal light turnes on after motion with lux level <= 3. But maybe a different sensor brand has different lux levels. I use the Fibaro multisensor. 

 

Copy this action (the declaration has no changes).

 

Fill in your ID's for light, motion and Lux (Lux is the same ID you use in the declaration for lux).

 

And maybe you want a different maxTime.

(btw I see in your code 1*600. That will work, but the logic of 1*60 is "1 minute". Than you don't have to calculate with the 60 seconds. 2*60 is 2 minutes, 5*60 is 5 minutes. Etc.) 

 

And maybe you want to replace "Hal light" with the name you like. 

 

Please login or register to see this code.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...