Setting Battery Charge Percent using Floats in Variables

Hello,
I am having difficulty in configuring an automation using a float in a variable. I have solar panels with a battery and I am looking to set the required charge percentage that the battery will charge from the grid overnight based upon how much predicted solar energy the panels will generate on that day. I can easily do this using an automation with a set value but the variable is simply not working for me. For example, this code works perfectly:

alias: Set Battery Charge Percentage
description: ""
triggers:
  - trigger: time
    at: "01:00:00"
conditions: []
actions:
  - device_id: c3e701324567890123456789123418b7
    domain: number
    entity_id: 0849013245678901234567891234ab66
    type: set_value
    value: 25
mode: single

Which sets the battery charge percentage to 25%.

This code, however:

alias: Set Battery Charge Percentage
description: ""
triggers:
  - trigger: time
    at: "01:00:00"
conditions: []
actions:
  - variables:
      battery_percent: "{{ 26.0 | float }}"
  - device_id: c3e701324567890123456789123418b7
    domain: number
    entity_id: 0849013245678901234567891234ab66
    type: set_value
    value: "{{ battery_percent }}"
mode: single

Generates the error:

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

and I am unable to save the automation. Naturally, the calculation of battery_percent is more complex but I just want to get it working simply first.

Any help would be appreciated.

Thanks.

Device Actions do not support templates.

Use the number.set_value action, which does support templates.

  - action: number.set_value
    target:
      entity_id: number.your_number_entity
    data:
      value: "{{ battery_percent }}"

Many thanks - that worked.

That seems to be a fundamental thing to know. What bit of documentation did I miss and I can dig into further?

FYI the now working code is:

alias: Set Battery Charge Percentage
description: ""
triggers:
  - trigger: time
    at: "01:00:00"
conditions: []
actions:
  - variables:
      battery_percent: "{{ 26.0 | float }}"
  - action: number.set_value
    target:
      entity_id: 0849012345678901234567891234ab66
    data:
      value: "{{ battery_percent }}"
mode: single