SmartThings and Logitech Harmony (Connect)

Wrapping up Home Automation is like waiting for road upgrades and repairs to be complete; it’s a continual process.

Now, I want to press a button (tile) to start a Spotify playlist on the Livingroom (Den) stereo. The first step is to integrate my Logitech Harmony with SmartThings. Most help on the internet involves the SmartThings Classic mobile app that has been removed by Samsung. From the SmartThings Groovy IDE, select My SmartApps and create a new one from Template selecting “Logitech Harmony (Connect)”. Publish it then go to SmartApps on the SmartThings Mobile app. Select “Logitech Harmony (Connect)” and let it discover the Harmony Hubs and Activities. A SmartThings blog entry helped with this one.

Samba Installation Condensed

Short version of Samba installation with user lynn:

sudo apt update && sudo apt upgrade -y
sudo apt install samba samba-common-bin -y
sudo smbpasswd -a lynn
sudo nano /etc/samba/smb.conf

[lynn]
path = /home/lynn
browsable = yes
writeable = yes
directory mask = 0775
create mask = 0775
public = yes
valid users = lynn

sudo service smbd restart
use ‘testparm’ to test samba configuration

Windows 11 Error

Update 8/30/25: Windows Explorer uses Windows Credentials to log in to Samba server. In my case, the credentials are different. Therefore ‘net use’ with ‘user=’ specified works with the Samba credentials. To override Windows Credentials with Windows Explorer, use Windows Credential Manager to add credentials for the Samba server.

Information Kiosks with Magic Mirror and DAKboard

As my home automation using SmartThings and ActionTiles has matured, I have moved beyond controlling smart devices to adding information to my kiosks. I’m using Magic Mirror on the wall mounted monitor in the kitchen and SmartThings/ActionTiles with DAKboard as a screen saver for the device control Fire HD tablets. This adds news, weather and calendar information to my wall mounted tablets and monitor.

Magic Mirror is ideal for a monitor because it has extensive configuration options. It was originally intended to be displayed on a monitor behind a two-way mirror. The variety of configuration modules makes it ideal for use as a standalone monitor. It uses a Raspberry Pi computer running Raspberry Pi OS. I used the Magic Mirror Central tutorial and an excellent video series from Caroline Dunn for my installation. ChrisAcrobat helped with Google Photos. I configured mine with modules showing local and national RSS news feeds, my Google Calendar and local weather with my Google Photos as the background. To avoid a JavaScript error, I changed the default browser to Chromium. I also had to delete and rebuild token.json at one point.

I used tutorials for the Spotify and Strava modules. You have to create an app for the Spotify and Strava modules. This will generate a client id and client secret used in the module section of config.js. The only important field is the authorization call back address which should be localhost. The authorization needs to be done from a browser on the Raspberry Pi.

Many 3rd Party Modules are available. Here’s where I found module positions.

DAKboard is less configurable than Magic Mirror but it can be used as a screensaver on Android tablets. I have configured it with date, time, news, weather and my Google calendar. It uses pictures from my Google photos for the background. The tablet camera works as a motion sensor to return to SmartThings/ActionTiles.

Here is the Magic Mirror display:

Notes:
pm2 stop mm
pm2 start mm
Google Photos module tutorial from roramirez.

IFTTT – If This Then That SmartThings Integration

IFTTT is a service to trigger an action in an application from an event in a different application using Applets. For instance, if Weather Underground reports that it will rain, it can trigger SmartThings to close the garage door.

The applications are called “services” in IFTTT. You need to identify devices in your application and give IFTTT permission to access those devices. From your avatar, select “My services”, select your service, settings, edit, sign in, then accept that IFTTT can use your devices. This may vary for different services.

For SmartThings device authorization, follow this procedure to the SmartThings website then select the devices to authorize IFTTT to use.

433 MHz RF Devices with Home Automation

Some of my first remote control switches and also my ceiling fan are controlled with 433 MHz RF signals. A Sonoff RF Bridge makes it possible to use these devices with home automation. To really be useful, the bridge should be flashed with Tasmota and Portisch. There is a Github article with instructions.

