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


  • 1

Use a scene to disable a scene and/or device?


macz3000

Question

Hello,

 

At the moment, I have a basic scene that turns a light on when a sensor sees motion, then turns off when the sensor has seen no motion for 5 minutes. No problem.

 

What I need is; if the lights turn on and I don't want them on, I hit the light switch on the wall, the lights turn off and they remain off for 5 minutes. Currently when I hit the switch, the lights turn off but the motion sensor picks me up and turns them straight back on again.

So I'm wondering if I can have a scene that says something along the lines of, "If the lights are on, and Switch 1 Key is pressed, then turn off lights, and..." either disable the scene that uses the motion sensor to turn on the lights for 5 minutes, or disable the lights from being able to be turned on for 5 minutes.

 

I've also thought about trying to use variables but so far am struggling to figure out what feels like should be a simple solution.

 

Any help would be appreciated!

Thanks

  • Like 1
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

There is no way to identify if the switch has been turn OFF manually or by the scene. You have two options to do what you need:

1. Use global variable

2. This is the funny option that I did... turn switch quickly off -> on-> off manually. In the scene you can identify  this action by getting switch state modified time.

 

May I suggest to download All-in-One Scene. It could be done quite  easily.

Link to comment
Share on other sites

  • 0

Yes, you save the last time the switch was flicked by scene/code and use that to compare with the last modified time to see if it was manual.

(there are fringe cases where the scene and a person flicks the switch within the same second and you can't tell, that is a problem with double flicks too...)

In pseudo code it looks something like

 

-- lastSwitchedByScene global/var initialised to 0

if sensor breached then

    if (modified(switch) == lastSwitchedByScene) or ((now - modified(switch)) > 5min) then

           turn on switch

           lastSwitchedByScene = now

    end

end

 

This assumes that no other scene is changing the switch (without updating the global/var)

This is such a common case that in my ER framework I track how long time since it was manually changed in a

':manual' property per device (and I guess that AOS could do something similar?) and can thus write very compact rules like

Please login or register to see this code.

':manual' returns 0 if the sensor was last changed by the scene, else it returns time since last modified manually (actually, it returns a negative value if changed by scene because sometimes that time is useful to know)

However, in practice, rules of this type tends to be more complex as I don't want the light to turn on if I move around in the room for longer than 5min and the sensor happens to be safe and breached under that time.

This means also tracking that the sensor should have been safe for a specified time before before being allowed to turn on the light again.

The rule above is easy to complement with a rule turning off the switch after sensor being safe for Xmin.

 

note. In practice one can’t test for equality here “modified(switch) == lastSwitchedByScene”. Must allow  for a small margin, like “abs(modified(switch) - lastSwitchedByScene)<=1”

Edited by jgab
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...