ESP32 ( not ESPHome ) w/mqtt - hardcode yaml - SCHEMAS?

So after much struggle I finally made this thing work.

ESP32 ( not using ESPHOME ) with a led light strip for output
MQTT ( with Mosquitto Broker in HA )
Hardcoded Yaml to create an entity ( Discovery msg? - had to throw in the towel on this one )
Creates an entity
Gets linked to a card
Can turn on/off light strip using switch from HA Dashboard ( correctly remembers the state -if ESP or HA loses connection/power )

GOOD TIMES!

My struggles were a result of being a newb at HA and mixing Schemas in error. When trying to implement discovery messages I was using json yet I was trying to also mix in default for control… it’s no wonder I never got discovery to create an entity!

SO…

What is with the different Schemas? ( default , json, template ) having more than 1 certainly adds to the understanding complexity.
Why one over another - should I stick with one schema for all future devices? I am willing to learn json and templates -is one superior?

Thanks

I’ve been implementing auto-discovery for an X10-2-mqtt bridge I’m writing. I’ve implemented it all in json as that was easier for me in the end. I’ll be honest 2/3 of my issues were all the escaping required to generate a correct message.

Here’s the message string I send to create a light:
const char LIGHT_AUTODETECT_MESSAGE[]= “{“name”: “%s”, “device_class”: “light”, “state_topic”: “x10/%s/state”, “command_topic”: “x10/%s/set”, “brightness”: %s, “optimistic”: false, “schema”: “json”}”;

With the name in the first 3 parameters and true or false in the last

The topic CANNOT have a space in it. and follows the following template

“homeassistant/%s/%s/config” with the first parameter “light” and the second parameter the name with spaces replaced with ‘-’

Switches were harder as their JSON decoding isn’t as good for some reason.