Help for Shelly Plus (Gen2) with MQTT manual configuration

I’m trying to configure a Shelly 2PM Plus (gen 2) with MQTT.
I don’t want to use other integrations.
Many examples refer to Gen 1 devices but Gen 2 work different on MQTT.

My MQTT config for light devices is:

- name: shelly_dining
  unique_id: shellyplus2pm-dining
  state_topic: "shellies/shellyplus2pm-dining-living/status/switch:0"
  state_value_template: >-
    {{ value_json.output }}
  command_topic: "shellies/shellyplus2pm-dining-living/rpc"
  payload_on: '{"method":"Switch.Set","params": {"id":0,"on":true}}'
  payload_off: '{"method":"Switch.Set","params": {"id":0,"on":false}}'

- name: shelly_living
  unique_id: shellyplus2pm-living
  state_topic: "shellies/shellyplus2pm-dining-living/status/switch:1"
  state_value_template: >-
    {{ value_json.output }}
  command_topic: "shellies/shellyplus2pm-dining-living/rpc"
  payload_on: '{"method":"Switch.Set","params": {"id":1,"on":true}}'
  payload_off: '{"method":"Switch.Set","params": {"id":1,"on":false}}'

but the state views give me always unavailable. but if I click on the entity button, I see this pic and the two buttons work without visual feedback (the light really turn off and on).

Where is the error?

You can use Shellies Discovery to configure the device via MQTT integration GitHub - bieniu/ha-shellies-discovery-gen2: Script that adds MQTT discovery support for Shellies Gen2 devices

But I prefer to know how configure it manually