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

lua to measure time diff between temp


Guest Kuuno

Question

Guest Kuuno

can someone help me to create LUA code that measures the time between last temperature changes.

eg temp is 21

next temp is 21,5

x is the time between temp went from 21 to 21,5

thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I know what you are working on! (heating?) create a loop that checks the temp. every ten seconds the loop runs. add a 1 to parameter.

when the parameter is 6, you have one minut. set that in another parameter.

start over with the first parameter.

when the temperature changes you know how many minutes and 10,20 or so seconds have pasted since the last change.

oh yeah and don't forget to set the initial temp in a parameter... or use a virtual device which might be easier.

Link to comment
Share on other sites

  • 0
Guest Kuuno
  • Inquirer
  • hi

    this is a goof idea too! i was thinking of something like os.time in a variable and then calculating the difference. i for some reason am afraid of these every 10 second loops but they shouldnt be a problem i guess?

    edit-actually every 60s is also ok, i dont think seconds matter too much...?

    Link to comment
    Share on other sites

    • 0

    You could avoid the loop but you have to use fibaro global variables and first change will be wrong.

    Please login or register to see this code.

    Link to comment
    Share on other sites

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