Homey Community Forum

[Request] Script to get overview of used timers in Chronograph

Could someone help with a piece of HomeyScript or code for the Web API playground to produce a list of Chronograph Timers as defined and referred to in any flow card (if…, then…, then…).
This to check they are used consequently between different card, that no spelling errors or extra spaces were added.

I switched from using Timers in App Countdown Timers to App Chronograph for more flexibility, easier configuration.

Good Q. I tend to use parts of the flow name.

Chronograph timers are created when needed and destroyed when stopped. The only way to get a list of timers is looping through flows

The following example produces a dictionary of timer-names used in flows along with it’s type (timer, stopwatch etc)

const flowsDic = await Homey.flow.getFlows();
const flows = Object.values(flowsDic)
const actions = flows.map(f => f.actions.filter(a => a.uri === 'homey:app:nl.fellownet.chronograph')).flat()
log(actions.reduce((a,x) => ({...a, [x.args.name]:x.id.split('_')[0]}), {}))