moved drafts to folder

This commit is contained in:
Felipe M 2024-02-26 21:23:19 +01:00
parent a77055d617
commit 0acfee6187
Signed by: fmartingr
GPG key ID: CCFBC5637D4000A8
5 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,220 @@
title: Arch Linux on my Dell XPS
---
pub_date: 2021-12-31
---
_discoverable: no
---
body:
## Create install media
## Install
- Follow the wiki
``` sh
# Connect to the internet, the moment we do relector will update the mirrorlist
iwctl station wlan0 connect <bssid>
# Set up date and time
timedatectl set-ntp true
timedatectl set-timezone Europe/Madrid
# Prepare the disk, the setup I used:
# Disk #0: 512MB, Boot partition, UEFI type
# Disk #1: 16384MB, SWAP, swap type
# Disk #2: Rest of the disk, btrfs type
# fdisk ...
# Prepare the filesystems and the luks encryption
mkfs.vfat -F32 /dev/nmve0n1p0
mkswap /dev/nmve0n1p1
cryptsetup luksFormat /dev/nvme0n1p2 # Password here
cryptsetup open /dev/nvme0n1p2 luks
mkfs.btrfs -L btrfs /dev/mapper/luks
# Prepare the btrfs partition
mkdir /mnt/luks
mount -t btrfs /dev/mapper/luks /mnt/luks
cd /mnt/luks
btrfs subvolume create root
btrfs subvolume create home
btrfs subvolume create snapshots
# Mount everything under /mnt
mkdir /mnt/{home,boot}
mount -o subvol=root,compress=lzo /dev/mapper/luks /mnt
mount -o subvol=home,compress=lzo /dev/mapper/luks /mnt/home
mount /dev/nvme0n1p0 /mnt/boot
# Run pacstrap with several base packages:
pacstrap /mnt \
base \
linux-lts linux-firmware \
intel-ucode \
terminus-font \ # Fonts in vconsole
man-db man-pages \ # Man pages
iwd sudo vim NetworkManager # Utilities
# Generate the /etc/fstab file
genfstab -L /mnt >> /mnt/etc/fstab
# Check everything is correct, replace realtime with noatime and discard flags to
# make flash drive last longer
vim /mnt/etc/fstab
# Enter into the system
arch-chroot /mnt
# Setup timedate
timedatectl set-timezone Europe/Madrid
# Sync the RTC from the system time (useful if dual booting)
hwclock --systohc
# Set the en_US.UTF-8 locale (uncomment)
vim /etc/locale.gen
locale-gen
# Setup default locale
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
# Setup keymap and font
echo 'KEYMAP=us\nFONT=ter-232n' > /etc/vconsole.conf
pacman -S physlock # To allow locking the computer when in VConsole
# Setup the computer hostname
echo 'deru' > /etc/hostname
# Setup the hosts file
echo '127.0.0.1 localhost\n::1 localhost\n127.0.1.1 deru.localdomain deru' > /etc/hosts
# Set root password
passwd
# Setup init hooks to use systemd
vim /etc/mkinitcpio.conf
# Remove udev and add systemd, sd-vconsole and sd-encrypt
# Regenerate initrd
mkinitcpio -p linux-lts
# Setup systemd-boot
bootctl --path=/boot install
# Create the bootloader entry for Arch
LUKS_UUID=$(cryptsetup luksUUID /dev/nvme0n1p2)
cat >/boot/loader/entries/arch.conf <<EOL
title Arch Linux (LTS)
linux /vmlinuz-linux-lts
initrd /intel-ucode.img
initrd /initramfs-linux-lts.img
options rw luks.uuid=${LUKS_UUID} luks.name=${LUKS_UUID}=luks root=/dev/mapper/luks rootflags=subvol=root
EOL
# Setup bootloader
echo 'default arch.conf' > /boot/loader/loader.conf
# System ready!
exit
reboot
# Login as root
# Setup systemd-resolved
systemctl enable --now systemd-resolved
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
# Install and start netowrk manager
systemctl enable --now NetworkManager
# Connect to wifi if required
nmcli d wifi connntect <ssid> password <pass>
# Setup hibernate
# Get the swap disk UUID (double check manually)
sudo blkid | grep swap | sed -rn 's/^.* UUID=\"([a-z0-9\-]+)\".*$/\1/p'
# Add the resume boot parameter
vim /boot/loader/entries/arch.conf
# Under options:
# resume=UUID=<uuid>
# Systemd should check automatically for the swap partition on GPT tables [1]
# Setup suspend-then-hibernate
vim /etc/systemd/login.conf
# My enabled options:
# HandlePowerKey=suspend-then-hibernate
# HandleLidSwitch=suspend-then-hibernate
# HandleLidSwitchExternalPower=suspend-then-hibernate
# HandleLidSwitchDocked=ignore
# IdleAction=suspend-then-hibernate
# IdleActionSec=10min
vim /etc/systemd/sleep.conf
# Find HibernateDelaySec and set to 5min
# All these will be into effect in next boot
```
- [ ] Boot in 1080p mode
- [ ] Docked toggle
- [ ] VConsole auto lock?
- [ ] IDLE toggle in VConsole?
- [ ] Hardware acceleration
## Hardware acceleration
```
pacman -S vulkan-intel
```
## Power
```
pacman -S tlp
# Edit tlp configuration link power to prevent corruption on btrfs devices
# /etc/tlp.conf
# ...
SATA_LINKPWR_ON_BAT=max_performance
# ...
```
# Enable and start tlp
systemctl enable --now tlp
## Audio
pacman -S alsa-utils pulseaudio pulseaudio-alsa pavucontrol
systemctl start --user pulseaudio.socket
## Bluetooth
```
pacman -S bluez bluez-utils
modprobe btusb
systemctl enable --now bluetooth
bluetoothctl -- power on
```
## Brightness control
```
pacman -S brightnessctl
```
## Fonts
```
pacman -S otf-ipafont # Japanese
pacman -S ttf-bitstream-vera # Default
```
## Userspace
Enable multilib repos to install steam
```
useradd fmartingr
pacman -S sway dmenu xorg-xwayland alacritty qutebrowser
pacman -S mako # notifications
# TODO notification history?
```

