MQTT Automation not triggering everytime

Hello,
first time poster here.
I’m kind of new new to mqtt and yaml, please excuse.
I created a trigger with the payload of a Shelly 2 Motion Sensor via the yaml config.
My config looks like this:

platform: mqtt
topic: shellies/shellymotion2-8CF681C1B5D2/info
payload: true
value_template: "{{  value_json.sensor.motion  }}"
encoding: utf-8

The code is not triggering every time a motion is detected. It works 1 - 2 times, maybe saving the automation triggers it? is my automation incorrect?
Home Automation suggest using this "{{ value_json.binary_sensor.shellymotion2_8cf681c1b5d2_motion }}", as this is an entity. But i don’t know which value is pushed in this variable.

{
    "wifi_sta": {
        "connected": true,
        "ssid": "MyWLAN",
        "ip": "192.168.8.185",
        "rssi": -64
    },
    "cloud": {
        "enabled": false,
        "connected": false
    },
    "mqtt": {
        "connected": true
    },
    "time": "20:18",
    "unixtime": 1716488287,
    "serial": 0,
    "has_update": false,
    "mac": "8CF681C1B5D2",
    "cfg_changed_cnt": 3,
    "actions_stats": {
        "skipped": 0
    },
    "sleep_time": 0,
    "lux": {
        "value": 782,
        "illumination": "bright",
        "is_valid": true
    },
    "tmp": {
        "value": 27.3,
        "units": "C",
        "is_valid": true
    },
    "sensor": {
        "vibration": false,
        "motion": false,
        "timestamp": 1716488262,
        "active": true,
        "is_valid": true
    },

This is an excerpt from the mqtt json of the motion sensor.
Is there an error in my configuration.yaml?

have you got MQTT Explorer installed

addon:

this lets you see what MQTT is doing

I think your value template is wrong

value_template: "{{ value_json['sensor'].motion }}"

also the MQTT rules have Change

this is mine

in my config file I have

mqtt:
  sensor: !include_dir_merge_list mqtt/sensor/
  climate: !include_dir_merge_list mqtt/climate/
  binary_sensor: !include_dir_merge_list mqtt/binary_sensor/
  switch: !include_dir_merge_list mqtt/switch/
  light: !include_dir_merge_list mqtt/light/
  fan: !include_dir_merge_list mqtt/fan/

I get it to pull all the different files in said folder

should look something like

  - name: "Shelly Motion 2"
    state_topic: "shellies/shellymotion2-8CF681C1B5D2/info"
    value_template: "{{value_json['sensor'].motion }}"

and you should put in the binary sensor section

  - name: "Shelly Motion 2"
    state_topic: "shellies/shellymotion2-8CF681C1B5D2/info"
    value_template: "{{value_json['sensor'].motion }}"
    device_class: motion

then it will have a ON/OFF status and the class will change it to a Detected/Clear