I have two questions regarding this.
(1) what should I do to get this working before it’s implemented into max2play?
(2) tvservice -n still reports that my asus monitor is plugged in when I turn off or unplug the monitor. Is there a way to update the tvservice status. As a workaround i think I just reboot the rpi to reset tvservice -n and thereby turn off kodi (once I understand how to do with the script). However, it would be much better if the status could be updated some how. Turning off and hdmi with tvservice -o and -p flags doesn’t help.