Make the screen actually turn off via annyang.
Saving a lot of electricity!
Best case scenario here we stop outputting video signal out of HDMI. Depending on the monitor this may trigger a power saving "standby" mode, some models even have a configurable "standby" mode - you can never actually turn the monitor without the addition of some hardware.
I haven't been able to test this yet, but theoretically you can do this with
/opt/vc/bin/tvservice -p && /opt/vc/bin/tvservice -o
and wake it up with
/opt/vc/bin/tvservice -p && chvt 1 && chvt 7
I've tested this and it works. My monitor is going into power saving mode.
I put this code in header of index.html (there might be a better place for this?)
<script>
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
</script>
and in controller.js I add the following to go to sleep command
exec("/opt/vc/bin/tvservice -p && /opt/vc/bin/tvservice -o", puts);
and the following to wake up command
exec("/opt/vc/bin/tvservice -p && chvt 1 && chvt 7", puts);
@mrtruebeliever, looks good. I have tried this as well and seems to be working quite nicely. I wrapped that code in a try catch so during development on my main machine it would be handled nicely when exec() doesn't exist.
try
{
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
}
catch(err) {
function puts(error, stdout, stderr){}
function exec(arg1, arg2){}
}
Can someone make a pull request if it is done?
I'm happy to add it in my PR (https://github.com/evancohen/smart-mirror/pull/121), as I already have it working on my local branch. If no body objects to this, I will update that in roughly 6-7hrs.
@missionrulz please add it to a new PR. It will make it easier to review.
Is this actually implemented? I downloaded the version from about a week ago, but I don't have the above references in controller.js nor index.html.
@gnurph69 you need to be using the dev branch.
When will this be merged with master?
@SenadM #128 is already in master, I think I just forgot to close this issue. For reference, the file that does the legwork here is autosleep.js