Number Component - max_value as globals variable

I’m trying to use a global var for the max_value of a number component.
But getting always the error “expected float” :frowning:

globals:
  - id: current_max_value
    type: float
    restore_value: no
    initial_value: '10.0'
number:
  - platform: template
    name: "Current"
    id: set_current
    icon: mdi:arrow-oscillating
    min_value: 6
    max_value: ${current_max_value}
    step: 1
    optimistic: false
    lambda: |-

Global variables are for sharing a variable across different lambdas. I think you want a substitution.

on dependency i want to change my variable “current_max_value”

The goal is to have a different max_value depending on a state