Read the statement by Michael Teeuw here.
Auto power on and off
-
@natebrown enter crontab -e at the prompt and insert the data garbieflux mentioned.
If you struggle with the syntax, you can use several internet-pages to define the rules:
https://crontab-generator.org/
or
https://crontab.guru/ for exapmleI use
@reboot sudo sh -c ‘echo none > /sys/class/leds/led0/trigger’
@reboot sudo sh -c ‘echo 0 > /sys/class/leds/led0/brightness’
@reboot sudo sh -c ‘echo none > /sys/class/leds/led1/trigger’
@reboot sudo sh -c ‘echo 0 > /sys/class/leds/led1/brightness’
to turn off the LEDs at my RPI 3+Btw, an # at the beginning of the line marks it as a comment.
Or use a time-switch to turn on and off the whole construction.
Thomas
-
If you use a time switch to turn on and off the entire construction, you should still have a crontab to shut down the pi prior to shutting down the power, so you don’t corrupt your media.
-
Yes, @BKeyport idea is highly recommended:-)
-
I have a WiFi plug that switches the device on at a specific time in the morning.
I use a cron job entry to shut the Pi down at a specific time at night.
I have the WiFi plug turn off at a specific time at night, five minutes after the time I’ve configured the cron job to shut the Pi down.
There is also an IFTTT integration where you can have the shutdown script make a specific call to create a calendar entry on a Google calendar and IFTTT will pick up that entry and use it to trigger the power-off event for the plug. I used to do this until IFTTT changed their account structure and I’ve been moving away from using any of their integrations.
-
@garbleflux
Thanks, so i want it to turn on at 6:30 every morning and turn off at 9 every night, If i copy and paste that into crontab -e, will that work? What is the exact code i need? -
I did not test with there are motion detectors that turn on the screen when moving the front screen does not know how it works
https://www.swedx.se/product_info.php?cPath=137_12800030&products_id=1955
-
You can use also MMM-ModuleScheduler with MMM-Remote-Control to turn monitor on/off if you don’t need to turn off the whole system.
It works similar to crontab
Here is example from my mirror configuration
{ module: 'MMM-Remote-Control' // uncomment the following line to show the URL of the remote control on the mirror // , position: 'bottom_left' // you can hide this module afterwards from the remote control itself }, { module: 'MMM-ModuleScheduler', config: { notification_schedule: [ // TURN THE MONITOR/SCREEN ON At 10:00 {notification: 'REMOTE_ACTION', schedule: '00 10 * * *', payload: {action: "MONITORON"}}, // TURN THE MONITOR/SCREEN OFF At 00:00 {notification: 'REMOTE_ACTION', schedule: '00 00 * * *', payload: {action: "MONITOROFF"}} ] } }
-
If you wanna go down that path, there’s MMM-Remote-Control, too.
-
@hamid you can use a standard webcam (like the pi cam or a playstation camera like I do) and my module https://github.com/rejas/MMM-MotionDetector to detect motion and turn your monitor off and on.
-
@bkeyport said in Auto power on and off:
If you wanna go down that path, there’s MMM-Remote-Control, too.
I was looking at the option of turning off the monitor instead the rpi.
I have the MMM-Remote-Control installed, but i dont see a way to turn off the monitor automatically, there’s an option to turn on and off the monitor and it works well, but how do i automate it?