Messages to a MQTT device

I have an ESP32_CAM running on Node-Red. It’s working exactly as I want with Node-Red and I’m trying to transition to HA without changing the software. It responds to 4 MQTT messages on Node-Red which are: go, stop, photo and wdt. These relate to the functions, turn on the camera PIR, turn off the camera PIR, take a photo and a watchdog timer trigger.
I am trying to write a configuration for this device and I have tried to use chat GPT to generate it. This is what it suggests:
- platform: mqtt
name: “Hall Output”
state_topic: “hall/output”
qos: 0
value_template: “{{ value_json[‘wdt’] }}”
device_class: “motion”

I have other modules that are just sensors that also run on Node-Red and they work fine with HA, but they only give out values. This module has to respond to the 4 commands, the one shown being ‘wdt’.
HA doesn’t like it. I tried various combinations without the -platform:mqtt
Here is part of my configuration file.
<
mqtt:
sensor:
- name: “Garage Temp”
unique_id: Gar_Temp
state_topic: “garage/tempC”
unit_of_measurement: C
device_class: temperature

- name: "Hall RSSI"

  unique_id: Hall_RSSI
  state_topic: "bc_cam3/RSSI2"
  unit_of_measurement: dB
  device_class: signal_strength
  
  
- name: "Hall PIR" 
  unique_id: Hall_PIR
  state_topic: "bc_cam3/PIR"
  device_class: enum

- name: "House Current" 
  unique_id: Util_Current
  state_topic: "utility/current"
  unit_of_measurement: W
  device_class: power

- name: "Hall Output"
  state_topic: "hall/output"
  qos: 0
  value_template: "{{  value_json['wdt'] }}" 
  device_class: "motion"

Any assistance would be gratefully received.

Hi Graham Arthur Johnston,

Don’t do that.
AI’s generate text, not code. It has no idea what the code rules are and it just makes shit up…
This creates YAML that tends to look right, but generally isn’t, but is very hard to troubleshoot. That means no one wants to help fix it…

Yep. That just about sums it up.
Anyhow. I cracked it in the end. The syntax of this stuff just eludes me at the moment. But I am making sense of it.
Thanks for the advice though.