Picture Frame from a TV and RaspberryPi

Hardware used

Raspberry PI 3B+ you could also use a Pi Zero W, I already had the PI

Sceptre E205W-1600 2020 20″ 75Hz 

VideoSecu LCD LED Monitor TV Wall Mount

Short HDMI cable

Software used

Raspbian

Eye of Gnome

SFTP to map a drive to my Chromebook so I can just take new photos and drag them over into the folder.

SWISH installed on a windows PC or SFTP NET Drive so you can use SFTP like a mounted drive and and not install anything else on the Pi. Not something I needed but its here in case I change my mind or someone else wants an idea.

Installed raspbian.

Pricing out a twenty inch digital picture frame on Amazon they were in the $200 to $300 range. I put this together for under $125. It also lets me use wireless to move pictures into or out of the slideshow.

Change Eye of Gnome to set the time delay for the slideshow. Added eog-plugins to be able to randomize the slideshow.

gsettings set org.gnome.eog.fullscreen seconds N <N= number of seconds between slides>

sudo apt-get install eog-plugins

Edited crontab -e to start and stop the slideshow on a schedule. vcgencmd is used to start and stop output on the HDMI port starting at 8 AM and stopping at 9 PM. I Used Crontab Guru online tool to help set the times. The vgencmd commands are to turn the display off at 9 PM and turn it back on at 8 AM, then at 8:01 start the slideshow.

0 8 * * * vcgencmd display_power 1 <Turns the screen back on at 8AM>
1 8 * * * /home/pi/scripts/display.sh
0 21 * * * vcgencmd display_power 0 <blanks the screen at 9PM>

Wrote a couple scripts to start the slideshow. Make the scripts executable “chmod 755 <script.sh>” and put all the scripts in a folder named scripts.

display.sh
DISPLAY=:0.0 /home/pi/scripts/runslideshow.sh

runslideshow.sh
eog –slide-show /media/Slides/

Used screen to run testing of the scripts.

screen -ls to list screens

screen -r <screen number> to reattach to a screen

The screensaver would kick on after a while and the temperature would go to 84.9’C or higher sometimes. So I disabled the screensaver completely in the GUI. the problem seems to have gone away with that change.

Things to do.

Make a wooden frame for the TV so it looks like a picture frame?

Clean up the power cables

Hubitat

I decided to move my smart home devices to Hubitat from SmartThings. The hub is small about two by two inches and half an inch thick. It uses an external Z-wave/Zigbee stick. About Half the size of my SmartThings hub. I have used the SmartThings hub since December 2016.

Yes that USB adapter sticks out the side of the hub, making it look like an afterthought. Setup was smooth and their interface works well. I think it works better than using the interface for SmartThings however there is no app that can be used to easily control devices when I’m not home. They do allow some web links back to the hub but these seem to work intermittently so far, mostly due to my connection not being stable on my phone. The idea is to automate things as much as possible and keep traffic local so its a trade off. I didn’t have to much trouble with the SmartThings hub, but I don’t see the need to have everything out in the cloud when most of this gets managed locally and has no need to leave the house.

