Help with Template Sensors Please

Hi there,

I have an iSpindel via MQTT and currently it sends a plato value (sensor.gravity) that I would also like to have as a SG value

The formula to do so is: *SG = 1+ (plato / (258.6 – ( (plato/258.2) 227.1) ) )

So I have tried the below to give me that value as well, but getting error:

Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ‘end of print statement’, got ‘integer’) for dictionary value @ data[‘sensors’][‘sensor_ispindel_sg’][‘value_template’]. Got ‘{{ float 1+sensor.gravity/(258.6-(sensor.gravity/258.2)*227.1) }}’. (See ?, line ?).

- platform: template
    sensors:
      sensor_ispindel_sg:
        unit_of_measurement: "°"
        value_template: "{{ float 1+sensor.gravity/(258.6-(sensor.gravity/258.2)*227.1) }}"
        value_template: "{{ 1 + (states('sensor.gravity')|float(0))/(258.6-((states('sensor.gravity')|float(0))/258.2)*227.1) }}"

amazing thank you ! is there a way to only show 4 numbers after the decimal point ?

round(4)