Sorry for my question, but if I simply try this simple assigment there is a “cast” mistake:
globals:
- id: my_global
type: float
restore_value: no
initial_value: '0'
number:
- platform: template
id: my_number
name: My Number
min_value: 0
max_value: 100
step: 1
optimistic: true
on_value:
then:
- lambda: |-
my_global = x;