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 'vd lua'.

  • 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 2 results

  1. This is a Quickapp script for HC3. I am trying to get this to work in a VD on HC2. Is it possible, or do I have to do it together with a scene to make it work? Can anyone help? function QuickApp:onInit() self:updateProperty("unit", "kr/kWh") self.refresh = 60 -- in seconds local function loop() self:webrequest(); setTimeout(loop,self.refresh * 1000) end if self.username ~= "changeme" then loop() end end function QuickApp:webrequest() local tid = os.date("%R") local minutt = os.date("%M") --OPPDATERER STRØMPRIS OG SNITT HVER TIME if (minutt == "00") then self:OppdaterPris(); self:OppdaterSnitt(); end end function QuickApp:OppdaterPris() --Opprette lokale variable local GammelStrompris = fibaro.get(126,"value") local NyStrompris --Definerer http local http = net.HTTPClient(); --Definerer strengen Payload til å være kommando til tibber local payload = '{"query": "{viewer {homes {currentSubscription{priceInfo{current{total}}}}}}", "variables": null, "operationName": null}'; --API.POST til Tibber-- http : request('https://api.tibber.com/v1-beta/gql', { options = { method = "POST", headers = { ['Authorization'] = '.........', --Min Tibber ID her. ['Content-Type'] = 'application/json' }, data = payload -- Query. }, success = function(response) --fibaro.debug (response.data) --Verifiser at en har fått response.data. Dette er data som en har fått fra Tibber local data = json.decode(response.data); --fjernet local under??? NyStrompris = json.encode(data.data.viewer.homes[1].currentSubscription.priceInfo.current.total); self:updateProperty("value", tonumber(NyStrompris)) --print("OK") end, error = function(err) fibaro.debug ("Error:" .. err) end }); end function QuickApp:OppdaterSnitt() --Definerer http local http = net.HTTPClient(); --Definerer strengen average til å være kommando til tibber local average = '{"query": "{viewer {homes {currentSubscription{priceRating{daily{entries{total}}}}}}}", "variables": null, "operationName": null}'; --API.POST Til Tibber http : request ('https://api.tibber.com/v1-beta/gql', { options = { method = "POST", headers = { ['Authorization'] = '...............', --Min Tibber ID her. ['Content-Type'] = 'application/json' }, data = average -- Query }, success = function(response) --fibaro.debug(response.data) --Verifiser at en har fått response.data. Dette er data som en har fått fra Tibber local data = json.decode(response.data); local Nypris = tostring(json.encode(data.data.viewer.homes[1].currentSubscription.priceRating.daily.entries[31].total)); self:updateProperty("log", tostring(Nypris)) end, } ) end
  2. Hi, I searched the forum and some other lua references and couldn't find how to do this. I have a very simple VD that reads several temperatures and displays them in a number of VD labels thisId = fibaro:getSelfId(); fibaro:call(thisId, "setProperty", "ui.temp1.value", fibaro:getValue(871, "value")); I am looking to round/truncate the value displayed to 2 decimal places Currently it is displaying 9 or 10 any help and tips appreciated Thanks -F
×
×
  • Create New...