JTK – Notes and Ramblings Things we have found …


VirtualHere remote USB

Filed under: General — taing @ 2:16 pm

We have used VirtualHere before. This time I thought it might be fun to try it for the iPlayer3 and SmartJackPro. This would involve both ColorPlay3 and QuickPlayPro. The good news is it works. I was able to upload a show to the iPlayer and output DMX from the SmartJackPro. I have not yet tried addressing a fixture via the SmartJackPro.

The remote is a Raspberry Pi 3 running Raspbian Lite Buster(2020-02-14).

The PC is running Windows 10 64-bit.

Server Side

VirtualHere has a download for ARM that runs quite well on the Pi 3 on their Linux server download page. A simple wget https://www.virtualhere.com/sites/default/files/usbserver/vhusbdarm into the folder of your choice followed by chmod +x ./vhusbdarm and sudo vhusbdarm -b and you are set on the server side.

The VirtualHere FAQ describes how to have the server setup to start as a service. The steps for a Pi are pretty straighforward: First you need to copy the server over to /usr/bin: sudo mv vhusbdarm /usr/sbin. Then you will need to create /etc/systemd/system/virtualhere.service with these contents.

Description=VirtualHere USB Sharing
ExecStartPre=/bin/sh -c 'logger VirtualHere settling...;sleep 1s;logger VirtualHere settled'

Then the following commands will setup the service to run at boot.

systemctl daemon-reload
systemctl enable virtualhere
systemctl start virtualhere

NOTE: a license is required to 1) share more than one device with the server or 2) use the CPU optimized versions of the server or 3) sell VirtualHere with your hardware. As of April 2020 the license cost $49. The license key is tied to the hardware of the server.

Details on advanced configuration of the server can be found here.

Client Side

The client is downloaded from the VirtualHere site. There are versions for Linux, OSX and Windows. The download is a single executable file. The first run will install the VirtualHere client drivers and will require admin rights.

The documentation on running the client as a service can be found here. You can not use the client as a service unless the server has a license installed.

The client will offer to install Bonjour, it the server is not already installed, for its auto-discovery feature.

Advanced configuration information and command line parameters are described here.

Open Lighting

Filed under: General — taing @ 10:10 am

Installing Open Lighting Architecture on a Raspberry Pi 3.

We start with a clean install if Rasbian Buster Lite. As of April 2020 the raspian repo has the latest version – 0.10.7 so a simple sudo apt-get install ola will suffice. You can confirm the version in the repo with apt show ola. There is additional info on using ola installed from apt here. The info is older but still useful.

If you want to do things the hard way, follow the instructions for a Linux install from git. The Raspbian images for OLA are several years out of date. We will install a bunch of prerequisites first, checkout the project from git, then config and build.

sudo apt-get install libcppunit-dev libcppunit-1.13-0 uuid-dev pkg-config libncurses5-dev libtool autoconf automake g++ libmicrohttpd-dev protobuf-compiler python-protobuf libprotobuf-dev libprotoc-dev zlib1g-dev bison flex make libftdi-dev libftdi1 libusb-1.0-0-dev liblo-dev libavahi-client-dev python-numpy

sudo apt-get install git
git clone https://github.com/OpenLightingProject/ola.git ola
cd ola
autoreconf -i

If there are config changes to make of modules to enable. The sample below shows enabling RDM test.

./configure --help
./configure --enable-rdm-tests

Now we are ready to build. This will take a bit of time.

make check
sudo make install
sudo ldconfig

If everything went well we are ready to start ola.

olad -l 3

You can view the web gui at http://<host>:9090.


Weather radio part 4

Filed under: General,Home Automation,RTL-SDR — taing @ 1:23 pm

Continuing the weather radio development. I found some notes on to try sox instead of lame for the encoding for ezstream. This requires installing the mp3 library for sox with sudo apt-get install libsox-fmt-mp3. This appears to provide for somewhat better sound quality.

This means we replace

lame --bitwidth 16 --signed -s 22050 --lowpass 3500 --abr 64 --scale 8 -r -m m - -


sox -t raw -r 22050 -b 16 -e signed -c 1 -v 7 - -r 22050 -t mp3 -c 1 -C 64 - sinc -3.5k

The final line:

rtl_fm -f 162550000 -s 22050 -p 14 | tee >(sox -t raw -r 22050 -b 16 -e signed -c 1 -v 7 - -r 22050 -t mp3 -c 1 -C 64 - sinc -3.5k |ezstream -c ezstream.xml) | multimon-ng -t raw -a EAS /dev/stdin | python ~/tg-dsame/dsame.py --no-text --mqtt jtk-pi2 --json output.json

Something for the future – Roku

Filed under: General — taing @ 12:45 pm

bwarden has also got a git repo for the python control of the roku which is a fork of https://github.com/jcarbaugh/python-roku. It seems to support basic control and discovery. The discovery code is SSDP which may prove useful elsewhere.

For openhab integration there is a good forum discussion

Weather Radio Part 3

