Shelly dimmer moving to mqtt light

Hi, I just updated to 2022.9.6 and i get the warning that I should move my sensors and lights to the mqtt integration. After some googling I found out that basically

  - platform: mqtt
    schema: template
    name: Light diningroom table
    state_topic: "shellies/diningroom_dimmer/light/0/status"
    state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'
    command_topic: "shellies/diningroom_dimmer/light/0/set"
    command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
    command_off_template: '{"turn": "off"}'
    brightness_template: '{{ (value_json.brightness | float * 2.55) | round(0) }}'  

should be changed to

light:
  - name: Light diningroom table
    schema: template
    state_topic: "shellies/diningroom_dimmer/light/0/status"
    state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'
    command_topic: "shellies/diningroom_dimmer/light/0/set"
    command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
    command_off_template: '{"turn": "off"}'
    brightness_template: '{{ (value_json.brightness | float * 2.55) | round(0) }}'  

Home assistant does not accept my definitions for command_on_template, command_off_template and brightness_template anymore. Anyone encountered this already?

Got it:

  - name: Light diningroom table
    schema: template
    state_topic: "shellies/diningroom_dimmer/light/0/status"
    state_template: "{% if value_json.ison %} on {% else %} off {% endif %}"
    command_topic: "shellies/diningroom_dimmer/light/0/set"
    command_on_template: >
      {"turn": "on"
      {%- if brightness is defined -%}
      , "brightness": {{brightness | float | multiply(0.3882) + 1 | round(0)}}
      {%- endif -%}
      }
    command_off_template: '{"turn": "off"}'
    brightness_template: "{{ value_json.brightness | float | multiply(2.55) | round(0) }}"