Homey Community Forum

Countdown in steps using math.js

I have a challenge with Better Logic - math.js , maybe someone can help me with it.

The idea is as follows:
A countdown of 120 seconds
Goal:

  1. Say per 10 seconds the countdown value
  2. Say for every second in the last 10 seconds the countdown value

I have the following flow
TRIGGER: When timer value has changed
AND : BETTER Logic Math.js expression is true
mod(countdownvar,10)==0
OR : countdownvar value less then 10
THEN : say countdownvar

The expression doesn’t work. What is the right formula to use?![TestCountdown|325x500]

Perhaps start with using mod instead of Mod. If that doesn’t work, start with a simpler version, for instance without the tag but just a hardcoded value.

Thank you Robert. I brought back the expression to
{{(divide(10,10)-mod(10,10))==0}}

But still a false as answer.

1 - 0 == 0

That is false.

Thanks for your suggestion. That helped debugging the formula

or much more simple
mod(soundbrdtest1,10)==0