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


  • 0

Maximum temperate expected outside


Question

Posted (edited)

I would like to safe the maximum expected outdoor temperature for today and save this in a global variable. How is this possible with LUA?

Edited by bowsertje

Recommended Posts

  • 0
Posted

To use a variable in Lua we must declare it:

 

local myValue
myValue=20

 

Here you can find how to start with Lua: 

Please login or register to see this link.

Here you can find some examples of Lua scenes - maybe something will be useful for you: 

Please login or register to see this link.

 

 

 

  • 0
Posted

@bowsertje IMHO safe == save

  • Like 1
  • 0
  • Inquirer
  • Posted

    Thanks but how can I get the value for the max. expected outdoor temperature today. How to integrate this with LUA will not be a problem.

    • 0
    Posted (edited)

    Your word “expected” means what you should get forecast. Because you can’t get expected maximum aloe from your sensors.

    so, you should call some weather forecast API for your location get from result max temperature forecast and call something like

    fibaro:setGlobal(“MaxTempFC, value);

    How to get weather forecast it’s not easy and I can’t provide ready for use solution right now. For example goggling by forum and find some LUA scenes for WFC for OpenWeatherMap or YR.NO (some examples has in my profile)

    Edited by 10der
    • 0
  • Inquirer
  • Posted

    You're right.

    There is a connection with yr.no in Fibaro, right? Any chance there is something possible for receive the max temp. forecast from yr.no ?

    • 0
    Posted

    No native methods. Fibaro hasn’t native methods for getting others parameters - only current temp current hum and current wind.

    so find in my profile script for yo.no 

    or I can will  provide last script here after I will reach my PC. I am outside home right now, sorry.

    please ping me after ~2h

    • 0
  • Inquirer
  • Posted
    4 hours ago, 10der said:

    No native methods. Fibaro hasn’t native methods for getting others parameters - only current temp current hum and current wind.

    so find in my profile script for yo.no 

    or I can will  provide last script here after I will reach my PC. I am outside home right now, sorry.

    please ping me after ~2h


    Where can I find this script?

    • 0
    Posted

    I am still on the my way 

    sorry

    • 0
    Posted (edited)

    here is weather grabber for yr.no

    Please login or register to see this code.

     

    Please login or register to see this spoiler.

     

    so. after calling in met_no global var you will have full weather forecat for your city

    you may call this script every 1h for example

     

    next step parse response:

     

    Please login or register to see this code.

    result

    Please login or register to see this attachment.

     

    last script yoy can run at morning,

     

    Edited by 10der
    • 0
    Posted
    22 hours ago, bowsertje said:

    I would like to safe the maximum expected outdoor temperature for today and save this in a global variable. How is this possible with LUA?

    Hey @bowsertje,

    How are you using the expected max. temperature? What for and what is your usecase?

     

    • Like 1
    • 0
  • Inquirer
  • Posted
    56 minutes ago, Bodyart said:

    Hey @bowsertje,

    How are you using the expected max. temperature? What for and what is your usecase?

     

    I would like to not open my blinds at one side of my house when the expected max. temperture is above xx degrees.

     

     

    1 hour ago, 10der said:

    here is weather grabber for yr.no

    Please login or register to see this code.

     

    Please login or register to see this spoiler.

     

    Can you help me how to get this working? Do I put both scripts into Fibaro as a scene or VD ?

    • 0
    Posted
    2 minutes ago, bowsertje said:

    I would like to not open my blinds at one side of my house when the expected max. temperture is above xx degrees.

    Yes, i see... But ofcourse you can do that more adequately with outside temperature sensor. Or based on lumination (amount of LUX) and the temperature according to your decission rules :-)

    Enjoy automation :-D

    BTW the code of @10der is a fibaro scene :-)

    • 0
    Posted

    1st script MUST be as scene and schedule this script for run every 1h

     

    you can use weather FC data for future for any own puposes

     

    2nd script is not complete. 

    1) create global var

    2) replace code with 

    Please login or register to see this code.

    by

    Please login or register to see this code.

    and schedule this script for run at 9Am for example

     

    how to scehdule scenes?

    IMHO easy way use TimeBased script by @Sankotronic

    here i can't help you. I am also use this script from Sank. it's easy and simple as for me

     

    UPDATE (11 July 2019)

    • Like 1
    • 0
  • Inquirer
  • Posted
    7 minutes ago, Bodyart said:

    Yes, i see... But ofcourse you can do that more adequately with outside temperature sensor. Or based on lumination (amount of LUX) and the temperature according to your decission rules :-)

    Enjoy automation :-D

    BTW the code of @10der is a fibaro scene :-)

    Well, the thing is...I want to prevent my house from heating up BEFORE it is getting hot.

     

     

    3 minutes ago, 10der said:

    1st script MUST be as scene and schedule this script for run every 1h

     

    you can use weather FC data for future for any own puposes

      

    2nd script is not complete. 

    1) create global var

    2) replace code with 

    Please login or register to see this code.

    by

    Please login or register to see this code.

    and schedule this script for run at 9Am for example

     

    how to scehdule scenes?

    IMHO easy way use TimeBased script by @Sankotronic

    here i can't help you. I am also use this script from Sank. it's easy and simple as for me


    Thanks, I did create 2 scene's with the scripts in them.

    Created global var and replaced code in 2nd script.

     

    I did run the first script but do get this error:

     

    Please login or register to see this code.

     

    • Like 1
    • 0
    Posted
    1 minute ago, bowsertje said:

    Well, the thing is...I want to prevent my house from heating up BEFORE it is getting hot.

    Thank you @bowsertje, inspiring idea! Maybe i'll implement something like that now we have hot days and nights in Netherlands :-D

     

    • Like 1
    • 0
    Posted
    9 minutes ago, bowsertje said:

    [DEBUG] 22:19:27: 2019-07-25 22:19:27.204217 [ fatal] Unknown exception: /opt/fibaro/scenes/100.lua:139: attempt to index field 'meta' (a nil value)

    it's bery strange.

     

    can you check

    1) are you have debug message 

    Updating weather from site...

     

    Update weather from site: done

    2) autocreated global var 

    Please login or register to see this image.

    • 0
  • Inquirer
  • Posted (edited)
    3 minutes ago, 10der said:

    it's bery strange.

     

    can you check

    1) are you have debug message 

    Updating weather from site...

     

    Update weather from site: done

     

    I did past the first script into a scene and then ran it.

    Please login or register to see this code.

    When I hit run the output log shows this... (see image)

    Please login or register to see this attachment.

    Edited by bowsertje
    • 0
    Posted

    drop global var met_no

    and re-run script again

    • 0
  • Inquirer
  • Posted
    2 minutes ago, 10der said:

    drop global var met_no

    and re-run script again

     

    Think that did the trick ! 

    Please login or register to see this attachment.

    • 0
    Posted (edited)

    wow!

    do you wish bonus? :)

    just import attached VD file

     

    Edited by 10der

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...