Devices I have moved over so far include.

  • Yale YRL220 lever locks. Removing from SmartThings was a little troublesome but they paired right up with Hubitat and Hubitat was able to read the existing codes from the locks as well as add and delete new codes. I think the removing was just an issue with how I did the removal. I should have read the instructions before starting. October 2017
  • Sengled E11-G13W Smart LED Soft White (Element Classic) Bulb Zigbee. Removed from SmartThings and paired up with Hubitat no problems. October 2018
  • Tuya Smart devices. These devices use the Tuya Smart app and I”m still working on getting that setup in the house. It requires an external node.js server running on my Raspberry Pi. I haven’t set all of this up yet.
    • Wireless Garage Door Opener Remote WiFi Switch Universal Controlled by Smartphone. I can control up to three devices with this and it uses a proximity sensor to indicate if a door is open or closed. 2018
    • Martin Jerry mini Smart Plug 2017
  • Everspring ST812 Z-Wave Wireless Flood Detector Haven’t moved this one yet. 2018
  • Wemo Switches work over WiFi, no problems connecting them but some issues with getting them to work remotely consistently. These were my introduction to IoT devices and I have them placed where I can’t easily get to light switches. They have been very reliable with my first one installed for about three years now. December 2015
  • Samsung SmartThings Water Leak Sensor Zigbee. Battery lasts about a year and works well for leaks. I would not place it where it can be submerged. Moved over from SmartThings to Hubitat with no problems. September 2016
  • Samsung SmartThings GP-U999SJVLCAA Smart Water Leak Sensor, Zigbee. Paired up no problems and reads temperature fine. September 2018
  • Samsung SmartThings GP-U999SJVLAAA Door and Window Multipurpose Sensor, Zigbee. This has a tilt sensor in it and so far Hubitat is not reading that correctly. I want to use the tilt sensor on the garage door to let me know if the door is open or closed. September 2018
  • Sonoff Basic using Tasmota firmware no luck with these so far. These are using WiFi. 2018
  • Kankun Smart Switches WiFi, from a variety of manufacturers. These all run OpenWRT and are controlled with some json code in SmartThings. No luck with getting the groovy code from SmartThings to Hubitat yet, but I haven’t spent much time with this so far. I get an error on line 127 right now that I need to dig into. With some help from the Hubitat forums, I changed physicalgraph with hubitat in the code on line 127 and it works now. These are all the same device sold by different companies.
    • Amcrest 2015
    • JTD 2016
    • QISC  2017
  • Sensi UP500W Thermostat on WiFi. I haven’t done anything on this yet it didn’t work under SmartThings and I don’t know if I’ll even try to move this onto Hubitat. December 2016
  • Ring Doorbell Pro and Spotlight Camera Plugin. I haven’t tried anything with this yet. I am using IFTTT with the Wemo app to turn on lights when I arrive home and this works well, but it is outside of Hubitat. 2017
  • Zooz Z-Wave Plus Smart Plug ZEN06 VER. 2.0 with 2 USB Charging Ports, White. This is on order from Amazon and I’ll use it in the garage as a repeater for the Z-Wave network. Setup was easy with Hubitat, no problems. The size of this plug is a bit on the large side, but it is designed to only cover one outlet in a duplex. December 2018
  • Leviton Z-Wave VRPD3-1LW Vizia RF + Series 300 Watt Plug-In Lamp Dimming Module for CFL and LED. Worked no problems bringing it from SmartThings to Hubitat. January 2017
  • Leviton DZPA1-2BW Decora Smart Plug-in Outlet Z-Wave Plus. Worked no problems bringing it from SmartThings to Hubitat. December 2017
  • Aeotec Range Extender 6, Z-Wave Plus repeater, Aeotec Range Extender 6, Z-Wave Plus repeater It was tough to get this to link up the first time with Hubitat but it did eventually connect and is working well now. I could have just as easily used a plug with Z-Wave Plus and gotten the functionality of the of the plug for about the same price. December 2018
  • Aeon Labs Aeotec Z-Wave Gen5 Multi-Sensor (Z-Wave Plus) I had given up on this with SmartThings mostly because of battery life being useless. With Hubitat and four fresh AAA batteries it seems to be working well so far. December 2016
  • Aeotec TriSensor, Z-Wave Plus S2 Motion, Temperature, Light Sensor, 3-in 1 Paired up quickly and working well for about a week or two now. November 2018
  • Z-Wave Plus Gold Plated Reliability Garage Door Tilt Sensor, White (TILT-ZWAVE2.5-ECO). Connected up with a couple of tries removing and putting the battery back in. Contact sensor works with the gerneric z-wave contact sensor driver from Hubitat. December 2018

Garage Door Opener with WiFi

I bought this switch from Amazon its listed as the wireless garage door opener remote WiFi switch universal. I connected terminals L and N to 110 volt AC power I connected this to twelve volts DC on the red and black wires and the black and green wire to a door magnetic contact sensor for an indicator to let me know if the door is open or closed. The light in the bottom center is the indicator for open or closed door. Light on door is open and off is closed.

The instructions are a bit weak so I’m unsure what that red wire is for, I’m just going to cap it off for now. Even the instructions on the back of the device seem a bit unclear. The paper that came inside the box had the usual small print that required a magnifying glass and just wasn’t clear. It turns out using the red and black wire connected to a 9-30V DC power supply this can be run without the AC connection I tested with.

A will be for the positive to the garage door opener and Com to the negative. You can use B and Com for a second door and C and Com for a third door or gate. However you only get one open and close indicator for all three. I’m going to use this to replace the wall switch for the garage door and give me the option to use WiFi to open and close the door as well as monitor the status of the door. I also ordered a type 86 wall junction box to put this in and mount it to the wall.

I used the Tuya Smart phone app for control and integrated this with my Home Assistant setup running on a Raspberry Pi. I chose Tuya Smart because I already have this setup for several other devices.

