How to disable HDMI at start of screensaver?

I use a Waveshare 7 inch display in combination with the touchscreen plugin on a Raspberry Pi 3. Following , I have modified the display such that the backlight is disabled if no HDMI signal is detected. However, if the screensaver is active, the HDMI output is not disabled but rather a black screen is sent. Therefore, the screen keeps glowing slightly. Using tvservice, I can manually disable the HDMI output and the backlight switches off. Now I’d like to write a script that detects whether the screensaver is active in order to switch the backlight. But all posts I could find recommend

xscreensaver-command -watch

which does not work on volumio. Does anyone have an idea on how to achieve this?