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

How to get Time difference (in minutes) between Sunset and Dusk


Question

Posted (edited)

Hi Y'all,

 

I spend hours and hours looking for an answer (if any ...) to my self induced problem.

 

I use the 'Sun_calc' device for displaying sunset, dusk, sunrise etc. etc. in my HC3.

Works like charm.

I created Global Variables and they are correctly displaying e.g. "17:05" and "17:35" for sunset and dusk.

 

But I would like to use the time difference between those values ( i.e. 30 in this case), so I can use that value somewhere else.

I like to put that value into another Global Variable, so I can use it in any scene I want.

 

I haven't the faintest idea how I can convert those string values into 'minutes' so I can do math on them.

 

Anybody?

 

Tnx in advance.

 

Edited by Bluesbirdy

6 answers to this question

Recommended Posts

  • 0
Posted

just a moment

  • 0
Posted

Please login or register to see this code.

 

 

Please login or register to see this image.

/monthly_2020_12/image.png.83510664bd0567db9045e242d4d66ad8.png" />

 

ie 35 min

  • 0
  • Inquirer
  • Posted

    Wow, this works! Thank you.

    Sorry I couldn't find this kind of basic information anywhere.

     

    One more thing and then I never bother you again !??

    When I try to put the value:    (hm2sec(x2) - hm2sec(x1)) / 60    into my Global Variable, I get the message "Assertion failed: Expected string".

    Can you explain to me why I cannot enter the result of that equation as a number into the variable?

     

    I do not understand that, because I can enter a random number manually to the variable without any problem.

    Maybe I begin to see the 'light' when this becomes more clear :D

     

    Tnx.

     

    • 0
    Posted (edited)

    Hello @Bluesbirdy

    Save global variables in string!
    Tostring (number) and tonumber (text) are responsible for the conversion.
    Try that out

    Greetings from the land of Christmas trees (Sauerland)
    Frank

    Edited by FBerges
    • Thanks 1
    • 0
  • Inquirer
  • Posted

    Hi FBerges, I got confused because the number 30.0 appeared as '30.0' in the Global Variable.

    When I enter 30 (manually) as value into my Global Variable, the number 30 appears without the two single quotation marks.

    That's why I thought is was not correct.

     

    But, all is clear and working, thank you.

     

    Guten Nacht.

     

    • 0
    Posted
    14 hours ago, Bluesbirdy said:

    I use the 'Sun_calc' device

    Welcome and thank you for using my QA ;) 

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