How are triggers or conditions added to the "create automation with device" suggestions?

(moved to Development)

I set up a new vacuum cleaner using Valetudo (which configures the Home Assistant integration using MQTT autodiscovery). Under SettingsDevices & ServicesMQTT → my vacuum → Automations, when I click the plus button, it brings up a dialog saying “Create automation with device”. That dialog comes pre-populated with a number of triggers, conditions, and actions, such as “Wi-Fi configuration value changes”, “mop attachment is off”, and “Change Water grade option” (respectively). How are those suggestions populated?

There is string-valued sensor for “error message” which is the empty string if there is no error and some message if there is an error. I would like to have a trigger for “error message changed”. I could not find information in the Home Assistant documentation about what causes an entity to appear in that menu. Also, looking at the configuration in the .storage directory, I did not see any difference in configuration between the error message sensor and the Wi-Fi configuration sensor.

Are there configuration options which can be provided through MQTT autodiscovery which would add triggers and conditions on this sensor value?

I think with mqtt, these are based on the type of entity created. Ie mop attachment off i would guess is a binary sensor. Binary sensors add is on and is off options in the device trigger options.

I would guess that your error message sensor is a normal sensor and as such, it will not add these options. AFAIK only way to add trigger options is via integration code, either the integration itself or the entity type in HA.

If you look at the code for binary sensor component, you will see that is defining the ones you see.