Skip to content

Instantly share code, notes, and snippets.

@7wells
7wells / gist:b669bbcc06ec458eee18a528655cba31
Last active October 1, 2022 06:26
Tvheadend backup and restore
# How to backup and restore Tvheadend settings located in /home/hts/.hts (used on Raspberry Pi OS)
#
# Backup .hts folder incl. all sub-folders and files
#
sudo su hts
cd /home/hts
tar cvjf backup_hts.tar.bz2 .hts
# Consider /home/hts/icons in case they should be saved, too
@7wells
7wells / gist:798c3fd88cbc3f4f3a1bb69b8bea9aa8
Last active October 1, 2022 07:07
Download AverMedia TD310 (DVB-C/T/T2 USB stick) firmware files
# How to download AverMedia TD310 (DVB-C/T/T2 USB stick) firmware files (used on Raspberry Pi 4 Model B)
#
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-usb-it9303-01.fw -O /lib/firmware/dvb-usb-it9303-01.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-02.fw -O /lib/firmware/dvb-demod-si2168-02.fw
sudo wget https://github.com/OpenELEC/dvb-firmware/raw/master/firmware/dvb-demod-si2168-b40-01.fw -O /lib/firmware/dvb-demod-si2168-b40-01.fw
# After that, when plugging the stick into the RPi and the firmware gets fetched from /lib/firmware/, the log file should show it in warm state, e.g. like this:
#
# Sep 28 17:36:37 pi4 kernel: [ 695.216493] usb 1-1.1: new high-speed USB device number 5 using xhci_hcd
# Sep 28 17:36:37 pi4 kernel: [ 695.321165] usb 1-1.1: New USB device found, idVendor=07ca, idProduct=1871, bcdDevice= 1.00
@7wells
7wells / gist:36192e7476afc8c7c6df6387f3c9ac50
Created October 1, 2022 07:37
Download and install NoMachine on Raspberry Pi OS
# How to download and install NoMachine on Raspberry Pi OS
#
# Download latest deb file, e.g. version 8.1.2.1
#
wget https://download.nomachine.com/download/8.1/Raspberry/nomachine_8.1.2_1_arm64.deb
# Install package
#
sudo dpkg -i nomachine_8.1.2_1_arm64.deb
@7wells
7wells / gist:d0d7ba1c51386dc617ef7721e3398e04
Last active October 1, 2022 13:25
Installing mosquitto broker on Raspberry Pi OS and enable remote access with user/password authentication
# How to install mosquitto broker on Raspberry Pi OS and to enable remote access/authentication
#
# Source: https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
#
# Install mosquitto broker (optionally also install mosquitto clients)
#
sudo apt install mosquitto mosquitto-clients
# Test mosquitto broker installation
@7wells
7wells / gist:aaaaeb53ed688edbd5625419347f54bc
Last active October 1, 2022 14:27
Testing mosquitto broker and client on Raspberry Pi OS
# How to test mosquitto broker and client on Raspberry Pi OS
#
# Source: https://randomnerdtutorials.com/testing-mosquitto-broker-and-client-on-raspbbery-pi/
#
# Install mosquitto clients (if not already installed together with mosquitto broker)
#
sudo apt install mosquitto-clients
# Subscribe to topic "testTopic"
@7wells
7wells / gist:2433be8755ca0d133e5d1b9413ca96b4
Last active October 26, 2022 09:26
How to use scrcpy and adb via Wifi to mirror mobile device screen on PC/laptop
# Connect mobile device to PC/laptop via USB
# Connect to your Wifi network (PC/laptop and mobile device must be in the same Wifi)
# Enter command:
adb kill-server
# Enter command:
adb usb
@7wells
7wells / gist:d074817e8b13d5c728010e917e377433
Last active November 18, 2022 10:55
FHEM - disable write protection for fhem.cfg
# Enter following command to disable write protection for fhem.cfg (consider making a backup of fhem.cfg)
#
attr WEB editConfig 1
@7wells
7wells / gist:44009826a9c30a08c47abab7e59a18de
Last active November 18, 2022 11:01
FHEM - How to enable and set up MQTT2_CLIENT
# How to enable MQTT2_CLIENT:
#
define MyMQTT MQTT2_CLIENT <IP of MQTT server>:1883
# How to set MQTT user name:
#
Go to FHEM => MyMQTT => attr MyMQTT
Select 'username' from drop-down menu (under 'MQTT2_CLIENT' heading)
Enter username in empty field and hit [Return] key
@7wells
7wells / gist:f32fa8f703cdab46b04c32e693bbae22
Created November 18, 2022 11:14
FHEM - How to ensure that ser2net starts not too early
# How to ensure that ser2net starts not too early (ie. not before the device is recognized)
#
sudo nano /lib/systemd/system/ser2net.service
# Add the following 2 lines in the [Unit] section:
After=network-online.target
Wants=network-online.target
# See also there: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1000622
@7wells
7wells / gist:2b94161e94083e863f41278ed6d6a0e5
Last active December 19, 2022 17:11
FHEM - How to define Tecalor THZ heatpump
# How to define Tecalor THZ heatpump:
#
define Mythz THZ <IP of device connected to heatpump>:2000
define FileLog_Mythz FileLog ./log/Mythz-%Y.log Mythz
attr Mythz interval_sDHW 600
attr Mythz interval_sHC1 600
attr Mythz interval_sGlobal 600
attr Mythz interval_sElectrDHWDay 3600
attr Mythz interval_sHeatDHWDay 3600
attr Mythz interval_sHeatRecoveredDay 3600