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 'bank holidays'.

  • 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. Sorry, this is mostly useful for Swedish users. Simple QA that sets a variable if it's a working day or not (i.e. bank holidays). Uses the api from dryg.net. Good to have to control some automation - avoid turning on the lamps too early on a non-working day... Helgdagar-2.fqa Code example with creating global variables and an update loop that runs every midnight and survives daylight savings.... version = "v0.1" local format = string.format local function getDay() local t=os.date("*t") net.HTTPClient():request( "https://api.dryg.net/dagar/v2.1/"..format("%s/%d/%d",t.year,t.month,t.day),{ options= { headers={['Content-type']='application/json; charset=utf-8'}, method="GET" }, error=function(err) print(err) end, success=function(status) local data = json.decode(status.data) local dag = data.dagar[1] QA:updateView("version","text","Helgdagar "..version..", "..dag.datum) QA:updateView("arbetsfri","text","Arbetsfri dag: "..dag["arbetsfri dag"]) QA:updateView("flagga","text","Flaggdag: "..dag.flaggdag) QA:updateView("namnsdag","text","Namnsdag: "..table.concat(dag.namnsdag,",")) QA:setVariable("Arbetsfri",dag["arbetsfri dag"]) QA:setVariable("Flaggdag",dag.flaggdag) QA:setVariable("Namnsdag",table.concat(dag.namnsdag,",")) QA:trace("Today is ",dag.datum) end, } ) end local function createVar(name,deflt) local v = api.get("/globalVariable/"..name) if v==nil then api.post("/globalVariables",{name=name,value=deflt}) end end function QuickApp:onInit() QA = self self:debug("Helgdagar",version) createVar("Namnsdag","") createVar("Flaggdag","") createVar("Arbetsfri","Nej") local function loop() getDay() local t = os.date("*t") -- allow us to get in sync if we pass daylight saving.... t.sec,t.min,t.hour=0 local time=os.time(t) time=time+24*60*60 -- Next day setTimeout(loop,1000*(time-os.time())) end loop() end Variables set: "Namnsdag" - Name(s) of the day "Flaggdag" - if flag dat - reason for flagging "Arbetsfri" - "Ja"/"Nej"
×
×
  • Create New...