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


Recommended Posts

Posted

Im trying to use a the wall switch to override my sensor scene 

I've got a scene running that if the sensor is breached the light will turn on and then turn off after a period of time.

I would like to use the wall switch to override the scene to stop the light from turning off

The problem is the sensor picks you up before you can switch the light on so wrighting a condition that the light must be off before the scene can run doesn't work 

Is there any way to make this work?

Posted
18 hours ago, Hlloyd said:

Im trying to use a the wall switch to override my sensor scene 

I've got a scene running that if the sensor is breached the light will turn on and then turn off after a period of time.

I would like to use the wall switch to override the scene to stop the light from turning off

The problem is the sensor picks you up before you can switch the light on so wrighting a condition that the light must be off before the scene can run doesn't work 

Is there any way to make this work?

Can you do something with this scene?

 

--[[
%% autostart
%% properties
896 value
%% globals
--]]

-- Autolights created by Trash of Poland on 01-2016
-- Altered by TRicky on 02-2017
-- Motion sensor turns the light on for 2 minutes.
-- Any movement while light(s) on sets the counter back to 2 minutes.
-- No movement during 2 minutes shuts down the light(s).

local Counter = 1;              -- Counter
local TimeLightOn = 2*60;       -- Time to keep the Light(s) On. Change to you like.
local TimeLastMotion;           -- Time when last motion sensored
local MotionSensorID = 896;     -- Motion Sensor
local ControlledLightID = 2205;  -- Controlled Light(s)
local Dimlevel;                 -- Actual dimming level, depending on the TimeOfDay
local DimLevelZero = 0;         -- Putting the light(s) out; dimmed to 0%
local DimLevelLow = 20;         -- Light(s) dimmed to 20%
local DimLevelHigh = 60;        -- Light(s) dimmed to 60%
local DayTime = fibaro:getGlobalValue("TimeOfDay");  -- Global Variable
local startSource = fibaro:getSourceTrigger();

function AutoLight() 
  local CurrentTime = os.time();
  TimeLastMotion = fibaro:getModificationTime(MotionSensorID, "value");

  fibaro:debug("Light Counter: " .. Counter);
  Counter=Counter+1;

  fibaro:debug("Time since last detected movement: " .. CurrentTime - TimeLastMotion .. " seconds.");
  
  if ( (CurrentTime - TimeLastMotion) <= TimeLightOn ) then 
    setTimeout(AutoLight, 10000);
  else
    fibaro:call(ControlledLightID, "setValue", DimLevelZero);
    fibaro:debug('Ending Scene Light(s) Hal Midden');
    fibaro:debug('Putting light(s) out at '.. DimLevelZero ..'%');
  end
end

fibaro:debug('Starting Scene Lights Hal Midden');

if ( fibaro.countScenes() == 1 ) then
  if ( ( tonumber(fibaro:getValue(MotionSensorID, "value")) > 0 ) or startSource["type"] == "other" )
    then
      if (DayTime=="Dawn" or DayTime=="Night" or DayTime=="Dusk") then DimLevel = DimLevelLow
      elseif (DayTime=="Evening") then DimLevel = DimLevelHigh
      else 
        fibaro:debug("Motion detected but scene aborted because it's " ..DayTime)
        fibaro:abort ();
      end

      fibaro:call(ControlledLightID, "setValue", DimLevel);
      fibaro:debug("Light(s) On, Current Dim Level is: "..DimLevel.."%");
      AutoLight();
    end
else
  fibaro:debug("Current amount of running scene’s: " .. fibaro.countScenes());  
end
 

Join the conversation

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

Guest
Reply to this topic...

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