For some reason it started to work.
But I’m not sure how to do to get the monitor status to work.
I have tried to make these changes. But it doesn’t work:
monitorControl: function(action, opts, res) { let status = "unknown"; let monitorOnCommand = (this.initialized && "monitorOnCommand" in this.thisConfig.customCommand) ? this.thisConfig.customCommand.monitorOnCommand : "vcgencmd display_power 1"; let monitorOffCommand = (this.initialized && "monitorOffCommand" in this.thisConfig.customCommand) ? this.thisConfig.customCommand.monitorOffCommand : "vcgencmd display_power 0"; let monitorStatusCommand = (this.initialized && "monitorStatusCommand" in this.thisConfig.customCommand) ? this.thisConfig.customCommand.monitorStatusCommand : "vcgencmd display_power"; if (["MONITORTOGGLE", "MONITORSTATUS", "MONITORON"].indexOf(action) !== -1) { screenStatus = exec(monitorStatusCommand, opts, (error, stdout, stderr) => { if (stdout.indexOf("display_power=0") !== -1 || stdout.indexOf("0") !== -1) { // Screen is OFF, turn it ON status = "off"; if (action === "MONITORTOGGLE" || action === "MONITORON") { exec(monitorOnCommand, opts, (error, stdout, stderr) => { this.checkForExecError(error, stdout, stderr, res, { monitor: "on" }); }); this.sendSocketNotification("USER_PRESENCE", true); return; } } else if (stdout.indexOf("HDMI") !== -1 || stdout.indexOf("true") !== -1) { // Screen is ON, turn it OFF status = "on"; if (action === "MONITORTOGGLE") { this.monitorControl("MONITOROFF", opts, res); return; } } this.checkForExecError(error, stdout, stderr, res, { monitor: status }); return; });