So that my MagicMirror is only on when I actually use it, I configured a little automation using NodeRed.
This means that the screen is only switched on when motion is detected.
The screen itself is switched on and off using the “vcgencmd” command. (More information here: https://www.raspberrypi.org/documentation/raspbian/applications/vcgencmd.md)
With the following NodeRed code you can turn the screen connected to the RaspberryPi (running NodeRed) on and off.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
To be able to import the NodeRed code, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.
The following three articles describe what needs to be done to prepare the RaspberryPi:
- RaspberryPi – setup for nerdiys!
- RaspberryPi – Tuee First configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- NodeRed – Installing NodeRed on the RaspberryPi
- NodeRed – Install new nodes
- NodeRed - import and export node code
Required tool:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Log into the NodeRed configuration interface
Before you can edit your NodeRed configuration, you must - if activated - first log into the NodeRed configuration interface.
Import node code
Importing the NodeRed code below will add the view shown below to your dashboard. For this to work you should already have the dashboard node installed and configured. You can find more information about this in the following article.
Information on how to import the NodeRed code into your NodeRed instance is summarized in the following article.
In the view shown on the left you can see which elements will be added to your dashboard.
- A “Turn off screen” button
- A “Turn on screen” button
- An “Update Screen Status” button
- The time course of the switch-ons and switch-offs
- A button that signals the monitor status
You can find the NodeCode in the Nerdiy Git repository at:
More articles about NodeRed
More articles about NodeRed including examples can be found at the following link.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂
Hello,
I also had the same idea 😉
but unfortunately I get an error 127 after the import...
Can it be because I want to turn off the screen via ssh remote to another rpi and that is not configured in the flow?
Can anybody help me with this?