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


Search the Community

Showing results for tags 'Please i need some help'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 1 result

  1. Hi all, I have problems with the script below. Can anyone say what is going wrong? I have debug message added at the bottom. Thanks You. Thanks to MSB for the script --[[ %% autostart %% properties %% globals ActivityProjector ActivityTV LastSeenHans LastSeenChrista TV Projector Home Night --]] --kill any extra instances of the same scene if (fibaro:countScenes() > 1) then fibaro:abort() end; --Loop while true do --Settings local ExecuteTimer = 60; -- Execute Every N-th second local GlobalVariablesDevice = 174; -- ID of helperdevice for GlobalVars! local AbsenceTime = 10; -- 10 minutes local SunriseTime = 30; -- 30 minutes after sunrise local SunsetTime = 30; -- 30 minutes before sunrise local UserInactivity = 10; -- 10 minutes delay after switchoff --Setup local variables local CurrentDate = os.date("*t"); --Announce start fibaro:debug(" -|- Start: "..os.date("%Y-%m-%d %H:%M:%S",os.time())) -- LastSeenHans,Christa fibaro:call(GlobalVariablesDevice, "pressButton", "11"); -- Check if Hans is at Home fibaro:call(GlobalVariablesDevice, "pressButton", "12"); -- Check if Christa is at Home local LastSeenHenrik = fibaro:getGlobalValue("LastSeenHans"); local LastSeenJennie = fibaro:getGlobalValue("LastSeenChrista"); fibaro:debug(" -|- LastSeenHans: "..os.date("%Y-%m-%d %H:%M:%S",LastSeenHans)); fibaro:debug(" -|- LastSeenChrista: "..os.date("%Y-%m-%d %H:%M:%S",LastSeenChrista)); -- Home, anyone ? AbsenceTime = os.time() - (AbsenceTime * 60); fibaro:debug(" -|- AbsenceTime: "..os.date("%Y-%m-%d %H:%M:%S",AbsenceTime)); if tonumber(LastSeenHans) < AbsenceTime and tonumber(LastSeenChrista) < AbsenceTime then fibaro:debug(" -|- Home: Noone is Home!"); if tonumber(fibaro:getGlobalValue("Home")) == 1 then fibaro:setGlobal("Home", 0); end else fibaro:debug(" -|- Home: Someone is at home!"); if tonumber(fibaro:getGlobalValue("Home")) == 0 then fibaro:setGlobal("Home", 1); end end -- SunriseTime SunriseHour = os.time{year=CurrentDate.year, month=CurrentDate.month, day=CurrentDate.day, hour=string.sub(fibaro:getValue(1, 'sunriseHour'), 1 , 2), min=string.sub(fibaro:getValue(1, 'sunriseHour'), 4)}+SunriseTime*60; fibaro:debug(" -|- SunriseTime: "..os.date("%Y-%m-%d %H:%M:%S",SunriseHour)); -- SunsetTime SunsetHour = os.time{year=CurrentDate.year, month=CurrentDate.month, day=CurrentDate.day, hour=string.sub(fibaro:getValue(1, 'sunsetHour'), 1 , 2), min=string.sub(fibaro:getValue(1, 'sunsetHour'), 4)}-SunsetTime*60; fibaro:debug(" -|- SunsetTime: "..os.date("%Y-%m-%d %H:%M:%S",SunsetHour)); -- Night or day? if (os.time() > SunsetHour or os.time() < SunriseHour) then fibaro:debug(" -|- Night: It's night!"); if tonumber(fibaro:getGlobalValue("Night")) == 0 then fibaro:setGlobal("Night", 1); end else fibaro:debug(" -|- Night: It's day!"); if tonumber(fibaro:getGlobalValue("Night")) == 1 then fibaro:setGlobal("Night", 0); end end -- TV running? if tonumber(fibaro:getValue(19, "valueSensor")) > 10 then fibaro:debug("-|- TV: TV is ON"); fibaro:setGlobal("ActivityTV", os.time()); if tonumber(fibaro:getGlobalValue("TV")) == 0 then fibaro:setGlobal("TV", 1); end elseif (os.time()-(60*UserInactivity)) > tonumber(fibaro:getGlobalValue("ActivityTV")) then fibaro:debug("-|- TV: TV is OFF"); if tonumber(fibaro:getGlobalValue("TV")) == 1 then fibaro:setGlobal("TV", 0); end else fibaro:debug("-|- TV: TV is Undetermined"); end -- Projector running? if tonumber(fibaro:getValue(19, "valueSensor")) > 10 then fibaro:debug("-|- Projector: Projector is ON"); fibaro:setGlobal("ActivityProjector", os.time()); if tonumber(fibaro:getGlobalValue("Projector")) == 0 then fibaro:setGlobal("Projector", 1); end elseif (os.time()-(60*UserInactivity)) > tonumber(fibaro:getGlobalValue("ActivityProjector")) then fibaro:debug("-|- Projector: Projector is OFF"); if tonumber(fibaro:getGlobalValue("Projector")) == 1 then fibaro:setGlobal("Projector", 0); end else fibaro:debug("-|- Projector: Projector is Undetermined"); end --Announce end fibaro:debug(" -|- End: "..os.date("%Y-%m-%d %H:%M:%S",os.time())) --Sleep XX seconds fibaro:sleep(ExecuteTimer*1000); end [DEBUG] 18:20:41: -|- Start: 2015-03-21 18:20:41 [DEBUG] 18:20:41: -|- LastSeenHans: 2015-03-21 18:20:41 [DEBUG] 18:20:41: -|- LastSeenChrista: 2015-03-21 18:20:41 [DEBUG] 18:20:41: -|- AbsenceTime: 2015-03-21 18:10:41 [ERROR] 18:20:41: line 46: attempt to compare nil with number
×
×
  • Create New...