Once flashed, open a web page to the RF Bridge, go to the Console, enter rfraw 177 then press a button several times on your RF remote to pick out the correct (most frequent) sequence. This is the B1 code. Use the BitBucket Converter to convert the B1 code to a B0 code. The B0 code can be used to send an MQTT command, for example:

cmnd/sonoffRFBridge/Backlog RfRaw AAB0210314016703F924…0010101100255; RfRaw 0

On the RF Bridge console enter:

rfraw AA B0 21 03 08 00B4 0226 16A8 28181819081818190…819081819090818190908 55

Use Tasmota Connect to add the Sonoff RF Bridge as a SmartThings device. Note that the bridge is unavailable if it is open in another browser. Then add a virtual switch with the Portisch codes to control the device. I sent text messages with the B0 codes to past into the phone for use with SmartThings.

For the virtual switch use this for the On command and similar for the Off command:

Backlog RfRaw AA b0 21 03 08 00 … 0908 55; RfRaw 0

The Tasmota virtual switch worked fine for an on/off switch. I’m hoping this might help with the 433 MHz ceiling fan control.

SmartThings Ecobee Integration

My Ecobee smart thermostat lost it’s interface with SmartThings. The previous connection was created using the SmartThings Classic app which is no longer available. After struggling with installing the SmartThings Community Installer App then the Ecobee Suite Manager from Github I found that there is native support now in SmartThings. I simply installed the device from the SmartThings mobile app.

As with other devices, they must be authorized in ActionTiles before use. From the ActionTiles website, select location from My Locations, Add Devices (from location), select new device and click Authorize. The tiles can now be added using ActionTiles Panel Builder.

SmartThings Lighting Groups

It is difficult to turn a group of lights on and off with an ActionTiles tile. This post from URTechTherapy provides a solution for switching a group of lights on and off.

  1. Create SmartThings scenes for on and off
  2. Create SmartThings Lighting Group with all lights
  3. Create SmartThings Virtual Switch (add to “My Devices”)
  4. Create SmartThings Smart Apps Automation for each Scene (on and off)
  5. Create SmartThings Automations for on and off
  6. Authorize Virtual Switch to ActionTiles and add to panel

Add Den LEDs On scene with action on for both devices
Add Den LEDS Off scene with action off for both devices
Add Den LEDS Group group with both devices
Create Den LEDs Virtual Switch in SmartThings
Add SmartApp/Smart Lighting/New Lighting Automation/Activate these scenes

Home Automation with SmartThings et. al.

My attempts at home automation started back in the 1980’s with x10 devices with power line signaling. These devices are long gone. I’ve chased inexpensive and DIY additions ever since with a lot of effort and a lot of fun with a modest outlay. Here are some of my devices:

  • Etekcity 433 MHz RF switches and remotes
  • Amazon Echo, Echo Show, Dots, Fire HDs, Fire sticks, switches
  • OpenHab, then Home Assistant/MQTT
  • Google Chromecast, Chromecast Audio, Nest Hub, Chromecast with Google TV
  • Sonoff/Tasmota switches, power switches and RF bridge
  • Meross switches and garage door opener
  • Momentum garage door opener
  • Ambient Weather Station
  • Wireless 433 MHz ceiling fan remote control
  • Logitech Harmony remote controls with hubs
  • Wyze cams, pan cam, motion sensors, door sensors, home security
  • SmartThings Hub/ActionTiles

This creates a serious challenge for integration. I thought OpenHab could be the solution but it will be just one of the pieces. The difficulty is a bit too high for me. I plan to migrate to Home Assistant. Samsung SmartThings with the ActionTiles companion is my smart home integration solution now. There is a lot of support. The difficulty is reasonable. The use of cheap Amazon Fire HD tablets makes smart device information and control intuitive and convenient.

I started this phase of home automation with the addition of a SmartThings Hub. After installing the SmartThings app and the ActionTiles app on my phone, I rounded up various old tablets to get started. I planned to use wall-mounted tablets to control my smart home.

