Shelly dimmer 2 mqtt configuration

Hey there,

Beginner with home assistant so hopefully someone could help me.
I have lots of shelly 1’s allready integrated through mqtt (as shelly integration is lagging up to a minute (poll??)

All shelly 1’s are working fine

Now I have a Shelly dimmer 2 but however I can see it when I announce a message in configuration I can’t get it to switch on/off the device.

It must be something easy in the configuration but I can’t figure it out… have tried several configs found on google but o luck till now.

This is the json output on aanounce message

Bericht 94 ontvangen op shellies/shellydimmer2-98CDAC0D46BA/info om 15:26:
{
    "wifi_sta": {
        "connected": true,
        "ssid": "KnipIOT",
        "ip": "192.168.40.171",
        "rssi": -41
    },
    "cloud": {
        "enabled": false,
        "connected": false
    },
    "mqtt": {
        "connected": true
    },
    "time": "15:26",
    "unixtime": 1684762012,
    "serial": 1,
    "has_update": false,
    "mac": "98CDAC0D46BA",
    "cfg_changed_cnt": 0,
    "actions_stats": {
        "skipped": 0
    },
    "lights": [
        {
            "ison": false,
            "source": "http",
            "has_timer": false,
            "timer_started": 0,
            "timer_duration": 0,
            "timer_remaining": 0,
            "mode": "white",
            "brightness": 100,
            "transition": 0
        }
    ],
    "meters": [
        {
            "power": 0,
            "overpower": 0,
            "is_valid": true,
            "timestamp": 1684769212,
            "counters": [
                0,
                0,
                0
            ],
            "total": 27
        }
    ],
    "inputs": [
        {
            "input": 0,
            "event": "",
            "event_cnt": 0
        },
        {
            "input": 0,
            "event": "",
            "event_cnt": 0
        }
    ],
    "tmp": {
        "tC": 35.94,
        "tF": 96.69,
        "is_valid": true
    },
    "calibrated": false,
    "calib_progress": 0,
    "calib_status": 0,
    "calib_running": 0,
    "wire_mode": 1,
    "forced_neutral": false,
    "overtemperature": false,
    "loaderror": 0,
    "overpower": false,
    "debug": 0,
    "update": {
        "status": "idle",
        "has_update": false,
        "new_version": "20230510-082920/v1.13.1-gda6f9f2",
        "old_version": "20230510-082920/v1.13.1-gda6f9f2"
    },
    "ram_total": 49672,
    "ram_free": 36964,
    "fs_size": 233681,
    "fs_free": 118974,
    "uptime": 6139
}

This is (part of) my mqtt.yaml
First spotszolder which is working fine second dimmer2

    - name: shelly1pm-spotszolder
      unique_id: shelly1pm-spotszolder
      # 192.168.40.170 Spots Zolder
      payload_on: "on"
      payload_off: "off"
      qos: 0
      state_topic: shellies/shelly1-349454720177/relay/0
      command_topic: shellies/shelly1-349454720177/relay/0/command
      json_attributes_topic: shellies/shelly1-349454720177/info
      optimistic: false
    - name: shellydimmer2-lampzolder
      unique_id: shellydimmer2-lampzolder
      # 192.168.40.171 Lamp Zolder
      payload_on: "on"
      payload_off: "off"
      #brightness_scale: 100
      qos: 0
      state_topic: shellies/shellydimmer2-98CDAC0D46BA/relay/0
      command_topic: shellies/shellydimmer2-98CDAC0D46BA/relay/0/command
      json_attributes_topic: shellies/shellydimmer2-98CDAC0D46BA/info
      optimistic: false

Any help into the right direction would be apreciated

This was in the end the correct config:

    - name: shellydimmer2-lampzolder
      unique_id: shellydimmer2-lampzolder
      schema: template
      state_topic: shellies/shellydimmer2-98CDAC0D46BA/light/0/status
      command_topic: shellies/shellydimmer2-98CDAC0D46BA/light/0/set
      state_template: "{% if value_json.ison %} on {% else %} off {% endif %}"
      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) }}"
      payload_available: true
      payload_not_available: false
      qos: 1
      optimistic: false