Using a zigbee knob dimmer to control a 0-10V wifi dimmer

Hi. I have a Sunricher ZG2835 knob dimmer which I would like to use to control a Shelly Dimmer 0/1-10V PM Gen3 (entity type Light, dimmable).

In HA under the Sunricher knob it exposes an event named “Action” (event.dim001_action):

… however under Zigbee2MQTT I can see a few others under state:

{
    "linkquality": 144,
    "action": "",
    "action_group": 9729,
    "action_level": 1,
    "action_transition_time": 0
}

…the main interesting being and “action” (on/off/brightness_move_to_level) and “action_level” which ranges from 1-254.

What is the best/easiest way to control (I’d rather avoid NodeRED if possible) the Light, both turning on/off and setting it’s brightness level, using the zigbee dimmer…?

Thanks,
RD

Ok, seems I solved it myself (and ChatGPT was useful for once…). Posting it here if someone else has the same setup (I guess there are similar ones already posted here since it’s obviously in the LLM training data). Anyways…

alias: DIM001 control Shelly Dmmer 0/1 0-10V
description: Control light.shelly_dimmer_0_1_10v from DIM001 via MQTT
triggers:
  - topic: zigbee2mqtt/DIM001
    trigger: mqtt
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ action == 'on' }}"
        sequence:
          - target:
              entity_id: light.shelly_dimmer_0_1_10v
            action: light.turn_on
      - conditions:
          - condition: template
            value_template: "{{ action == 'off' }}"
        sequence:
          - target:
              entity_id: light.shelly_dimmer_0_1_10v
            action: light.turn_off
      - conditions:
          - condition: template
            value_template: "{{ action == 'brightness_move_to_level' }}"
        sequence:
          - target:
              entity_id: light.shelly_dimmer_0_1_10v
            data:
              brightness: "{{ level }}"
              transition: "{{ transition }}"
            action: light.turn_on
mode: restart
variables:
  action: "{{ trigger.payload_json.action | default('') }}"
  level: "{{ trigger.payload_json.action_level | default(0) }}"
  transition: "{{ trigger.payload_json.action_transition_time | default(0) }}"