Wake up raspberry pi via SSH with automation

HI I currently have a Intel NUC running Home Assistant OS. I’ve built a raspberry pi 4 with a touchscreen and printed a wall plate for it. I have everything working fine with the chromium browser as an interface. However i would like to turn the screen on and off with a motion sensor.

I added this to my configuration.yaml

  - platform: command_line
        command_on: ssh -t -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] /usr/bin/xset -display :0 dpms force on
        command_off: ssh -t -i /config/ssh/id_rsa -o StrictHostKeyChecking=no [email protected] /usr/bin/xset -display :0 dpms force off
        friendly_name: touchpi

If i type it in manually on a terminal on my laptop it turns the display on and off. Any ideas what i can do to get this working?

The Portainer addon is no longer available so use the offered alternative:

THankyou, i should have checked the guides first