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


  • 0

Time depending pre-set dim levels


Patrick

Question

All,

 

I want to share, what looks like a simple usecase BUT still very complex to build or find the right settings within the (fibaro) Dimmer2 or in combination with a scene.

Used (involved) Components: 1x Dimmer2 (FGD212), 1X Lamp, 1X HC2 (v4110)

 

Description of the use case:

When I turn on the light (manually) after SunSet the dimmer is set to 20% else will be 80% or a double-click will set the light to 100%. (last part is simple as this is a functionality is within the dimmer it self) 

(I do not want a bright light when I go to the loo in the middel of the night)

 

Interested in any suggestions :)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

The topic has been moved from "

Please login or register to see this link.

" to "

Please login or register to see this link.

".

 

Temat został przeniesiony z "

Please login or register to see this link.

" do "

Please login or register to see this link.

".

Link to comment
Share on other sites

  • 0

I have been looking into this also, I'm using a HCL, from what i can gather if you create a time based scene to change the value of a variable Ie evening to nighttime, and have that as a condition in the scene i.e. motion on top hall and variable = nighttime then turn on dimmer to 20%. 

 

Then i would have another scene the same as above but changing one of the conditions to evening and then have that turn the dimmer to 80%

 

I will be sitting down very soon to get mine working, but i am holding off spending too much time on my HCL because i'm waiting to upgrade to HC2 ideally at the end of this month if eBay works in my favour. 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Use-case:

     This scripts sets 4 different values (morning, day, evening, night) dimming levels, but it still allows you to use the double-click and manual dimmer functions.

     

    notes:

    1) You (unfortunately) need a global var in this example it is "Bathroomligh"

    2) I have notices this script woks better (more smooth) with a Dimmer FGD211 then the dimmer2 (FGD-212)

    Script:

     

    -[[
    %% autostart
    %% properties
    371 value
    %% events
    %% globals
    --]]

    -- HPvdD - 20170311 - v1.2

    local lightID1  = 371;     -- change this to the id of your light (dimmer only) (mirror lights)

    -- Set light dimm values for:

    local morninglightvalue = 28      -- Period 1
    local daylightvalue = 55          -- Period 2
    local eveninglightvalue = 32    -- Period 3
    local nightlightvalue = 8       -- Period 4

     

    local BeforeSunRise = 60         -- time (min) before sunrise
    local AfterSunRise = 45          -- time (min) after sunrise
    local AfterSunSet = 30           -- time (min) after sunset
    local EveningEnd = "23:30"

     

    local currentDate = os.date("*t");
    local CurrentTime = os.date("%H:%M", os.time())
    local startSource = fibaro:getSourceTrigger()
    local sunriseHour = fibaro:getValue(1,'sunriseHour')
    local sunsetHour = fibaro:getValue(1,'sunsetHour')

    local debug = true

    -- check script instanyce count in memory
    if (tonumber(fibaro:countScenes()) > 1) then
        if debug then fibaro:debug("Script already running."); end
    end

    --- Status: Period
    if (os.date("%H:%M", os.time()+BeforeSunRise*60) >= sunriseHour and os.date("%H:%M", os.time()-AfterSunRise*60) <= sunriseHour) then
        Period = 1 -- morning (x before sunrise TILL x after Sunrise)  
      elseif (os.date("%H:%M", os.time()-AfterSunRise*60) > sunriseHour and os.date("%H:%M", os.time()+AfterSunSet*60) <= sunsetHour and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) < EveningEnd and os.date("%H:%M", os.time()+BeforeSunRise*60) >= sunriseHour ) then
        Period = 2 -- day (x after Sunrise TILL x before SunSet
      elseif (os.date("%H:%M", os.time()+AfterSunSet*60) > sunsetHour and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) <= EveningEnd ) then
        Period = 3 -- evening (x before sunset TILL EveningEnd = "23:30")
      else 
        Period = 4 -- night (from: EveningEnd = "23:30" TILL x before sunrise)
    end    
    if debug then fibaro:debug("Status sunriseHour: (+) AfterSunRise: " .. sunriseHour .. " + " .. AfterSunRise .." min") end
    if debug then fibaro:debug("Status sunriseHour: (-) BeforeSunRise " .. sunriseHour .. " - " .. BeforeSunRise .." min") end
    if debug then fibaro:debug("Status sunsetHour: (+) AfterSunSet " .. sunsetHour .. " + " .. AfterSunSet .." min") end
    if debug then fibaro:debug("Status Period : ".. Period ) end

    -- Define trigger    
    local source = fibaro:getSourceTrigger();    
    if (source['type'] == 'property') then    
        trigger = source['deviceID']
          if debug then fibaro:debug("trigger-property " .. trigger) end 
    elseif (source['type'] == 'global') then    
          trigger = source['name']    
        if debug then fibaro:debug("trigger-global " .. trigger) end 
    elseif (source['type'] == 'other') then    
          trigger = "Other"    
        if debug then fibaro:debug("trigger-global " .. trigger) end 
    end

    -- Execute script
    if (trigger == lightID1) then
      if debug then fibaro:debug('Trigger'); end
      fibaro:sleep(200)
      if tonumber(fibaro:getValue(lightID1, "value")) >= 1 then
        if fibaro:getGlobal("Bathroomlight") == "0" then 
          if (Period == 1) then -- morning (x before sunrise TILL x after Sunrise) 
            fibaro:call(lightID1, "setValue", morninglightvalue);
            fibaro:setGlobal("Bathroomlight", "1") 
          end
          if (Period == 2) then -- day (x after Sunrise Till x before Sunset)
            fibaro:call(lightID1, "setValue", daylightvalue);
            fibaro:setGlobal("Bathroomlight", "1") 
          end
          if (Period == 3) then -- evening (x before sunset TILL EveningEnd = "23:30")
            fibaro:call(lightID1, "setValue", eveninglightvalue);
            fibaro:setGlobal("Bathroomlight", "1") 
          end     
          if (Period == 4) then -- night (from: EveningEnd = "23:30" TILL x before sunrise)
            fibaro:call(lightID1, "setValue", nightlightvalue);
            fibaro:setGlobal("Bathroomlight", "1") 
          end      
        end      
      else
        fibaro:setGlobal("Bathroomlight", "0")
      end  
    end  

    if debug then fibaro:debug("Value lightID1: " .. (fibaro:getValue(lightID1, "value")) .." %" ) end  
    if debug then fibaro:debug("Status var Bathroomlight END: " ..  fibaro:getGlobal("Bathroomlight")) end

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