Skip to content

This is my playground for all things home automation. #Emby #Calibre

License

Notifications You must be signed in to change notification settings

Wandergarten/hardkerneled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hardkerneled

TO DO:

  • New Projects ideation:
  • Docker / Container Usage
  • ELK vs Prometheus
    • Case: Luftqualität Berlin - Schildhornstraße
    • Data Provider: Umweltbundesamt (link to station)
    • API: Description to try out
    • Example w/ params day:
      • date_from: 2022-01-01
      • time_from: 1 (in range 1:24, with 1 == 00:00:00 to 01:00:00)
      • date_to: 2022-01-01
      • date_to: 2
      • station: 168
      • component: 1
        • 1 = PM10: Feinstaub
        • 2 = CO: Kohlenmonoxid
        • 3 = O3: Ozon
        • 4 = SO2: Schwefeldioxid
        • 5 = NO2: Stickstoffdioxid
        • 6 = PM10PB: Blei im Feinstaub
        • 7 = PM10BAP: Benzo(a)pyren im Feinstaub
        • 8 = CHB: Benzol
        • 9 = PM2: Feinstaub
        • 10 = PM10AS: Arsen im Feinstaub
        • 11 = PM10CD: Cadmium im Feinstaub
        • 12 = PM10NI: Nickel im Feinstaub
      • scope = 1 (with 1 = hourly)
curl -X 'GET' \
 'https://umweltbundesamt.api.proxy.bund.dev/api/air_data/v2/measures/json?date_from=2022-01-01&time_from=1&date_to=2022-01-01&time_to=2&station=168&component=1&scope=2' \
 -H 'accept: application/json'  
  • Query w/ params: hourly, last 31 days, station = Schildhornstraße, Berlin
https://luftdaten.berlin.de/station/mc117.csv?group=pollution&period=1h&timespan=custom&start%5Bdate%5D=26.02.2022&start%5Bhour%5D=18&end%5Bdate%5D=26.03.2022&end%5Bhour%5D=18
https://www.umweltbundesamt.de/api/air_data/v2/airquality/csv?date_from=2022-02-26&time_from=1&date_to=2022-03-27&time_to=1&station=168
mkdir -pv /media/Backup/folder_name__`date +%Y%m%d`
Backup/
└── folder_name__20180910
   ├── user
   └── user1
  • HOW TO? / Which program to use? (Ubunut Wiki) \n BorgBackup, dd, rdiff-backup, storeBackup, timeshift, CloneZillaHint

Hardware

Hardkernel Odroid-XU4Q (copper heat sink) and Hardkernel Odroid-XU4 (fan):

  • CPU: Samsung Exynos 5 Octa (5422) with big.LITTLE-Architecture and Heterogeneous Multi-Processing as used in Galaxy S5 smartphone (2014; 28nm)
    • 4x Cortex-A15 Quad 2.0GHz
    • 4x Cortex-A7 Quad 1.4GHz
  • GPU: Mali-T628 MP6
    • OpenGL ES 3.1 / 3.0 / 2.0 / 1.1
    • OpenCL 1.2 Full profile
  • RAM: 2GB LPDDR3 w/ 750Mhz, 12GB/s memory bandwidth, 2x32bit bus
  • HDMI: 1.4a with via Type-A
  • USB
    • USB 3.0: 2 ports via USB A
    • USB 2.0: 1 port via USB A
  • Storage: possible via eMMC or MicroSD Card
  • Ethernet: 10/100/1000Mbps Ethernet with RJ-45 Jack
  • Power Supply: 5V/4A
  • Storage: 64 GB SanDisk SD-Card
  • Wifi-Dongle: Ralink RT5370 chipset
  • Case: Black

Take-Away: Hardkernel's done a great job in general, unfortunately though USB-connections are very buggy, basically only one of the three USB interfaces works reliably. Especially after years in use. Also, built-in Wifi is definitely going to be a must-have for future SBCs.

Hardkernel Linklist:

Operating System

Android:

Ubuntu:

Recommended Flasher:

Software

First Things First

Get latest updates for Ubuntu & installed software zoo:

sudo apt-get update && sudo apt-get -y upgrade

Enable SSH to connect headlessly from network:

sudo apt install openssh-server
sudo systemctl status ssh
sudo ufw allow ssh

SSH connection from within network now possible via

ssh username@ip_address

where default:

  • username: 'odroid'
  • ip_address: 'odroid' otherwise search with ip a in odroid terminal for the exact ip-address
  • passwd: 'odroid'

Close the connection via exit.

Hint: Configure local router to always assign the identical ip address to odroid.

Emby Media Server

dpkg -i emby-server-deb_4.6.7.0_armhf.deb
systemctl enable emby-server.service

Verify via:

systemctl status emby-server -l

Calibre Web

Requirements:

  • Calibre installed, executed in order to created a db for CalibreWeb to read
