Also I think the main reason of the error is that the single line template must be put between quotes: "{{ ... }}". Otherwise it is not evaluated, so instead of a number the whole line gets parsed as a string.
You can use data instead of data_template nowadays.
When using certain filters, like float, one should supply a default value. If you don’t and float is unable to convert a value, it will result in an error. In the following example, float will report 21 if the value of sensor.heater_target is non-numeric like unavailable or unknown.
Changing data_template to data won’t fix this error:
expected float for dictionary value @ data[‘temperature’]. Got None
The error is due to the template lacking outer quotes.
If you just add quotes but don’t do the other things I suggested, you’ll have an old-style service call that will fail if the sensor’s value is ever non-numeric.