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

  • 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. CANCEL THIS - I SOLVED IT WITH A VD USING THE MAIN LOOP Hi, This is prob not a huge mystery and something basic I'm missing. If I remove the While true do loop from the code below and execute it manually it works okay but once I add the while loop to get it check all the time the scene doesn't run Could somebody take a look and tell me where I'm being stupid Thanks -F --[[ %% autostart %% properties %% events %% globals --]] -- Configuration - Scene Info sceneName = "Sonos State tracker" sceneVersion = "1.0.1" -- Scene Description -- Track and stores the state of three of the sonos -- zones so the respective amp can be switched on -- Configuration - Device IDs -- none for this scene -- Validate Number of Scene Instance if (fibaro:countScenes()>1) then --fibaro:debug("stop scene") fibaro:abort() end -- read playroom state function StateFunc() while true do fibaro:sleep(2000) -- execute this every 2 seconds if fibaro:getGlobal("G_SPC_AREA_STATUS_1") == "UNSET" then -- don't check if we are not at home http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Playroom/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zPRState = responds.zoneState fibaro:debug(zPRState) fibaro:setGlobal("Sonos_PRState", zPRState); end end, }) -- read living room state http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Living_Room/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zLRState = responds.zoneState fibaro:debug(zLRState) fibaro:setGlobal("Sonos_LRState", zLRState); end end, }) -- read dining room state http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Dining_Room/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zDRState = responds.zoneState fibaro:debug(zDRState) fibaro:setGlobal("Sonos_DRState", zDRState); end end, }) end -- end if statement end -- end while loop end -- end function -- Main Scene execution code StateFunc()
×
×
  • Create New...