sudo apt-get install calibre 
calibre
  • Installation via Python (Mint Guide):
    1. make sure to have python3 > 3.5
python --version
python3 --version
  1. make sure to have pip acivated for python3 (sic!)
sudo apt install python3-pip
pip3 --version
sudo -H pip3 install --upgrade pip
sudo apt install python3-dev
sudo apt-get install python3-setuptools
python3 -m pip install wheel

  1. Open folder cd /opt/calibre-web/in terminal:
python3 -m pip install venv
python3 -m venv venv
./venv/bin/python3 -m pip install calibreweb
./venv/bin/python3 -m calibreweb
  1. install calibreweb
pip install calibreweb
  1. Open http://localhost:8083 in your browser, if necessary with defaults:
    • user: 'admin'
    • passwd: 'admin123'

How to run CalibreWeb on boot?

  • Instructions in cd /etc/systemd/system/ create a file via touch cps.service with contents sudo nano cps.service:
[Unit]
Description=Calibre-Web

[Service]
Type=simple
User=odroid
ExecStart=/opt/venv/bin/python /opt/venv/bin/cps

[Install]
WantedBy=multi-user.target

Then activate service in systemctl:

sudo systemctl enable cps.service

and validate success:

systemctl | grep cps
systemctl status cps -l

How to automatically add new elements into Calibre on boot

in cd /etc/systemd/system/ create a file via touch update-db.service with contents sudo nano update-db.service:

[Unit]
Description=Update Calibre DB with every startup of machine

[Service]
Type=simple
ExecStart=/bin/bash /media/Datas/Calibre/update-db.sh

[Install]
WantedBy=multi-user.target

Then activate service in systemctl:

sudo systemctl enable update-db.service

and validate success:

systemctl status update-db -l

How to bind NTFS HDD

  1. Install package ntfs-3g
sudo apt-get install -y ntfs-3g
  1. Get location of plugged HDD
sudo blkid
/dev/mmcblk1p2: LABEL="rootfs" UUID="2134-432432-23423-234234-123112" TYPE="ext4" PARTUUID="1234312-12"
/dev/mmcblk1p1: SEC_TYPE="msdos" LABEL_FATBOOT="boot" LABEL="boot" UUID="1234-1234" TYPE="vfat" PARTUUID="1234312-12"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/sda1: PARTLABEL="Microsoft reserved partition" PARTUUID="123123-234234-234234-234234-234234"
/dev/sda2: LABEL="MediaStash" UUID="2342343242" TYPE="ntfs" PTTYPE="atari" PARTLABEL="Basic data partition" PARTUUID="656rtzrtz-rtzrtz-rtzrtz-rtztz-rtzrtz"

-> sda2 with UUI="2342343242" 3. Create folder via sudo mkdir /media/Datas and mount the partition into /media/Datasbut first do sudo umount /dev/sda2

sudo mount /dev/sda2 -t ntfs-3g -o permissions /media/Datas/
  1. In cd /etc/ edit file fstab via sudo nano fstab
/dev/sda2 /media/Datas ntfs-3g defaults 0 0

How to perform sanity checks on your HDD?

TO DO

Finally, consider using Windows' native tool chkdsk to do this the proper and safer way.

How to perform a full image backup

TO DO

Which devices are currently mounted via USB?

Use either:

How to turn off various power saving modes

  • Wifi: If iwconfig prints "Power Management:on", try
sudo nano /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Default value under "[connection]" is "wifi.powersave = 3". Change this value to "2". See this, this or this. Then restart NetworkManager by

sudo systemctl restart NetworkManager
  • USB:
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&usbcore.autosuspend=-1 /' /etc/default/grub
update-grub
systemctl reboot
  • General:
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Verify after reboot by typing into terminal cat /sys/module/usbcore/parameters/autosuspend. Expected value is "-1"

How to savely reboot or shutoff via ssh

sudo poweroff
sudo reboot

Whats the very best task and resource manager for cli?

glances, htop, for trend lines use dstat

python3 -m pip install glances
sudo apt-get install python3-bottle
sudo apt-get install -y htop
sudo apt-get install -y dstat

Monitor from network:

glances -w

Navigate to http://0.0.0.0:61208/ on your browser.

Start glances on boot (see official Glances Wiki entry):

cd /etc/systemd/system/
touch glances.service
sudo nano glances.service

Fill file with contents:

[Unit]
Description=Glances
After=network.target

[Service]
ExecStart=/usr/local/bin/glances -w
Restart=on-abort
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable via systemctl:

sudo systemctl enable glances.service

Where am I?

pwd

Skripting

  • tempmon.sh: shows cpu temperature by core; updated every 3 seconds - lies in /home/odroid
#!/bin/bash
watch -n 3 cat /sys/devices/virtual/thermal/thermal_zone*/temp

allow execution:

chmod +x tempmon.sh

and perform execution:

cd ./home/odroid/
./tempmon/