Show the mirror in Home Assistant through your MQTT broker (such as the Mosquitto add-on): the screen, the sensors, the buttons and what your modules share, without any YAML. Home Assistant can only look until you let it control something below.
{% if cfg.enabled %}{% if status == "connected" %} Connected to {{ cfg.host }}. {% else %} {{ status | capitalize }}{% endif %}
{% if not cfg.username %}No user: a broker that lets the mirror in without one lets anyone in, and they can do all you allow below. Give the mirror a login of its own.
{% endif %} {% endif %} {% if cfg.enabled and cfg.id %}Without this, every device logged in to your broker could send the mirror what you allow above, and take over its connection. In the Mosquitto add-on, turn on customize and put these in its folder (/share/mosquitto): an ACL file with the lines below, and use_username_as_clientid true in a .conf file. Give your other devices their own users and lines too.
user {{ cfg.username or "" }}
topic write mirrordash/{{ cfg.id }}/#
topic read mirrordash/{{ cfg.id }}/+/set
topic read mirrordash/{{ cfg.id }}/enabled/+/set
topic read mirrordash/{{ cfg.id }}/m/+/+/set
topic write homeassistant/device/{{ cfg.id }}/#
topic read homeassistant/status
Step by step in the user guide.