Setup intensity input for EV charger with variable

Hello

I’m trying to setup the intensity of my EV charger with a variable.

Here is the working code with a fixed number:

device_id: c7f78efbcb8696a1e33fe8bf1f7ada75
domain: number
entity_id: number.ev_charger_1_set_charge_current
type: set_value
value: 10

Here is what I tried, but does not work:

device_id: c7f78efbcb8696a1e33fe8bf1f7ada75
domain: number
entity_id: number.ev_charger_1_set_charge_current
type: set_value
value: "{{ states('input_number.chargeur_intensity') | float }}"

I m getting the error :

Message malformed: expected float for dictionary value @ data['value']

Thank you inadvance for your help !

Device actions do not support templates. Use the number.set_value action.

action: number.set_value
target:
  entity_id: number.ev_charger_1_set_charge_current
data:
  value: "{{ states('input_number.chargeur_intensity') }}"

Some light reading for you: Why and how to avoid device_ids in automations and scripts

Thank you very much, that’s working
and thanks for the reading :slight_smile: