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 'group of lights'.

  • 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, I was tidying up my light scenes where I turn on of off batches of lights (at night, going away, etc) and I wanted something simpler and more reliable. I created a very simple scene that stores the light ID's (or HomeTable references, as I have) in a table and you pass the action (turnOn or tunrOff) in the startScene call so no need to use a global variable The scene code is not really mean to be a solution like Smart message Hub but more of a case of sharing what I put together. It a small amount of error handling and warnings should ID's be incorrect and should be easy enough to pick through as a learningexercise The scene call is simple -- turn off group of lights fibaro:startScene(jT.scene.upLights, {"turnOff"}) -- using a hometable reference -- or fibaro:startScene(694, {"turnOff"}) -- using a scene ID -- turn on group of lights fibaro:startScene(jT.scene.upLights, {"turnOn"}) -- using a hometable reference -- or fibaro:startScene(694, {"turnOn"}) -- using a scene ID I included just two options deBug : set to true to see lights as they are checked delay : this will set a sleep or delay between each light if you find that switching them off too fast is causing some to be missed Comment out the reference to HomeTable (line 10) is you don't use this method Scene Code is below --[[ %% properties %% events %% globals --]] local deBug = true local delay = "" local jT = json.decode(fibaro:getGlobalValue("HomeTable")) upLights = { jT.frank_bedroom.Light, jT.lau_eth_bedroom.Light, jT.master_bedroom.Light, jT.master_bedroom.LEDLight, jT.guest_bedroom.Light, jT.master_bedroom.BathLight, jT.guest_bedroom.BathLight, jT.bathroom.Light, jT.Landing_Stairs.landingLight, jT.Landing_Stairs.stairsLight, jT.hotpress.Light } function main() if fibaro:args() == nil then fibaro:debug("Warning: No action included in Scene call, scene aborted") return else local args = fibaro:args() for k,v in pairs(upLights) do if deBug then fibaro:debug("checking light.. "..v) end if fibaro:getValue(v, "value") == nil then fibaro:debug("Warning: "..v.." (table position: "..k..") is an invalid reference, Stopping Scene") return end if args[1] == "turnOff" and tonumber(fibaro:getValue(v, "value")) >= 1 then if deBug then fibaro:debug(v.." : "..args[1]) end fibaro:call(v, args[1]) end if args[1] == "turnOn" and tonumber(fibaro:getValue(v, "value")) == 0 then if deBug then fibaro:debug(v.." : "..args[1]) end fibaro:call(v, args[1]) end if delay ~= "" then fibaro:sleep(delay) end end end end main() PS - This approach could easily be expanded to store a number of groups (table) of lights in the the scene and pass 2 parameters in the startScene call, one parameter could be used to decide which group of lights and the second could be used to selection the action (turnOn, turnOn) Enjoy - Happy Coding -f
×
×
  • Create New...