Condition based on value of global variable

Hi,

I am struggling to find this in the documentation so hoping someone can help.

I have a global variable:

globals:
  - id: counter
    type: int

and in a script I want to add a condition of counter is greater than zero.

script:
  - id: counter
    then:
    globals.set:
      id: counter
      value: '10'
      while:
        condition:
          ????????

I can see that I can used globals.set to set the value but how do you read the value?

My intention is then to a while loop with a delay and decrementing the counter by one until it reaches zero. I then want to be able to see the state of the counter in home assistant e.g. its running and is currently at 6

Thanks

J

I think you have to use a lambda condition.

Hi,

I was suspecting that a lambda might have to come into it

Thanks