Read the statement by Michael Teeuw here.
27" custom framed magic mirror - fun to get done
-
@iwaldrum said in 27" custom framed magic mirror - fun to get done:
I’d love to hear how you have your motion sensor setup with fullpageOS. On my todo list…
This is far from perfect but it appears to work for me. Generally the screen is dim when I look at the mirror from afar or an angle but if I walk near it, it comes to life. I’m using the cheapie ol’ HC-SR501 motion sensor for this. I think I got a 5 pack for like 5 bucks on eBay. I actually have my sensor dangling at the bottom of my mirror, essentially aiming at the floor. These things are pretty darn sensitive it seems.
I essentially have the sensor hooked up to the Pi and and have converted the following Python script to a service that runs at startup. The monitor still has power but the HDMI signal is essentially disabled when motion isn’t detected with the tvservice command (whatever it is! ha).
/home/pi/motiondetector.py
import os import subprocess import time from gpiozero import MotionSensor pir = MotionSensor(4) while True: pir.wait_for_motion() print("Motion!") subprocess.call(["/bin/sh","/home/pi/scripts/refresh"]) os.system("tvservice -p; fbset -depth 8; fbset -depth 16") pir.wait_for_no_motion() print("No motion...") os.system("tvservice -o")
The sources I used to cobble this together:
Install gpiozero
https://gpiozero.readthedocs.io/en/stable/I think I had some issue getting the gpiozero module to load, but this thread looks familiar. I think the issue is I started with Jessie Lite.
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=126320Script as service
http://www.diegoacuna.me/how-to-run-a-script-as-a-service-in-raspberry-pi-raspbian-jessie/Sensitivity Adjustment (this takes some tinkering for sure)
http://henrysbench.capnfatz.com/henrys-bench/arduino-sensors-and-input/arduino-hc-sr501-motion-sensor-tutorial/You could probably gather all this with a few minutes of googling but I figured I’d share what I’ve cobbled together so far. A short range IR type sensor may be better if you only want the screen to activate when you get right in front of it, if you just want some mostly automated way of turning the screen off, this should work though.
-
Thanks ! I will give it a try!
-
@iwaldrum great, thanks. I’ll try. Any idea, how to refresh on “basic” Jess OS? Via cron? How?
unfortunately, on https://www.wunderground.com/weather-radar is just for US and so on, but Europe is not here. Please, any idea, how to add this
http://portal.chmi.cz/files/portal/docs/meteo/rad/data_jsradview.html
or better this
http://portal.chmi.cz/files/portal/docs/meteo/rad/inca-cz/short.htmlin the worst scenario
http://portal.chmi.cz/files/portal/docs/meteo/rad/mobile/ra6_30min.gifthanks, Zdeněk
-
Worked GREAT!
-
@iwaldrum can u pls share refres script? Maybe I can use it with Jessie
thanks, Zdenek
-
This is the refresh script included with FullpageOS. Not sure if you need anything else to be able to run it.
#!/bin/bash export DISPLAY=:0 WID=$(xdotool search --onlyvisible --class chromium|head -1) xdotool windowactivate ${WID} xdotool key ctrl+F5 xdotool key F11
-
@iwaldrum stupid question - what extension should have the file “refresh”?
-
@zdenek The script included doesn’t have an extension. If that doesn’t work for you try adding the extension of .sh
-
@disakos I just posted a module for pulling an RTSP Stream from my Hikvision Cameras. Check it out here:
[card:shbatm/MMM-RTSPStream] -
@iwaldrum so, I’ve installed xdotools, created script, but it doesn’t do anything… :-(