[APP][Pro] Chronograph - Adds precise timer, stopwatch and transition functionality to Homey

Thank you for the quick response. Unfortunaly i couldn’t get the flow with homeyscript to work, it would have been neat since the format HH:MM would have been nice. I used device capabilites, changed all variables and entitie names and imported the flow. Once the flow was imported i changed the card to homeyscript with argument and copy/pasted the code but i get an error when i try to run it. It says it cant find the variable. Any quick “pointers” to were i could have gone wrong? I haven’t used homeyscripts before (as you most likely already figured out)

1 Like

Yes, sorry, it’s a temporary situation, you’ll have to replace the ‘dummy’ Homeyscript cards with real HS card.
Here’s the how to and background:

1 Like

Thank you! Found the free memory flow/device and managed to get that to work, awesome flow and function :slight_smile:

However i cant get the stopwatch to work. I changed the device “valve1” so that my TV starts and stops the timer in chronograph. I changed the template with a “HS run code with argument” and copy pasted the code but i get an error that it doesnt find the variable. Before i test the script i start and stop the stopwatch so that i have a stopwatch in chronograph named “tv” that is paused.

is there any variable that im missing or could it be something in how i replace the dummycard with the HS-card?

1 Like

Edited: My bad, Fredrik, the logics var ID’s were hardcoded, that doesn’t work on other Homey’s ofcourse. I also changed the Dutch var names to English ones.
I made some adjustments, it should run OK now:

1 Like

Hi! Once again thank you for your time looking at this, much appreciated. I cant, however, seem to get it to work. I tried the new TFE import and got a new error, it says “filtered is not iterable”. Since you mention hardcoded english i tried removing the swedish letters in the name for the chronograph stopwatch (not in the screenshot) but i got the same error. I also tried copy paste the HS-flowcard and put it in a new flow with the same triggers for the stopwatch but with the same result.

1 Like

You’re welcome, Fredrik!

I edited my text in the previous post (the English was about my var names which were still in Dutch)

  • I didn’t realize the var names could be altered :crazy_face: . I adjusted the argument input, it now holds the (editable) variable name as well
    How to:
  • A) The top HS card should hold this code:
View code
// Convert seconds to "xx hrs, xx mins, xx secs" with arguments {"durationTag_timer":[duration], "VariableName":"YourVarNameHere"}
let myArgs = JSON.parse(args[0]);

let seconds = myArgs.durationTag_timer

// just for testing a value while editing in console
//let seconds = 3600
//
let setAll = 0;

if (seconds == '' || seconds == undefined) {
    console.log ('Missing argument');
    return(false);
} else {
  d = seconds;
  var h = Math.floor(d / 3600);
  var m = Math.floor(d % 3600 / 60);
  var s = Math.floor(d % 3600 % 60);

  // Show as 'HH:MM:SS'
  var clock = ('0' + h).slice(-2) + ":" + ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2);

  // Show as 'x hours, x minutes, x seconds'
  // When 0 --> display
  var hDisplay = h >= 0 ? h + (h <= 1 ? " hour, " : " hours, ") : "";
  var mDisplay = m >= 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
  var sDisplay = s >= 0 ? s + (s == 1 ? " second" : " seconds") : "";
  // When 0 --> don't display
  //var hDisplay = h > 0 ? h + (h <= 1 ? " hour, " : " hours, ") : "";
  //var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
  //var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";

    if (mDisplay != 0 && sDisplay == 0) {
      var mDisplay = m > 0 ? m + (m == 1 ? " minute" : " minutes") : "";
    }
    if (mDisplay == 0 && sDisplay == 0) {
      var hDisplay = h > 0 ? + h + (h <= 1 ? " hour" : " hours") : "";
    }

  setAll = hDisplay + mDisplay + sDisplay; 
  
  //Set or get variable in Homey by name of variable
  const varName = myArgs.VariableName 
  let Logic = await Homey.logic.getVariables();
  let idArr = Object.entries(Logic);
  let filtered = idArr.filter(([key, value]) => value.name==varName);
  let [ [ ,{ id: varID}]] = filtered;
  //Now varID contains the ID you're after
  //Read/get value of variable
  var varArr = await Homey.logic.getVariable({id: varID})
  var varValue = varArr.value
  //Set variable to newValue:
  var newValue = setAll
  await Homey.logic.updateVariable({id: varID, variable: {value: newValue}});
}

//console.log(setAll);
//console.log(clock);

return(true);


  • B) The bottom HS flow card should hold this code:
View code
// Convert seconds to "HH:MM:SS" with arguments {"durationTag_timer":[duration], "VariableName":"YourVarNameHere"}

let myArgs = JSON.parse(args[0]);

let seconds = myArgs.durationTag_timer

// just for testing a value while editing in console
//let seconds = 3600
//
let setAll = 0;

