Is there a way to report if a screen of a remote device is on or off? And can this be integrated in a switch button on lovelace?

I have an Rpi running Magis Mirror. It is connected to a monitor.
Using the very helpful instructions from @CentralCommand in this post, I have managed to create a switch that turns the Rpi’s screen on or off. I am using this switch to turn the screen off when not in the room. The configuration.yaml section doing this is below:

switch:
  - platform: command_line
    switches:
      mm_display:
        friendly_name: MagicMirror Display
        command_on: "ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no [email protected] sudo vcgencmd display_power 1"
        command_off: "ssh -i /config/.ssh/id_rsa -o StrictHostKeyChecking=no [email protected] sudo vcgencmd display_power 0"

When I add this switch to lovelace as a button, I am facing a problem. If I click the button when the screen is off, it will turn on and the icon will update to show the screen’s status as “on”. But when the automation turning the screen off (if no presence is detected) turns the screen off, this lovelace button does not update to show the current screen’s status as off. The same happens if the screen is on after the automation sees motion: the screen does turn on (which means the command is sent to the Rpi), but the lovelace button doesn’t update to show the correct screen’s status.

Is there a way to get the screen status regardless of where the screen gets turned on/off from (automation of by manually pressing the lovelace button)?