This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Calculate time between start and end

Is it possible to calculate the time (minutes) between start en end time? When the dryer starts I log the starttime into a variable. Also when the dryer ends. But how can I calculate the minutes between this 2 variables? 

Comments

  • mruitermruiter Member
    edited January 2017
    It should be possible i think.
    The time you calculate with logic that it takes you can put in a var named bv Runtime
    Then youll need a var bv named Gemiddelde And you let gemiddelde var be gemiddelde var + runtimevar / 2
    If you run this every dryer run you should get a gemiddelde of the total times you run.
    But you have to fill in the first gemiddelde var in by hand or make even more flows with logic that if its 0 then dont divide by 2 .

    But i guess its more usefull to make a gemiddelde app that you can pass on the runtimes and log them for you. The app can then also make the som of all runs divided by de number of runs.
  • The difference between  the two times is in seconds,
    We added 84600 seconds to check for 23,5 hours later....
    Examples of how to use Time calculations the old way here:
    https://forum.athom.com/discussion/1899

    Guess you can do it with tokens the same way now. 
  • AppieAppie Member
    edited January 2017
    Can imagine two flows in combination with Better Logic app
    1. When dryer starts, set Better Logic variable StartDryerTime with tag Time
    2. When dryer ends, do in Better Logic card mathematical expression (current time - StartDryerTime)/60


  • Appie said:
    Can imagine two flows in combination with Better Logic app
    1. When dryer starts, set Better Logic variable StartDryerTime with tag Time
    2. When dryer ends, do in Better Logic card mathematical expression (current time - StartDryerTime)/60


    Can you show me a example? I have tried but no luck. 
Sign In or Register to comment.