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
Search the Community
Showing results for tags 'day'.
-
Hallo i need write into one scene more variables, how make this? For example scene for change Time Of Day (Morning, Day, Evening, Night) i need write - for every day when is 05:00 am than "TimeOfDay" = "Morning", when is 08:00 am than "TimeOfDay" = "Day", when is 17:00 than "TimeOfDay" = "Evening" and last when is 22:00 than "TimeOfDay" = "Night" yes it's easy to make 4 scenes for each command separately, but how write into one scene all 4 variables scenes? i have first -- Scene for Morning -- --[[ %% autostart %% properties %% weather %% events %% globals --]] local sourceTrigger = fibaro:getSourceTrigger(); function tempFunc() local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "05:00") ) ) then fibaro:setGlobal("TimeOfDay", "Morning"); end setTimeout(tempFunc, 60*1000) end if (sourceTrigger["type"] == "autostart") then tempFunc() else local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( startSource["type"] == "other" ) then fibaro:setGlobal("TimeOfDay", "Morning"); end end Thank you
-
I am trying to create a day/night setup via lua. Where at 8 am-10pm the variable is set to day and at 10pm-8am the variable is set to night. I cannot successfully do this via a block scene so i have used LUA to do this. Could someone help me look over my code to see if this is correct as i am fairly new in LUA. Thanks! --[[ %% autostart %% properties %% globals --]] -- Only need to call getSourceTrigger once -- For better debugging, I moved it to the top, -- before countScenes local sourceTrigger = fibaro:getSourceTrigger() fibaro:debug("Script started because of: " .. sourceTrigger["type"]) if fibaro:countScenes()>1 then fibaro:debug("Scene already running, aborting this one") fibaro:abort() end if (sourceTrigger["type"] == "autostart") then while true do local currentDate = os.date("*t") -- Do the time-string manipulation thingy here, instead of in -- each and every if-then statement -- %02u means unsigned int, 2 wide, leading zero TimeAsString = string.format("%02u",currentDate.hour).. ":" .. string.format("%02u", currentDate.min) fibaro:debug("TimeAsString: ".. TimeAsString) Day_night = fibaro:getGlobalValue("Day_night") fibaro:debug("Day_night: " .. Day_night) if ( currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7 ) and TimeAsString == "8:00" then fibaro:debug("Setting scenario number 1") fibaro:setGlobal("Day_night", "Day") elseif ( currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7 ) and TimeAsString == "22:00" then fibaro:debug("Setting scenario number 2") fibaro:setGlobal("Day_night", "Night") else fibaro:debug("Current time doesn't match any scenario") end end fibaro:debug("Scene not started, this is autostart-only!") end -- end of sourceTrigger["type"] == "autostart"
-
Yet another script for sunrise and sunset and more....
Franz posted a question in Scenes and Interface
NightAndDay is a LUA script to set two global variables at sunrise and sunset and at sunrise + a sunrise offset and at sunset + a sunset offset. You can choose the name of the global variables to set. Default are itIsNight and itIsNightOne. You can define two different offset values (between -7200 and 7200 seconds) for both sunrise and sunset, sunrisetime_offset and sunsettime_offset. itIsNight will switch from 1 to 0 at sunrisetime and from 0 to 1 at sunsettime. itIsNightOne will switch from 1 to 0 at sunrisetime+sunrisetime_offset and from 0 to 1 at sunsettime+sunsettime_offset. At this link you can donwload the script (zip file) and the documentation (PDF): http://domotica.gposta.it -
I have a Home center Lite. My motion sensor to turn on my lights if it is between a certain lux in the room and if motion it detected. I have it set to not turn on the lights if it detects 0 lux in the room. This can be good for sleeping but what if it gets dark at 6pm with 0 lux in the room but I'm not ready for bed and want the lights to trigger with motion. Does anyone know of a solution to only run my scene i created between a certain range of times during the day? thanks for the help