Show message in frontend

Hi, I am developing a custom component and can’t find a way to show info/error/warning messages in the frontend/UI.

For example, in the custom_components/alarm_control_panel/alarmsystem.py I would like to show an error message if the user enters the wrong code trying to arm/disarm the alarm system.

Any help would be much appreciated.

Have you tried persistent notification? It is a native item to HA, it will create a pop up that displays on all pages of the HA front end until dismissed (dismiss button at the end of the message)

Thank you for your reply. I have now tried that and it might be what I will go with unless any other option arise.
It is a little annoying that the persistent notification is shown behind the alarm control panel. That makes it easy to miss.

I was hoping there was a way to show a message like the one that pops up at the bottom of the screen when a service has been called (or when the connection to the server is lost, like when restarting Home Assistant).