The device has lost the WiFi signal several times. I exchanged a couple of emails with the seller HeJue and that has proved pretty useless so far as the emails just seem to generate a couple of canned replies.

“Hi Jonathan Smith, Sorry for the inconvenience. First of all, we need to confirm a question with you, have you connected all the wires correctly? Can you control the opener by touch our switch button? If yes, it means that the wiring are correct. Then comes to check the WIFI. Pls kindly make sure that your WIFI router is 2.4G, attached is the FAQ list for your reference, pls kindly check it to make sure your WIFI meed the demands. Waiting for your reply. Regards, Hejue”

Since it does work but is dropping the WiFi connection randomly, I’ll guess the wiring is correct. I ended up setting up a cronjob with two pings every five minutes and this has kept the device online for about forty eight hours now. Rock solid for over a week now.

It looks like these are just a NodeMCU with momentary relays and the power supply built in. Below is what it looks like in Home Assistant. For some reason Home Assistant doesn’t see my renaming of Button A to Garage Door. With a restart of Home Assistant it eventually picked up on the renames.

Cable Modem Woes

I’ve since returned this modem and have basic modem with one ethernet port and phone jacks. I was using an Arris cable modem which is proving to be garbage.

System: ARRIS DOCSIS 3.0 / PacketCable 2.0 Touchstone Telephony Gateway
HW_REV: 5
VENDOR: Arris Interactive, L.L.C.
BOOTR: 1.2.1.61
SW_REV: 7.5.63C.SIP.PC20.TW
MODEL: TG862G
Battery Charger FW Rev: 02.10
 Firmware Build and Revisions
Firmware Name: TS070563C_032913_MODEL_862_GW_TW_SIP_PC20
Firmware Build Time: Fri Mar 29 11:42:55 EDT 2013
eSAFE 0 FW Revision: 2.0.40_0920E

I tried to do DHCP reservations and it seems these just fail with no error displayed.  I wanted to change the subnet it uses and that isn’t allowed either. Wireless seems to lock up randomly and requires a reboot. I have multiple AP’s and funnel DHCP back to the Arris so usually I just end up on an AP that is farther away that what is ideal for my setup.

I built a DHCP server on my Raspberry Pi as a work around to not being able to reserve an IP and have that working smoothly for a couple of days now. I’m considering getting a different modem with out wireless or the phone ports ( I don’t use the phone ports) and then maybe a Ubiquiti Networks UniFi AP Enterprise WiFi System UAP-3 and using that so all of my APs would be from one manufacturer and work together better. Currently I’m using a mish mash between the cable modem and other old AP’s that people have discarded. I just don’t want to spend the $180 or so that it costs to get this equipment and use Ubiquiti’s proprietary POE.

Raspberry Pi email IP at boot

I found a bunch of what seem complicated answers for how to do this. I made my own eventually just using bash and adding it to /etc/rc.local, turns out I didn’t need to have it in rc.local either, if I put it in /etc/network/if-up/ and made it executable.

#!/bin/bash
#Send an email with the local IP
#sleep added to give me a wait to the process during boot and before remove to give the #script some time to run. These may not be needed. Adjust as needed.
sleep 5
#grep -v added to trim out some extra info from the file
#date added so it would append a time stamp to file
ifconfig | grep inet | grep -v inet6 | grep -v 127.0.0.1 >> file.tmp | date >> file.tmp
#-s after mail gives me a subject line
echo “$(cat file.tmp)” | mail -s IPaddress <email@domain.com>
sleep 5
rm file.tmp

I added this line to /etc/rc.local, but I was getting two copies of the email on boot up. So I deleted it.

/etc/network/if-up.d/mailip-1

If I wanted my external IP I could add a line like below. Maybe put a line in cron to run the script every so often and get this info at times other than when I boot the Pi or when renewing the IP.

dig +short myip.opendns.com @resolver1.opendns.com >> file.tmp

To get dig I had to add apt-get install dnsutils.

Raspberry Pi Term Server

So I got this idea online to make my own terminal server with a Raspberry Pi and ser2net.

Hardware needed.

  • UGREEN USB to Serial RS232 Cable Adapter 4 Ports DB9 Converter 9-Pin Male to Male with Hexnuts
  • Raspberry Pi

Software installed.

  • Raspbian Stretch Lite I’m running this on Buster now
  • Ser2net
  • UFW
  • Screen

