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
Quote

The QA I included is only a binary sensor that can aggregate other sensors.

If you saw my second example in the earlier post I added a loop in the scene that checked the lux value before turning on the lamps. (calculated the average for the sensors)

 

Does that mean you cannot include the Lux level as a condition on a binary switch, to simplify the scene?

 

So the device is only triggered when there's motion and the light threshold is met

Link to comment
Share on other sites

  • 0
Quote

You could combine them in the same scene.

 

@jgab i tried combing the two but i'm pretty sure i've got it totally wrong, any pointers? (getting this error [ERROR] [SCENE62]: (load):59: 'end' expected (to close 'if' at line 43) near)

 

Please login or register to see this code.

 

Quote

That table could use sunset or global variables to define the times.

 

I tried to understand this but couldn't, i wanted to use this as the times:

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
2 hours ago, theuksbest said:

 

Does that mean you cannot include the Lux level as a condition on a binary switch, to simplify the scene?

 

So the device is only triggered when there's motion and the light threshold is met

In theory you could but I guess we are becoming philosophical now...

I believe it's strange with a binary switch that does nothing when I click on it because it has decided not to turn on because of the current lux level. Imagine if it was your physical switch on the wall and nothing happens when you click it because it's too bright. 

A multiLevel switch that adjust the level depending on the lux level and time of day could make more sense I guess. However, a dimmer wall-switch should dim up and down when pressed and hold without any limits.

I think it makes more sense then to add these extra conditions in scenes that are typically run automatically without human interaction. 

3 minutes ago, theuksbest said:

 

@jgab i tried combing the two but i'm pretty sure i've got it totally wrong, any pointers? (getting this error [ERROR] [SCENE62]: (load):59: 'end' expected (to close 'if' at line 43) near)

Missing and 'end' at the end.

Also remove the second copy of 'toTime'.

 

Ok, your variable 'DayNight' can have different values like 'Day', 'Night' etc. but what does that mean in actual time?

Link to comment
Share on other sites

  • 0

Now I get it. Ok, you can make the scene much simpler.

Please login or register to see this code.

You still have a table where you map DayNight value to a dim value.

Edited by jgab
Link to comment
Share on other sites

  • 0

@jgab Thanks, it's running and no errors so far so i'll monitor the behaviour and feedback. Thank you! Ow I've assumed i don't need to include my Lux sensor in the declarations, just my new binary sensor, hope thats correct. The device ID for it in the Actions is correct.

 

@Bodyart, @jgab - is there a QuickApp to view the variables i've setup, so i can see the current state - is there a file you can link me too like last time if there is?

Link to comment
Share on other sites

  • 0
31 minutes ago, theuksbest said:

@jgab Thanks, it's running and no errors so far so i'll monitor the behaviour and feedback. Thank you! Ow I've assumed i don't need to include my Lux sensor in the declarations, just my new binary sensor, hope thats correct. The device ID for it in the Actions is correct.

 

@Bodyart, @jgab - is there a QuickApp to view the variables i've setup, so i can see the current state - is there a file you can link me too like last time if there is?

IMHO you don't need a QA to see them... Just go to Settings -> General -> Variables to see them..

If you want to read or manipulate them, then you need some coding.

 

Enjoy coding :-D

 

Please login or register to see this attachment.

Edited by Bodyart
Link to comment
Share on other sites

  • 0

@jgab I don't think it's working for me, the lights do not come on. I have seen a few errors [12.07.2020] [07:07:32] [ERROR] [SCENE62]: (load):18: attempt to perform arithmetic on a boolean value. However i think that went away when i added the Lux sensor to the declaration.

 

anything obvious i'm doing wrong?

 

Declaration:

Please login or register to see this code.

 Action

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

The error on line 18 (boolean) means that your lux sensor returned true/false for it's value - that should not happen if you had the ID of a lux sensors - you mixed it up with the motion sensor?

Otherwise there were an 'end' in the wrong place that made the code not work too. Added som log statements too.

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

@jgab 

Quote

you mixed it up with the motion sensor

 

I think that's probable as i was setting it up, that error has gone away now it seems.

 

I pasted in the code, but lights still not coming on and i don't see any errors appearing (current Lux 124)

 

Did i have the Decelerations setup correctly?

Link to comment
Share on other sites

  • 0

Well, in the doc they don't explicitly say that we can use "anyValue" with booleans ?

I assume that 277 is your motion sensor? 

Please login or register to see this code.

You should not trigger on the lux sensor. The scene assumes that it's the motion sensor that have triggered it.

In case anyValue doesn't work for booleans try 

Please login or register to see this code.

 

Link to comment
Share on other sites

  • 0

@jgab - i'll try plugging that in now - also noticed this though, the new device (ID 277) seems like it was an hour (57 Minutes) ago that it tripped, where the main device tripped more accurately recently

 

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
1 minute ago, theuksbest said:

