Enable and disable the HDMI signal of the Raspberry PI
npm install --save rpi-hdmi
const hdmi = require('rpi-hdmi');
hdmi.isConnected((err, hdmiState) => {
if(hdmiState)
console.log('HDMI is On')
else
console.log('HDMI is off')
});
const hdmi = require('rpi-hdmi');
hdmi.on((err) => {
if(!err)
console.log('HDMI is off')
});
const hdmi = require('rpi-hdmi');
hdmi.off((err) => {
if(!err)
console.log('HDMI is On')
});