BTW, if you don't want to delve into Home Assistant and want to write your own, this would work:
https://github.com/parnic/node-screenlogic
Frankly though, The easyness of Home Assistant to make VERY complex automations and dashboards is better than writing it your own. But you can...