View file

@ -0,0 +1,79 @@
title: Running Alpine Linux from USB on the Raspberry Pi 3
---
pub_date: 2021-12-31
---
_discoverable: no
---
body:
``` bash
# Tested on Raspberry Pi 3
# Create a Raspberry pi OS SD card
sudo apt update
sudo apt upgrade
sudo rpi-update
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
reboot
# At this point the boot flag is enabled
# Prepare the USB
# Install Alpine to USB Drive
# Format USB
# Create two partitions:
# - boot fat16
# - root ext4
tar xzvf ~/Downloads/alpine-rpi-3.12.1-armhf.tar.gz
# boot/usercfg.txt:
enable_uart=1 # Not sure I need this
gpu_mem=32 # The minimal memory for the bootloader
setup-alpine
apk update
apk add cfdisk e2fsprogs
mkfs.ext4 /dev/sda2
# Setup proper TZ
apk add tzdata
cp /usr/share/zoneinfo/Europe/Madrid /etc/localtime
echo "Europe/Madrid" > /etc/timezone
apk del tzdata
mount /dev/sda2 /mnt
setup-disk -m sys /mnt
mount -o remount,rw /media/sda1
rm -f /media/sda1/boot/*
cd /mnt
rm boot/boot # Remove symlink
mv boot/* /media/sda1/boot/
rm -rf boot
mkdir media/sda1
ln -s media/sda1/boot boot
# /mnt/etc/fstab
# Remove cdrom
# Add:
/dev/sda1 /media/sda1 vfat default 0 0
# Edit boot cmdline to boot from the ext partition
# Add root=/dev/sda2
# Reboot
# After install
# Set swclock (pi doesn't have a hwclock)
rc-update add swclock boot
rc-update del hwclock boot
service hwclock stop
service swclock start
apk update
apk upgrade
```

View file

@ -0,0 +1,102 @@
title: Self-hosting my home: Grafana, InfluxDB, ESPHome
---
_discoverable: no
---
pub_date: 2021-12-31
---
body:
## InfluxDB
``` sql
GRANT ALL ON "homeassistant" TO "homeassistant";
```
## Grafana
...
## ESP Home
...
### Temperature and Humidity Monitors
...
### Mi Flora
- Get MAC Address for the Mi flora
```
$ bluetoothctl scan on | grep -i flo
[NEW] Device XX:XX:XX:XX:XX:XX Flower care
```
- Create a new ESP Home integration to track the sensor:
I name my sensors with numbers so I can write the number on them and identify them easily. You only need to assign sensors to rooms to have them easily available when looking for them on dashboards.
``` yaml
[...]
# Sensors
esp32_ble_tracker: # Required for BLE scanning
sensor:
- platform: xiaomi_hhccjcy01
mac_address: 'XX:XX:XX:XX:XX:XX'
temperature:
name: "Flora 1 Temperature"
moisture:
name: "Flora 1 Moisture"
illuminance:
name: "Flora 1 Illuminance"
conductivity:
name: "Flora 1 Soil Conductivity"
battery_level:
name: "Flora 1 Battery Level"
```
- Validate and upload the configuration to your ESP device.
- With that, you could already create a card with the sensors provided by the integration, but for better visual information a [`plant`](https://www.home-assistant.io/integrations/plant/) object can be created with aproppriate values. Information comes from the Mi Flora App, but someone dumped the database and it's available also [on github](https://github.com/khronimo/MiFloraDB).
From the spreadsheet:
- Moisture: `min_soil_moist`/`max_soil_moist`
- Temperature: `min_temp`/`max_temp`
- Conductivity: `min_soil_ec`/`max_soil_ec`
- Brightness: `min_light_lux`/`max_light_lux`
- Create a `plant` monitor on the `configuration.yaml` file:
``` yaml
plant:
parsley:
sensors:
moisture: sensor.flora_1_moisture
battery: sensor.flora_1_battery
temperature: sensor.flora_1_temperature
conductivity: sensor.flora_1_soil_conductivity
brightness: sensor.flora_1_illuminance
min_moisture: 28
max_moisture: 75
min_battery: 20
min_conductivity: 100
max_conductivity: 2000
min_temperature: 5
max_temperature: 35
min_brightness: 2500
max_brightness: 55000
check_days: 3
```
- Restart Home Assistant for the changes to take effect.
- Add a [Plant Status Card](https://www.home-assistant.io/lovelace/plant-status/) to your dashboard and select the plant you just created.
![My parsley plant status card](./plant-status-card.png)
---
_discoverable: no

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View file

@ -0,0 +1,22 @@
title: Self-hosting my home: Zigbee devices
---
_discoverable: no
---
pub_date: 2021-12-31
---
body:
## DeCONZ + Phoscon
- Install deconz addon
- Add deconz integration
- Host: core_deconz
## Pairing everything
- Pair smart plug (show as light)
- Pair motion sensor
- Pair window/door sensors
- Pair light detector
---
_discoverable: no