Get value out of Telegram message into number helper

Hi,

I have been trying for quite a while now. I would like to transfer a number to HA via a command on telegram and use it later in calculations.

I have created Helper Text and Helper Number.

Event listen shows:

event_type: telegram_command
data:
  id: ****
  chat_id: *******
  command: /geladen
  args:
    - 10,1
  user_id: ******
  from_first: *****
  from_last: null
origin: LOCAL
time_fired: "2023-09-04T10:17:51.331341+00:00"
context:
  id: ***********
  parent_id: null
  user_id: null

I’ve tried 10,1 and 10.1 and also only 10.
My automation to test:

alias: telegram_stromempfangen
description: ""
trigger:
  - platform: event
    event_type: telegram_command
    event_data:
      command: /geladen
condition: []
action:
  - service: telegram_bot.send_message
    data:
      message: Test {{ trigger.event.data['args'] }}
  - service: input_text.set_value
    data:
      value: "{{ trigger.event.data['args] }}"
    target:
      entity_id: input_text.telegram_textgeladen
  - service: input_number.set_value
    data:
      value: "{{ trigger.event.data['args'] }}"
    target:
      entity_id: input_number.telegram_stromempfangen
    enabled: true
mode: single

The Text Helper then displays [‘13,1’] after “/geladen 13,1” message. Also dot as separator works.
I just can’t get it to convert this string to a number to get it into the Number Helper.

any | int or | float or whatever goes wrong.
The automation sends its message and also sets the text helper. But if I set the number helper to the first position of the automation nothing happens.

Does anyone have any ideas?

Thanks a lot !

I have found a solution for me. The message always contains numbers XX.X or X.X::

{% set x = states('input_text.telegram_textgeladen')[3] %}
{% if x == "."  %} {{(states('input_text.telegram_textgeladen')[2]+states('input_text.telegram_textgeladen')[4]) | int / 10 }}
{% elif x == ","  %} {{(states('input_text.telegram_textgeladen')[2]+states('input_text.telegram_textgeladen')[4]) | int / 10 }}
{% else %} {{(states('input_text.telegram_textgeladen')[2]+states('input_text.telegram_textgeladen')[3]+states('input_text.telegram_textgeladen')[5]) | int /10 }}
{% endif %}

So from the list array [‘10.3’] just with absolute positions the numbers are searched, written one after the other and divided by 10.