SvenVD / rpisurv

Raspberry Pi surveillance
https://community.rpisurv.net
GNU General Public License v2.0
621 stars 101 forks source link

Ability to add widgets or browser tabs? #146

Closed ajquick closed 2 years ago

ajquick commented 2 years ago

Long story short, I want to have my video feeds only taking up 1/4 of the screen and was wondering if there was any way to add additional things to the screen?

I'd love if I could display a webpage to the side of the cameras and/or display useful information.

Widget ideas:

I will probably create dynamic images that update on a schedule if that's the only way.

SvenVD commented 2 years ago

If you can convert your information to an image and host that on a webserver ( or local image), point Rpisurv to it, then Rpisurv will fetch and keep it fresh. If change information on the image, then Rpisurv will refresh by default every 19 seconds

ajquick commented 2 years ago

Tutorial for adding Google's Weather to your screen. This will run every hour and relies upon this project: https://github.com/maaaaz/webscreenshot

sudo pip install webscreenshot
sudo apt-get update
sudo apt-get install xvfb
sudo apt-get install phantomjs
crontab -e

Add the following code to your Crontab:

0 * * * * /usr/local/bin/webscreenshot -z "weather.png" --no-error-file --crop "175,60,665,350" https://www.google.com/search?q=YOUR+CITY+weather >/dev/null 2>&1

Replace YOUR+CITY with whatever your city and state is.

Add to your display.yml file:

- url: "file:///home/pi/weather.png"   
  imageurl: true
SvenVD commented 2 years ago

Thats really nice, thanks for sharing!

ajquick commented 2 years ago

Another neat thing I just got working.

The ability to control screen rotation using the TV remote over HDMI (since I am using a TV, not a PC monitor).

Need to install cec-client by using the following: https://github.com/Pulse-Eight/libcec

Libcec, requires installing a compiler and compiling the scripts on your Pi, but once it's done cec-client becomes available.

After that you need to run cec-client at boot and feed the messages into a script as follows:

cec-client | /home/pi/cec.sh

The file cec.sh has the following code:

#!/bin/bash
while read oneline
do
   keyline=$(echo $oneline | grep " key ")
   if [ -n "$keyline" ]; then
      strkey=$(grep -oP '(?<=sed: ).*?(?= \()' <<< "$keyline")
      strstat=$(grep -oP '(?<=key ).*?(?=:)' <<< "$keyline")
      strpressed=$(echo $strstat | grep "pressed")

      if [ -n "$strpressed" ]; then
         case "$strkey" in
            "left")
                sudo python /home/pi/firstscreen.py
                ;;
            "right")
                sudo python /home/pi/nextscreen.py
                ;;
         esac
      fi
   fi
done

There are also two Python files (because I couldn't get the Python to execute directly in the Bash file). This will require pip install keyboard (saw it on the API repo).

firstscreen.py:

import keyboard

keyboard.press_and_release('F1')

nextscreen.py:

import keyboard

keyboard.press_and_release('n')

Boom. The left button on my remote goes to screen 1 (F1). The right button goes to the next screen.

You can also mess around with other buttons and features such as setting up to start cycling, down to stop cycling... and any number keys can correspond to which screen you want. Ideally it would also check to see if the TV is on and if it isn't, then Rpisurv would shut down until the TV resumes showing the security cameras.

More info here: https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250

SvenVD commented 2 years ago

Nice stuff, On the forum we also had this https://www.tapatalk.com/groups/rpisurv/show-weather-forcast-t165.html#p838