Control the frontend from a script

I have a wall-mounted tablet, a camera aimed at my front door and a doorbell that is connected to home assistant.

Currently, when the doorbell is pushed, hass receives a mqtt message that does the following things:

  • sends a message to lanouncer on my wall-mounted tablet to play a doorbell sound
  • launches a shell-script to fetch a picture from the camera and sends it trough pushbullet to my phone
  • sends a command to fully kiosk on my tablet to open the camera feed and closes it after 30 seconds

Everything is working pretty nice, but the last thing is something that is rather hacky, by injecting javascript in the page with a javascript:-url.

I use the following code for this. Replace tablet-living.local, the password and camera.outside to match your needs:

curl "http://tablet-living.local:2323/?password=xxxx&type=json&cmd=toForeground"

curl -g "http://tablet-living.local:2323/?password=xxxx&type=json&cmd=loadURL&url=javascript:$JS"

Note that you need a beta-release of fully kiosk for this to work.

A prettier way would be for the backend to have a command to send this action to the frontend itself instead of going trough a injected javascript in the url.

What are your ideas?