Filed under: General,Home Automation,RTL-SDR — taing @ 10:19 am

The weather radio scripts from before had issues. The live stream from the SDR was working but the alerts were never being triggered so further work was needed.

There are now at least two other forks of the original dsame project. From nivex we have some reworking of the main dispatch routine. And from bwarden we have a reworking of the parser.

I have cloned bwarden as the new starting point and merged a portion of the nivex changes. A copy of this version of dsame.py can be found here. Or you can look at my fork on github.

Step 1 was to get the output into a json format without the text. Fortunately, this is pretty much built it. For a test using the sample txt file:

python dsame.py --no-text --json /dev/stdout <sample\ alert/WXR-RWT.txt

This has the added bonus of writing to standard out immediately and not waiting/buffering until process end.

With this working lets try to update dsame.py to output to MQTT. I’m working from a machine that already has Mosquito installed along with the Python paho library.

Let’s try adding a bit to the dsame code. The big piece looks like:

            if mqtthost:
                    import paho.mqtt.publish as mqtt
                    import json
                    data=kwdict(ORG=ORG, EEE=EEE, TTTT=TTTT, JJJHHMM=JJJHHMM, STATION=STATION, TYPE=TYPE, LLLLLLLL=LLLLLLLL, COUNTRY=COUNTRY, LANG=lang, event=get_event(EEE), type=get_indicator(EEE), end=fn_dt(alert_end(JJJHHMM,TTTT)), $
                    mqtt.single('raw/weatherAlert',json.dumps(data), hostname=mqtthost)
                except Exception as detail:

Hopefully he output looks something like this(extra linefeeds added for clarity):

{"LANG": "EN", 
 "organization": "National Weather Service", 
 "end": "07:30 PM", 
 "JJJHHMM": "3650000", 
 "COUNTRY": "US", 
 "PSSCCC": "020103-020209-020091-020121-029047-029165-029095-029037", 
 "seconds": 1800, 
 "PSSCCC_list": ["020091", "020103", "020121", "020209", "029037", "029047", "029095", "029165"], 
 "start": "07:00 PM", 
 "length": "30 minutes", 
 "TTTT": "0030", 
 "location": "Pleasant Hill, Missouri", 
 "date": "Thu Apr  2 20:44:27 2020", 
 "type": "T", 
 "EEE": "RWT", 
 "ORG": "WXR", 
 "MESSAGE": null, 
 "TYPE": "NWS", 
 "event": "Required Weekly Test"}

The new command line to stream and send mqtt looks like:

rtl_fm -f 162550000 -s 22050 -p 14 | tee >(lame --bitwidth 16 --signed -s 22050 --lowpass 3500 --abr 64 --scale 8 -r -m m - - |ezstream -c ezstream.xml) | multimon-ng -t raw -a EAS /dev/stdin | python ~/tg-dsame/dsame.py --no-text --mqtt hostname_here --json output.json
  1. receive from the SDR dongle
  2. split stdin – tee redirects to
    1. lame
    2. ezstream
  3. tee pipes to
    1. multimon-ng
    2. dsame script – sends to
      1. mqtt
      2. json appends to output.json file

A different option to multimon-ng might be minimodem. I claims to convert SAME audio to text and back again.


Doorbell and Gas meter

Filed under: Home Automation,RTL-SDR — taing @ 3:51 pm

In looking for the Honeywell doorbell, model RCWL330A, FCC ID HS9-51459SL, which should be at 916.8MHz I found my gas meter (rtl_433 device 149). The output looks like:

time      : 2020-04-02 14:04:27
model     : ERT-SCM      Id        : 5458xxxx
Physical Tamper: 3       ERT Type  : 24            Encoder Tamper: 0         Consumption Data: 525682
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2020-04-02 14:05:02
model     : ERT-SCM      Id        : 5600xxxx
Physical Tamper: 0       ERT Type  : 8             Encoder Tamper: 0         Consumption Data: 208204
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2020-04-02 14:07:28
model     : ERT-SCM      Id        : 5458xxxx
Physical Tamper: 3       ERT Type  : 24            Encoder Tamper: 0         Consumption Data: 525682
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2020-04-02 14:07:55
model     : ERT-SCM      Id        : 5458xxxx
Physical Tamper: 3       ERT Type  : 24            Encoder Tamper: 0         Consumption Data: 525682
Integrity : CRC
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

I’ve modified the Id field to but this above shows both my meter and the neighbors. A quick check of wikipedia gives a few more details on the data. Github also has a project targeting these meters – rtlamr. Grid Insite has more detail on the technology and history of these meters.

Now, back to the doorbell. I was hoping this might be a built in device for rtl_433 but further searching reveals it might be different from the predefined devices 115 & 116. Strangley I see nothing from the doorbell but is still rings. Further testing obviously needed.

Updates to WP – fixing the blank editor

Filed under: General — taing @ 9:14 am

I did the automatic update to WordPress 5.4 last night and things got weird. The editor was causing php errors. The browser page appeared blank but turning on developer tools showed there was a pile of stuff including a message to look at https://wordpress.org/support/article/debugging-in-wordpress/

Time to turn on debugging by adding this bit to wp/wp-config.php:

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Enable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

This revealed several errors and warnings. The primary one was solved by removing an ancient but in theory up to date plug-in for Movable Type and TypePad import.

The remaining errors were: register_sidebar was called incorrectly. No id was set in the arguments array for the "Sidebar 1" sidebar. Defaulting to "sidebar-1". Manually set the id to "sidebar-1" to silence this notice and keep existing sidebar content. causing several Cannot modify header information - headers already sent by (output started at /home/taing/jtkdev.com/wp/wp-includes/functions.php:5167) in /home/taing/jtkdev.com/wp/wp-includes/functions.php on line 6221

In looking at wp-content/themes/classic/functions.php there is very little there. By removing the block below the error messages are gone and the pages seem to display correctly:

if ( function_exists('register_sidebar') )
                'before_widget' => '<li id="%1$s" class="widget %2$s">',
                'after_widget' => '</li>',
                'before_title' => '',
                'after_title' => '',


Updates to flight tracking

Filed under: General,Home Automation,RTL-SDR — Tags: , — taing @ 3:21 pm

After not changing the pi for the outdoor temp/humidity I2C sensor, I decided to use the Pi 3 to replace the older Pi 2 that was doing the ads-b flight tracking and feeding on FlightRadar24. This started with rtl_433 already and installed and working as described in an earlier post. rtl_433 is not required but having installed it I’m sure rtl_sdr is installed and the udev rules for the dongle are already in place. I decided to try readsb instead of dump1090-fa. And dump1090-mutability is now marked as maintained.

I found automated scripts for both dump1090-fa and readsb. The script for readsb seems to have worked. I have the webpage at both http://<host>/radar and http://<host>:8080. Script archived here.

The enhanced tar1090 web interface is installed next. The new interface can be seen at http://<host>/tar1090.

Adding a bit of config info:

Set your location with sudo readsb-set-location 50.12344 10.2342.

sudo pico /etc/default/readsb to edit the main config file.

In the case of more than one RTL-SDR dongle in the Pi you may need to modify the line RECEIVER_OPTIONS="--device 0 --device-type rtlsdr --gain -10 --ppm 0" for the correct device number.

sudo pico /usr/share/readsb/html/script/readsb/defaults.js to edit the default webinterface config.

sudo pico /etc/default/tar1090 to edit the tar1090 web interface configuration. A restart with sudo systemctl restart tar1090 is needed after any changes.

Next we’ll add PiAware so we can feed FlightAware some of our data.

wget https://flightaware.com/adsb/piaware/files/packages/pool/piaware/p/piaware-support/piaware-repository_3.8.1_all.deb
sudo dpkg -i piaware-repository_3.8.1_all.deb

sudo apt-get update
sudo apt-get install piaware

sudo piaware-config allow-manual-updates yes

If you are upgrading/replacing and existing site you can use piaware-config feeder-id 12345678-1234-1234-1234-123456789abc to set the site id. You will need to restart the service after making the change.

Confirm your FlightAware feed at https://flightaware.com/adsb/stats. You can make an account and update your position. The service status can be seen with sudo service piaware status.

Next we will add ADSB Exchange feeder:

sudo apt-get install git
sudo rm adsb-exchange -rf
git clone https://github.com/adsbxchange/adsb-exchange.git
cd adsb-exchange
sudo bash setup.sh

If that is successful you should be able to find yourself at https://www.adsbexchange.com/myip/

Now we can add the ADSBX stats package for feeders:

cd /home/pi
git clone https://github.com/adsbxchange/adsbexchange-stats.git
cd adsbexchange-stats
chmod +x install.sh
sudo ./install.sh

Flightradar24 instructions from their forums are not 100%. The contents of the script referenced does not completely match the manual steps. There are alternative but similar instructions in a different forum post.

sudo apt-key adv --recv-key --keyserver pool.sks-keyservers.net C969F07840C430F5
sudo nano /etc/apt/sources.list

then add the following line to the file (/etc/apt/sources.list)

deb http://repo.feed.flightradar24.com flightradar24 raspberrypi-stable
sudo apt-get update
sudo apt-get install fr24feed
fr24feed --signup
sudo systemctl restart fr24feed.service

There might be a warning you that there is no dump1090 installed and that one will be installed by fr24feed when it starts. This did not appear to happen.

You can monitor status for the fr24feed with fr24feed-status or at http://<host>:8754.

Next we add graph1090 following the install instructions in the readme. The graphs are then available at http://<host>/graphs1090 or http://<host>/pref.

The graph1090 instructions recommend reducing the number of sd card writes for a pi. Below with reduce the writes to once every 10 minutes.

sudo tee /etc/sysctl.d/07-dirty.conf <<EOF
vm.dirty_ratio = 40
vm.dirty_background_ratio = 30
vm.dirty_expire_centisecs = 60000

Powered by WordPress