Stop timer and setting timer property to variables/don't repeat yourself best practice?

I am trying to not repeat some configuration values in a flow, but seems like some nodes don’t support mustache templates for every property.

In this case, I want to use the stop-timer, and set the “timer” property with a variable of type number. I have tried using {{ }} variable templating with no luck, global, msg, or flow context. UI just shows “Invalid properties - duration” on the stop-timer when I try to do this.

I want to use this configured duration value elsewhere in the flow, and I hate having to repeat the configuration. Specifically as I am testing this flow, I have to configure the hard-coded duration in the stop-timer AND update my flow value elsewhere, which is annoying.

Visually…below shows an example where I can use template variable for the Service in a call service node…

image

…and where it doesnt like it for the stoptimer property:

image

Show us what you have done already don’t forget to format you code

Updated the OP with pictures of what I mean.

Really not a code issue, more about node properties and template variables inconsistently being supported I guess (yes, there is probably ANOTHER way to do what I am trying to do, after all its node-red :slight_smile: )

In the service name I’d expect it to be start, stop, cancel (or something like that) for a timer. Is that what you are trying to put in notify_name? I’m pretty sure mustache templates work for entity id, but not sure about service name.

EDIT: just saw you say it works in service name and realised I’ve had a couple of drinks and talking rubbish

I don’t know this node specifically, but a lot of nodes accept settings via message parameters.
Look in the documentations of the node.

I know the delay node can accept delay via message perhaps you can use that instead?

Mustache templates only work in home assistant nodes. Nodered mostly uses the message position.

If you only need the vary delay then you set msg.delay to a number and send it to a delay node.

It can be set to override the delay set in the node. Stop timer does not have this option. If you need the stop action you can use stop time varidelay. You may also need to send time in as ms.

1 Like

Exactly what I needed to know! I could make delay work, but like the looks of stop-timer varidelay, and the fact that I can terminate the timer on later events with STOP. Thanks Mikefila!