I solved two problems using a post by Andrew Connell. I had a broken and unneeded NuTone intercom. I also needed to power my wall mounted tablets. I removed the intercom base station and ran power into the the open hole. I added a monitor wall mount, an HP monitor and a Raspberry Pi for an information kiosk. This covered the open hole. I also added a 24 volt power supply to power the tablets.

I removed all the intercom speakers and used the speaker wires to provide 24 volts from the power supply. I used USB Buck Converters to drop the voltage to 5 volts for USB power to the tablets. I used mostly Fire HD 8 tablets with Makes by Mike wall mounts which covered the speaker holes. I used a Fire HD 10 for the main station in the master bedroom.

I used another post by Andrew Connell to configure the Fire HD’s as home kiosks for SmartThings.

Add VPN Unlimited to pfSense

I used this tutorial from VPN Unlimited to add VPN connection to pfSense. It was complicated but it worked. However, I was unable to use YouTube TV which doesn’t allow VPN connections. This blog described how to bypass VPN for a host. It worked. It involves adding a LAN Firewall Rule to avoid the VPN as the gateway. I would also like to simply switch the VPN and the WAN gateway for all traffic.

Data Analytics and Big Data

There is a lot of data, big data, available to make conclusions not possible before. Google makes a lot of big data available publicly. For instance by analyzing hundreds of millions of emails searching for the term ‘flu’ you could identify areas of flu outbreaks based on the heightened frequency of the word. This can be identified using data analytics tools. Excel for example can now process up to 100 million lines of data depending on your processing power.

In Tulsa, the mayor was able to identify the home county of the Trump Rally attendees based on GPS data from their cell phones. This data came from Google Mobility Data. I’m trying to put together the pieces, but I’m checking out Google TrendsGoogle Analytics, and R Analytics. I think R Analytics and/or Excel are the tools for working with big data.

Raspberry Pi Carputer

Here is what I’m starting out with:

  • Raspberry Pi 7″ touchscreen monitor (just ordered)
  • Monitor case (just ordered)
  • Raspberry Pi 3
  • GlobalSat BU-353-S4 USB GPS Receiver
  • USB sound card
  • USB Bluetooth Dongle 4.0 EDR Receiver
  • Logitech Wireless Touch Keyboard K400

Here’s a start on setting up the touchscreen monitor and a video. To flip the screen, edit /boot/config.txt and add lcd_rotate=2

Here’s a start on setting up the GPS module. Using Raspbian Jesse or later (Buster), you must disable a systemd service that gpsd installs then start gpsd:

sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket
sudo killall gpsd
sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock

Try running gpsmon, cgps -s, or xgps to get a live-streaming update of GPS data.

This video helped with “no fix”.

Here’s a start with ODB-Pi.

Here’s a start with Navit.

Add Hard Drive to Ubuntu Server

Install the internal hard drive or plug in the USB external hard drive. Use lsusb to show your external hard drive. Use fdisk to identify the new hard drives:

$ sudo fdisk -l | sd*

Start fdisk:

$ sudo fdisk /dev/sde

List partitions and delete existing partition and create new partition:

p (to list partitions)
d (to delete existing partition)
1 (which partition to delete)
n (new partition)
1 (new partition number)
default (start of partition)
default (end of partition)
y (to remove signature)
w (to write changes)

Next, make the file system:

$ sudo mkfs -t ext4 /dev/sde1

Hard Drive Larger than 2TBpar

parted /dev/sde
mklabel gpt
mkpart primary 0TB 12TB

$sudo mkfs.ext4 /dev/sde1

Copy Files from Old Hard Drive with Rsync

rsync -a /media/storage/ /media/hdd3


Creating an Ubuntu Repository

Setting up a local Ubuntu repository can be used to save internet bandwidth and to do updates with minimal or no internet connection. My starting point is a tutorial by LinuxConfig.

$ sudo apt install apache2
$ sudo systemctl enable apache2

$ sudo mkdir -p /var/html/mirror
$ sudo chown www-data:www-data /var/html/mirror

$ sudo apt install apt-mirror

