MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    1. Home
    2. wi_brewer
    W
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 5
    • Best 1
    • Controversial 0
    • Groups 0

    wi_brewer

    @wi_brewer

    1
    Reputation
    324
    Profile views
    5
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    wi_brewer Unfollow Follow

    Best posts made by wi_brewer

    • RE: Turning monitor on/off when not in use.

      Thanks for the input, @cruunnerr and @martinkooij.

      I ended up going with @cruunnerr’s approach as it required fewer changes to my existing setup.

      Here is what I did:

      1. Created a file that lists the devices and their IPs that we want to evaluate. Filename: “devices”.
      myphone,192.168.0.200
      mywatch,192.168.0.201
      wifephone,192.168.0.202
      wifewatch,192.168.0.203
      
      1. Created a perl script, “ping.pl”, that pings the devices listed in the file. If it gets a response it will write the results to a file named “ping_results”.
      #!/usr/bin/perl
      use Net::Ping;
      open(INFILE, ";
      close(INFILE);
      #open(OUTFILE, ">", "ping_results") or die("unable to write output: $!");
      chomp(@ip_array);
      $p = Net::Ping->new();
      foreach(@ip_array)
        {
         if($_ =~ /\d+.\d+.\d+.\d+/)
            {
              if($p->ping($&))
                {
                  open(OUTFILE, ">", "ping_results") or die("unable to write output: $!");
                  print OUTFILE ("$`is responding to ping.\n");
                  close(OUTFILE);
                }
            }
        }
      
      1. Added a crontab job to run the perl script at 04:55.
      # m h  dom mon dow   command
      # Execute Perl Script to check for devices
      55 4 * * * perl /home/pi/ping.pl
      
      1. Created a shell script, “rpi-hdmi-on.sh” that will check to see if “ping_results” exists. If it does it will turn the monitor on and then delete the “ping_results” file. Added a crontab job to execute this script at 05:00.
      if [ -e ping_results ]
      then
              vcgencmd display_power 1 >/dev/null
              rm -f /home/pi/ping_results
      fi
      
      # m h  dom mon dow   command
      # Turn HDMI On (05:00/5:00am)
      0 5 * * * /home/pi/rpi-hdmi-on.sh
      
      1. Created a shell script, “rpi-hdmi-off.sh” that will turn the monitor off. Added a crontab job to execute this script at 21:30.
      vcgencmd display_power 0 >/dev/null
      
      # m h  dom mon dow   command
      # Turn HDMI Off (21:30/9:30pm)
      30 21 * * * /home/pi/rpi-hdmi-off.sh
      

      I’ve done some testing and it seems to be working well.

      posted in Troubleshooting
      W
      wi_brewer

    Latest posts made by wi_brewer

    • RE: MMM-COVID-19 (Deprecated)

      @Sean Thanks for the quick replies. What’s the minimum version required?

      posted in Health
      W
      wi_brewer
    • RE: MMM-COVID-19 (Deprecated)

      @Sean v7.10.1

      posted in Health
      W
      wi_brewer
    • RE: MMM-COVID-19 (Deprecated)

      Anybody know why I’m getting this error when I try to start MM?

      PHOTO

      posted in Health
      W
      wi_brewer
    • RE: Turning monitor on/off when not in use.

      Thanks for the input, @cruunnerr and @martinkooij.

      I ended up going with @cruunnerr’s approach as it required fewer changes to my existing setup.

      Here is what I did:

      1. Created a file that lists the devices and their IPs that we want to evaluate. Filename: “devices”.
      myphone,192.168.0.200
      mywatch,192.168.0.201
      wifephone,192.168.0.202
      wifewatch,192.168.0.203
      
      1. Created a perl script, “ping.pl”, that pings the devices listed in the file. If it gets a response it will write the results to a file named “ping_results”.
      #!/usr/bin/perl
      use Net::Ping;
      open(INFILE, ";
      close(INFILE);
      #open(OUTFILE, ">", "ping_results") or die("unable to write output: $!");
      chomp(@ip_array);
      $p = Net::Ping->new();
      foreach(@ip_array)
        {
         if($_ =~ /\d+.\d+.\d+.\d+/)
            {
              if($p->ping($&))
                {
                  open(OUTFILE, ">", "ping_results") or die("unable to write output: $!");
                  print OUTFILE ("$`is responding to ping.\n");
                  close(OUTFILE);
                }
            }
        }
      
      1. Added a crontab job to run the perl script at 04:55.
      # m h  dom mon dow   command
      # Execute Perl Script to check for devices
      55 4 * * * perl /home/pi/ping.pl
      
      1. Created a shell script, “rpi-hdmi-on.sh” that will check to see if “ping_results” exists. If it does it will turn the monitor on and then delete the “ping_results” file. Added a crontab job to execute this script at 05:00.
      if [ -e ping_results ]
      then
              vcgencmd display_power 1 >/dev/null
              rm -f /home/pi/ping_results
      fi
      
      # m h  dom mon dow   command
      # Turn HDMI On (05:00/5:00am)
      0 5 * * * /home/pi/rpi-hdmi-on.sh
      
      1. Created a shell script, “rpi-hdmi-off.sh” that will turn the monitor off. Added a crontab job to execute this script at 21:30.
      vcgencmd display_power 0 >/dev/null
      
      # m h  dom mon dow   command
      # Turn HDMI Off (21:30/9:30pm)
      30 21 * * * /home/pi/rpi-hdmi-off.sh
      

      I’ve done some testing and it seems to be working well.

      posted in Troubleshooting
      W
      wi_brewer
    • Turning monitor on/off when not in use.

      Hi All -

      I’m using a dual approach to turn my monitor off when it is not in use. The first is a cron job that turns it off at 9:30PM and back on at 5:00AM.

      I am also using MMM-Remote-Control and MMM-NetworkScanner to turn the monitor off when both my wife and I are not home, and back on when one of us returns.

      I am thinking there will be an issue when we are gone overnight. The cron job will turn the monitor back on in the morning and it will stay on all day since the network scanner will think that the monitor is still off from when we left.

      Trying to think of a solution to this, has anybody else encountered this or does anybody have a solution? Is there a way to set the network scanner to run the vacant command at a certain time, like 5:01AM, if no devices are found on the network?

      Thanks!

      posted in Troubleshooting
      W
      wi_brewer