Currently looking for a way to trigger a mouse-click in the middle of my screen.
I’m building a screen behind a mirror for my bathroom.
I already integrated a gesture sensor (PAJ7620 with ESP32), sending data via MQTT into HA.
(recognized gestures: UP / DOWN / LEFT / RIGHT / FORWARD / BACKWARD / CLOCKWISE / ANTICLOCKWISE / WAVE)
I also integrated a news-stream from my local TV station, so I can watch the news while shaving and brushing my teeth)
I can’t/will not use any other device like touch etc … because of the humidity in a bathroom. PAJ7620 with gesture recognition is the only way to go. (I’m already using it to “swipe” between dashboards, and to “move” between cards and make selections etc … all within HA)
I can use helpers / MQTT / Pyscript, or something else that I’m not aware of. (I’m running HA 2022.12.8 - Supervisor 2022.11.2 - Operating System 9.4 - Frontend-version: 20221213.1 on a RPI4, and the screen is also using a RPI with a bare metal fullscreen version of Chromium)
Any toughts/ideas/help is much appreciated
Best regards from Belgium,
In the meanwhile I found a solution
Under linux, there is a tool called “xdotool”.
I can trigger a shell command from within HA via SSH, to the machine that is running the browser.
You also need to copy the RSA key from HA to the remote machine,
( ssh-copy-id) and add the user to the suoers group (sudo visudo).
Next you can create a shell-command in configuration.yaml like: click_middlescreen: ssh -i /config/ssh/id_rsa -o ‘StrictHostKeyChecking=no’ [email protected] sudo xdotool mousemove 960 540 click 1
Then, you will have a service available “shell_command.click_middlescreen”, that you can use in automations and scripts