Edit /etc/apt/mirror.list. Change base_path to the mirror directory. Change the ubuntu release name to match the release you are using. Comment out the source archives to reduce the size of the repository.

$ sudo cp /var/spool/apt-mirror/var/postrmirror.sh /var/mirror/var

$ sudo apt-mirror

$ sudo crontab -e

add the following line to update nightly at 2:30 PM:

30 02 * * * /usr/bin/apt-mirror

Configure Clients to use Local Repository

Edit /etc/apt/sources.list and comment any line referring to repositories not mirrored in your server

Ubuntu Networking Stuff

Fixed IP addresses for servers is obviously a good idea. I have used DHCP assigned permanent reservations as the easiest and most manageable way to use fixed addresses. IP addresses were assigned from a single pool. For me this was usually 192.168.1.101 for 100 addresses. Any DHCP assigned address could simply be tagged as a permanent reservation.

Pfsense changed this. The Pfsense DHCP server can still assign all IP addresses. However, they are “static mappings” rather than “permanent reservations”. The kicker is that the static mappings cannot be in the regular DHCP address pool. Since all my permanent reservations were dispersed throughout the address pool before pfsense, I had to start from scratch with static mappings.

Static IP Addresses

I have a server within the pfsense DHCP pool that needs to have a fixed address. I will assign it on the server and hope that pfsense doesn’t assign it to another device. I will eventually need to correct this.

On my new Ubuntu 18.04 server, I edited /etc/network/interfaces to change the DHCP assigned address to a static IP address as in the past. However, interfaces was empty and I realized I needed to modify /etc/netplan/01-netcfg.yaml. I changed it from this:

network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes

to this:

network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses:
192.168.1.199/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]

The indention is important. Using two spaces works fine. Unfortunately, WordPress removed the indentions from my examples.

Apply the changes with:

$ sudo netplan apply

Verify the changes with:

$ ip addr show dev ens3

To restart networking use:

sudo systemctl restart network-manager

OpenHab2 as Virtual Guest

OpenHAB is home automation software that connects to devices from different vendors. OpenHAB uses a Mosquitto (MQTT) server as a message broker so that clients and servers can post messages to each other. For example, OpenHAB posts a message for Light1 to turn on. Light1 is listening for Light1 messages and turns on.

I am using a couple of sources to install openHAB 2 as a virtual guest on my KVM server. I previously used Matt Kaczynski’s MK-SmartHouse excellent Video Guides for installing openHAB 2 on a Raspberry Pi using the openhabian image. I will use these guides in conjunction with openHAB’s installation guide for Linux. This works for apt based systemd systems. Note that Zulu 8 is a prerequisite.

$ sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 0xB1998361219BD9C9
$ sudo apt-add-repository ‘deb http://repos.azulsystems.com/ubuntu stable main’
$ sudo apt-get install zulu-8
$ wget -qO – ‘https://bintray.com/user/downloadSubjectPublicKey?username=openhab’ | sudo apt-key add –
$ sudo apt-get install apt-transport-https
$ echo ‘deb https://dl.bintray.com/openhab/apt-repo2 stable main’ | sudo tee /etc/apt/sources.list.d/openhab2.list
$ sudo apt-get update
$ sudo apt-get install openhab2
$ sudo apt-get install openhab2-addons
$ sudo systemctl start openhab2.service
$ sudo systemctl status openhab2.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable openhab2.service

Next is the MQTT server installation:

$ sudo apt update
$ sudo apt install mosquitto
$sudo apt install mosquitto-clients

Use MQTT.fx to test the installation.

At this point I am switching to MK-SmartHouse for configuration. The openhabian image for the Raspberry Pi has already done the work to this point.

I am migrating from the openhabian server on my Raspberry Pi. I plan to configure the server then copy the config files and hosts file from the old server.

Upgrading to OpenHAB 2.4

I broke OpenHAB after upgrading to OpenHAB 2.4 on my Raspberry Pi. You must also upgrade the mosquitto server. MK SmartHouse has a video to describe the process.

$ sudo apt-get remove mosquitto

