Learnt triggers lost after restart

I have an aqara opple button that eventually uses MQTT to connect to Home Assistant. When I use all the buttons for the first time, Home Assistant “learns” them. When you go to the device, you see all the different actions that can be used.

However, after a restart, Home Assistant has forgotten all about it. So the automations I created only work after I re-learned Home Assistant, by using all these buttons again for the first time. This basically means that the first time, the automation won’t work.

Maybe not a very big deal, but on the other hand, I don’t understand why these possible actions aren’t stored somewhere. Especially when they are used in an automation.

Now when I go in the automation that has not been learned yet, it says “Unknown trigger”.

If it’s using mqtt, whhy not use the mqtt trigger instead?

Actually, I switched to this kind of configuration once I learnt that Home Assistant was able to do this.

It’s much easier to create an automation now, especially on a mobile device. I don’t have to lookup the correct mqtt topics, and I don’t have to enter any yaml. I just add an automation through the wizard that says Do something when “button_2_single” action.

That works really well, it’s just a shame that these triggers are not stored somewhere in home assiatant.

Also, if I inspect the ‘yaml view’ I think the automation is not tightly bound to a MQTT topic. If the topic ever changes, I guess this won’t affect the automation. That’s why I’d think this is a preferred method. The yaml now looks like this:

platform: device
domain: mqtt
device_id: a0fd382661584492aba428c5f5b65443
type: action
subtype: button_3_single
discovery_id: 0x04cf8cdf3c797976 action_button_3_single