@jgab - i'll try plugging that in now - also noticed this though, the new device (ID 277) seems like it was an hour (57 Minutes) ago that it tripped, where the main device tripped more accurately recently

 

 

Please login or register to see this attachment.

Can you see in the log window if it's crashed? Mine been running for weeks now.

Sometimes the UI "hangs" for me and I have to reload to get the current icon rendering.

Link to comment
Share on other sites

  • 0

@jgab Not sure how to check the logs, is it the same as the debug screens?

 

I tried both actions above and doesn't seem to be triggering, i also refreshed the screen to make sure. It is counting up since the last detection but not re-detecting. It has been working so i don't know if i crashed it by using its ID in place of the Lux sensor by mistake.

 

how do i get it to restart, refresh, reload whichever it is? :)

 

Please login or register to see this attachment.

Link to comment
Share on other sites

  • 0
19 minutes ago, theuksbest said:

I tried both actions above and doesn't seem to be triggering, i also refreshed the screen to make sure. It is counting up since the last detection but not re-detecting. It has been working so i don't know if i crashed it by using its ID in place of the Lux sensor by mistake.

how do i get it to restart, refresh, reload whichever it is? :)

QAs restart themselves every minute if they crash.

So I just looked at my QA and the UI had got "stuck". No matter of reloading the web UI helped. However, it still triggered in the background. 

Can you try this version that prints out log statements when its beached/safe etc, 

Please login or register to see this attachment.

 Don't forget to set the quickAppVariables.

If the QA works then there is something with your scene and/or condition.

 

 

Link to comment
Share on other sites

  • 0

I tried this lua code, and it worked, though I tried associations in stead, and I cannot figure out why I shouldn't just use these?
Parameter 6 in the Fibaro Motion Sensor sets the timer for which the sensor will have to stay safe before "motion" is cancelled, this can also be utilized in LUA (no need for timer or even sleep)
Associating with a device (e.g. a Dimmer 2) in Group 2 (motion) will turn on the light on that dimmer, and turn it off again when the associated motion sensor did not discover motion with a period of time set in Parameter 6.
I also edited Parameter 3 to make it turn on instantly (first move), as I use it to turn on the light in our walk-in closet

  • Like 1
Link to comment
Share on other sites

  • 0
6 hours ago, BrianDS said:

I tried this lua code, and it worked, though I tried associations in stead, and I cannot figure out why I shouldn't just use these?
Parameter 6 in the Fibaro Motion Sensor sets the timer for which the sensor will have to stay safe before "motion" is cancelled, this can also be utilized in LUA (no need for timer or even sleep)
Associating with a device (e.g. a Dimmer 2) in Group 2 (motion) will turn on the light on that dimmer, and turn it off again when the associated motion sensor did not discover motion with a period of time set in Parameter 6.
I also edited Parameter 3 to make it turn on instantly (first move), as I use it to turn on the light in our walk-in closet

If associations works for you its best (even the box doesn't have to be on). It's only if you need a bit more flexibility in how to group sensors/lights.

Link to comment
Share on other sites

  • 0
15 hours ago, jgab said:

If associations works for you its best (even the box doesn't have to be on). It's only if you need a bit more flexibility in how to group sensors/lights.

Sure, if associations doesn't permit to add the needed flexibility, then the scenes in LUA are to be prefered, though I discovered a lot of settings directly at the sensor parameter to adjust in many given scenarios.

And I also recon that some times it would be easier to program it in LUA, even if it is possible in associations and parameters ;)

 

 

Link to comment
Share on other sites

  • 0

@BrianDS I use a mixture of scenes and associations. Associations work faster in my experience and have some failsafe but limited in functionality, especially with some sensors. The Fibaro sensors are pretty good compared to the Aeotec MS6 for example. 

 

I recommend setting Parameter 9 as well which determine night and day from the lux level - that way you can control when the lights turn on at least.

 

cool stuff.

Link to comment
Share on other sites

  • 0
12 hours ago, theuksbest said:

@BrianDS I use a mixture of scenes and associations. Associations work faster in my experience and have some failsafe but limited in functionality, especially with some sensors. The Fibaro sensors are pretty good compared to the Aeotec MS6 for example. 

 

I recommend setting Parameter 9 as well which determine night and day from the lux level - that way you can control when the lights turn on at least.

 

cool stuff.


I agree - though most simple applications can be solved by associations - I didn't set the lux level, as it is in a walk-in closet without windows - meaning, we would almost always want the lights to turn on anyway.

Only problem I have is that I get push notifications from the motion sensor several times a day, telling motion is detected, even though no one is in the room, and it didn't trigger to turn on the light - I have turned off the push notifications, and I know it is false motion alerts, due to the facts stated above - I still haven't solved that issue, but I have close to 100 notifications in 2-3 days.

 

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...