From paper ui Addons /Bindings uninstall mqtt 1.0 binding.
From paper ui Addons / Bindings install mqtt 2.4 binding.
From paper ui Addons / Misc install Embedded MQTT Broker.
From paper ui Inbox select System MQTT Broker and add as thing.
Optionally from paper ui Configuration / Services, configure MQTT Embedded Broker.

Test MQTT with MQTT.fx.

From paper ui Inbox serch for things and select MQTT Binding then add manually then select Generic MQTT Thing (9:53)

Pickup with New Migration Tutorial

This is from OpenHAB.org.

From PaperUI inbox, add new thing and select MQTT Thing binding.
Add a new thing in PaperUI and select a Generic MQTT Thing and give it a name.
Edit the thing and add a new channel

Sharing Linux Files with NFS

Samba has been my go-to for file sharing on my network. However I want to use my ubuntu file server with my nextcloud server. I think it’s time for NFS. Digital Ocean comes through again with a good tutorial. The method is to “export” the directory on the server and “mount” the exported directory on the client. Export definitions are in /etc/export and mount definitions are in /etc/fstab.

server$  sudo apt install nfs-kernel-server

client$   sudo apt install nfs-common

server$  sudo nano /etc/exports

Enter export: /media/storage 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)

Use systemctl to manage the server: sudo systemctl status nfs-kernel-server.

Create the client mount point: mkdir -p /nfs/storage

client$  sudo mount fileserver:/media/storage /nfs/storage (to test path)

client$  sudo nano /etc/fstab

Enter the mount:                                                                                                                        fileserver:/media/storage /nfs/storage nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0 (You probably need a hosts entry for for the server named file.)

Refresh fstab: mount -a

Refresh exports: exportfs -ra

Update: LXC Containers

LXC containers are not priviliged to mount hard drives. The best practice is to mount the NFS share on the Proxmox host as above. Then use a bind-mount – edit /etc/pve/lxc/1xx.conf and add the line:

mp0: /mnt/storage,mp=/mnt/lxc_nfs_share

Mount Sequence with LXC Containers

For lack of a better place, it goes here. The Proxmox host cannot mount the file server NFS share until the file server starts. Jellyfin cannout mount the NFS the Proxmox host mounts the share.

Disable the fstab mount. Create a systemd mount unit. Here’s a sample /etc/systemd/storage.mount:

[Unit]
Description=Mount NFS share after LXC container 101 is ready
Requires=container@101.service
After=container@101.service

[Mount]
What=192.168.1.50:/export/storage
Where=/mnt/storage
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

Then enable it:

sudo systemctl daemon-reexec
sudo systemctl enable –now storage.mount

/et

Cloning KVM Guests and More

The umteenth time I created a KVM guest for ubuntu 18.04 LTS I decided to find a better method – cloning.

Clone the image

virt-clone – – original oldname – – name newname – – file newname.qcow2

Rename the image if necessary

  1. virsh domrename oldname newname (see this)
  2. virsh edit newname then change oldname to newname in the xml file
  3. mv oldname.qcow2 to newname.qcow2
  4. sudo nano /etc/hostname and change oldname to newname
  5. sudo nano /etc/hosts and change oldname to newname

Grow the image file

  1. qemu-img resize newname.qcow2 +3G (on kvm machine – newname must be shut down) (see this)
  2. virsh start newname
  3. virsh blockresize newname /var/lib/libvirt/images/newname.qcow2 15G
  4. fdisk -l newname.qcow2
  5. qemu-img info newname.qcow2
  6. lsblk
  7. apt install cloud-guest-utils (on guest machine)
  8. growpart /dev/sda 2 (see this)
  9. resize2fs /dev/sda2

Using SSH Keys

Use PuTTYgen to generate public and private keys. Paste the public key into /home/userid/.ssh/authorized_keys. Select Connection/SSH/Auth in PuTTY for each host entry to identify the private key. Retrieve the public key with the private key by clicking the ‘Load’ button in PuTTYgen. If you use a passphrase for added security, you must use it each time you log into a server. Here’s a place to start.