I think a Pi Zero could also do the job and save a few dollars. So far it remembers the port numbers on reboot and my config is good but I’m working on getting the logging to work the way I want it.

Install ser2net running Raspbian Stretch:

apt-get install ser2net  Then edit /etc/ser2net.conf with your USB to information that I got from running “dmesg | grep tty”.

[ 4.518967] usb 1-1.5.1: pl2303 converter now attached to ttyUSB0
[ 4.523283] usb 1-1.5.2: pl2303 converter now attached to ttyUSB1
[ 4.535015] usb 1-1.5.3: pl2303 converter now attached to ttyUSB2
[ 4.539260] usb 1-1.5.4: pl2303 converter now attached to ttyUSB3

And my ser2net.conf looks like this.

2000:telnet:600:/dev/ttyUSB0:9600 8DATABITS NONE 1STOPBIT banner
2001:telnet:600:/dev/ttyUSB1:9600 8DATABITS NONE 1STOPBIT banner
2002:telnet:600:/dev/ttyUSB2:9600 8DATABITS NONE 1STOPBIT banner
2003:telnet:600:/dev/ttyUSB3:9600 8DATABITS NONE 1STOPBIT banner

<TCP port>:<state>:<timeout>:<device>:<options>

apt-get install ufw

sudo ufw default deny

sudo ufw allow ssh

sudo ufw enable

sudo ufw status numbered

Installed screen:

sudo apt-get install screen

screen -S term <to open a screen with the name term>

To use the terminal server I ssh in and then run screen and open a terminal in there. The advantage to that is I can leave the terminal running during an upgrade and go get some milk and cookies.

telnet 127.0.0.1 2001

RANCID on Ubuntu setup

Best Tools for Monitoring and Administering your LAN/WAN network better!!!: How to setup and configure Rancid integrated with …:

They covered almost everything there correctly for me but I did run into a few things I had to change..
apt-get install rancid cvsweb cvs
I’m using MS RADIUS for AD user integration and privilege level 15 on login and SSH so I needed to set:
add autoenable  *       1
add user        *       username
add password    *       userpassword     
add method      *       ssh

In /var/lib/rancid/.cloginrc.

I also used “su -s /bin/bash rancid” to change to the rancid user and run all the needed commands from there.
“/var/lib/rancid/bin/rancid-cvs”
“/var/lib/rancid/bin/rancid-run”
“crontab -e”
“1 10 * * * /usr/local/rancid/bin/rancid-run”
Edit that time in crontab to run at whatever interval you like.

I used exim4 for mail and it was installed by default. Edit /etc/aliases and restart mail “service exim4 restart”.
Everything pretty much worked out of the box.

More MS RADIUS setup information.

Ubuntu 11.10 upgrade from 11.04

After the upgrade I ran into a few problems during boot up. The first one was an error during boot regarding vga=733 and gfxpayload. To fix this I changed a line in /etc/default/grub.
#GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
#GRUB_CMDLINE_LINUX=” splash vga=640″
GRUB_GFXMODE=1024x768x24,1024×768
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
GRUB_CMDLINE_LINUX=””
I suppose I only needed that one line.

GRUB_GFXMODE=1024x768x24,1024×768
And to comment out the line.
#GRUB_CMDLINE_LINUX=” splash vga=640″

Next I have to figure out why it stops booting at a line about pulseaudio. Dmesg has nothing about this error and in order to get to X I ctrl fn F2 and log in with my user, then sudo gdm start and it goes back to the failed screen and starts X.
Boot fails here
PulseAudio configured for per-user session
saned disabled; edit /etc/default/saned
Sometimes I would see a message about checking battery state, which led me to some posts about nvidia drivers causing similar problems. I have an Intel chipset so I figued this was a wrong answer. I did find some references to lightdm and gdm being part of the problem.
I uninstalled  lightdm “apt-get remove lightdm” and then reinstalled “apt-get install lightdm” this also removed and reinstalled ubuntu-desktop. A quick reboot and I’m booting into X with no visible errors unless I look in the logs.

NSLU2 replacement

I’m looking for a possible replacement should my NSLU2 die off suddenly. I found Raspberry PI today and thought it might be a good deal if it is ever released for sale.
Twenty five bucks for the A series but I think I’ll need to wait for the B with built in/on networking. No case doesn’t seem like a big problem I am sure I could find something this will fit inside of.

I’m running wview for my weather station on the NSLU2 and since the Raspberry Pi will run Debian I think this should work just fine for my needs.