Casting to float not working in nested dictionary in template

I have some problem with casting in templates. I try to set LEVEL parameter of my Homematic IP TRV. To achieve that I use following automation:

automation:
  - alias: Set living room valve state
    trigger:
      platform: state
      entity_id: input_number.valve_livingroom
    action:
      - service: homematic.put_paramset
        data_template:
          interface: hmip
          address: 0000000000:1 # Example address
          paramset_key: VALUES
          paramset: 
            LEVEL: "{{ states('input_number.valve_livingroom') | float }}"

Unfortunately value of LEVEL parameter is passed as string not as float and homematic integration does not support string as input type:

2020-07-31 20:40:50 DEBUG (SyncWorker_8) [homeassistant.components.homematic] Calling putParamset: hmip, 0000000000:1, VALUES, {'LEVEL': '0.52'}
2020-07-31 20:40:50 DEBUG (SyncWorker_8) [pyhomematic._hm] ServerThread.putParamset: Exception: <Fault -5: 'Invalid parameter or value'>

Everything is working perfectly fine if I directly pass float value:

          paramset: 
            LEVEL: 0.82
2020-07-31 20:54:35 DEBUG (SyncWorker_2) [homeassistant.components.homematic] Calling putParamset: hmip, 0000000000:1, VALUES, {'LEVEL': 0.82}

Is this a bug or expected behavior?

No, this is not a bug; at least not in the service call infrastructure. Templates always return strings. Period.

The problem is in the service handler. In order to accept a string representation of a number it needs to do the conversion.

EDIT: In other words, it’s a deficiency of the homeatic integration.

Finally, something changed! HA 0.117 has native types support, so my automation is working like a charm.