if (seconds == '' || seconds == undefined) {
    console.log ('Missing argument');
    return(false);
} else {
  d = seconds;
  var h = Math.floor(d / 3600);
  var m = Math.floor(d % 3600 / 60);
  var s = Math.floor(d % 3600 % 60);

  // Show as 'HH:MM:SS'
  var clock = ('0' + h).slice(-2) + ":" + ('0' + m).slice(-2) + ":" + ('0' + s).slice(-2);

  // Show as 'x hours, x minutes, x seconds'
  // When 0 --> display
  var hDisplay = h >= 0 ? h + (h <= 1 ? " hour, " : " hours, ") : "";
  var mDisplay = m >= 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
  var sDisplay = s >= 0 ? s + (s == 1 ? " second" : " seconds") : "";
  // When 0 --> don't display
  //var hDisplay = h > 0 ? h + (h <= 1 ? " hour, " : " hours, ") : "";
  //var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "";
  //var sDisplay = s > 0 ? s + (s == 1 ? " second" : " seconds") : "";

    if (mDisplay != 0 && sDisplay == 0) {
      var mDisplay = m > 0 ? m + (m == 1 ? " minute" : " minutes") : "";
    }
    if (mDisplay == 0 && sDisplay == 0) {
      var hDisplay = h > 0 ? + h + (h <= 1 ? " hour" : " hours") : "";
    }

  setAll = hDisplay + mDisplay + sDisplay; 
  
  //Set or get variable in Homey by name of variable
  const varName = myArgs.VariableName

  let Logic = await Homey.logic.getVariables();
  let idArr = Object.entries(Logic);
  let filtered = idArr.filter(([key, value]) => value.name==varName);
  let [ [ ,{ id: varID}]] = filtered;
  //Now varID contains the ID you're after
  //Read/get value of variable
  var varArr = await Homey.logic.getVariable({id: varID})
  var varValue = varArr.value
  //Set variable to newValue:
  var newValue = clock
  await Homey.logic.updateVariable({id: varID, variable: {value: newValue}});
}

//console.log(setAll);
//console.log(clock);

return(true);



When you want to change variable names,
mind to change it in the arguments bar of the homeyscript cards as well. Example for the
totalDuration_human variable name:
Screenshot from 2022-10-12 01-03-07



New TEF:

[TEF:FLOWS:H4sIAAAAAAACA+1aC2/cxhH+K1sCiU7w7ZlLLh/LVCmMJIV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h5wPQ+4ngdczwOu/5cBVyvP84Trf3TCZWP584DroQFXa55uwDWqGDydgXh/5NcFXqG2toRwL03Uh+ISQWF3Bx1bngPc2PiprfTADR4qxxM0nwteySQZ85+/SaJMcbyAmq80yeJ4j75W2PMcU4nveKKnjKSEK3UUkwgHrq8xVYAEM41jTCV0kB4JUy8+7GfegaNkBfSH2WpdVg1EjN0hMTGhBnsNgV8Mf9Fs6Fs0FusndSrb7WL7H9X+B/pDJwAA]
1 Like

Thank you! That did the trick :smiley:

2 Likes

Hey Bob, i might like to take over the App Development.
But it seems i cannot send you a PM?
I Hop you get this or someone can PM me your mailardres.

9 Likes

Hi @BobKersten (or @Arie_J_Godschalk, if you take over the app)

I resently experienced issues with flow card “transition reached a step” not working after a Homey restart. It happend first time just after midnight to yesterday, I did a manual restart of Homey and later noticed that the flow did not continue to update variables when reaced a new step (the transition is resuming/pausing as it should).
I fixed it by manually restart the transition (step goes back to zero), manually adjust the length of the transition and then resume the transition until reaced next step (each minute) and verified that my variable was updated. Then paused the transition.
Everyting was working fine the rest of the day and until this morning when my Homey updated to 8.0.8 and restarted. Same issue again as yesterday.
What have changed since this flow card have been working flawless for several months before?
Any suggestions for a fix?



1 Like

Nice initiative, Arie! I think maybe Athom has Bob’s mail address

1 Like

:hugs: :clap: :clap:

1 Like

Yeah :slight_smile:

Chronograph has just fully been transfered too me :slight_smile:

This means it will be updated to SDK3.

Bob has transfered the GitHub and Homey App to me.
@moderators is it possible (Bob agreed to this if so) to transfer this forum Topic over to me?

This will also mean, sometime soon:

  • I’ll be transfering over to BitBucket (like all my repo’s)
  • As soon as i make the big switch to SDK, i might delete all reviews (not sure about it yet)
  • Furter integration into Share Your Device and The Flow Exchange(r)
17 Likes

Thanks Arie!!

3 Likes

If you update it to sk3 will older homeys no longer get updates? So then Athom are forced to buy a new one again?

Is it not possible to run two apps? on sdk2 and sdk3?

Older Homey upgrade to Sdk3 is this possible?

1 Like

All Homeys should have SDK3, also all older models (if updated).
So yes, it will keep working.

And it must: after 1 jan 2023, all SDK2 apps will not be in the store anymore to download, thats why everyone needs to switch to sdk3.

But as far as i kinow, all devices are then supported (and will run more smoothly after bugfixing).

1 Like

ok misunderstanding on my part. what everything an app is removed from the app store does it still remain on your homey?

1 Like

Athom can not remove an installed app from your Homey, so it will continue to run as before.

1 Like

That is nice.
So if I put old homey in satellite mode with a new homey. I can still use old sdk2 apps. that would be handy.

1 Like

I also guess that the satellite mode is only possible with the Homey Bridge, isn’t it?

1 Like

Here Dirk, Satellite mode!: [Vote] Feature App: Connect 2023 to Old Homey for Led, Speaker, Zwave(satellite) and network resource - Apps - Homey Community Forum

Do you want to test it also?

Got it working nicely already :wink:

1 Like