====== Solar & Stromverbrauch ======
===== Home Assistant =====
==== move RPI SD zu SSD ====
TBD - RPI3 Ubuntu
Hardware für SSD:
* https://www.amazon.de/gp/product/B07DK2GWJB/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
* https://www.amazon.de/gp/product/B07GMD5R7M/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
1) System aktualisieren
sudo apt update
sudo apt full-upgrade
sudo rpi-update
2) rpi-clone installieren
root@raspi:~# apt-get install git
root@raspi:~# git clone https://github.com/billw2/rpi-clone.git
root@raspi:~# cd rpi-clone
root@raspi:~/rpi-clone# cp rpi-clone /usr/local/sbin/sys-clone
root@raspi:~/rpi-clone# sudo cp rpi-clone-setup /usr/local/sbin/sys-clone-setup
3) Devices ausfindig machen
root@raspi:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 119.2G 0 disk
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 59.2G 0 part /
sda ist die SSD, mmcblk0 die SD
4) ggf. SSD löschen, falls noch was drauf ist. Ggf. prüfen mit
root@raspi:~# fdisk -l /dev/sda
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: 2115
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
5) clonen auf sdd starten (sda ist das SSD Device, ggf. auch sba etc.)
root@raspi:~# sys-clone sda
Error: /dev/sda: unrecognised disk label
Booted disk: mmcblk0 63.9GB Destination disk: sda 128.0GB
---------------------------------------------------------------------------
Part Size FS Label Part Size FS Label
1 /boot 256.0M fat32 --
2 root 59.2G ext4 rootfs
---------------------------------------------------------------------------
== Initialize: IMAGE partition table - partition number mismatch: 2 -> 0 ==
1 /boot (49.5M used) : MKFS SYNC to sda1
2 root (1.4G used) : RESIZE MKFS SYNC to sda2
---------------------------------------------------------------------------
Run setup script : no.
Verbose mode : no.
-----------------------:
** WARNING ** : All destination disk sda data will be overwritten!
-----------------------:
Initialize and clone to the destination disk sda? (yes/no): yes
Optional destination ext type file system label (16 chars max): ssdraspi
Initializing
Imaging past partition 1 start.
=> dd if=/dev/mmcblk0 of=/dev/sda bs=1M count=8 ...
Resizing destination disk last partition ...
Resize success.
Changing destination Disk ID ...
=> mkfs -t vfat -F 32 /dev/sda1 ...
=> mkfs -t ext4 -L ssdraspi /dev/sda2 ...
Syncing file systems (can take a long time)
Syncing mounted partitions:
Mounting /dev/sda2 on /mnt/clone
=> rsync // /mnt/clone with-root-excludes ...
Mounting /dev/sda1 on /mnt/clone/boot
=> rsync /boot/ /mnt/clone/boot ...
Editing /mnt/clone/boot/cmdline.txt PARTUUID to use 65836935
Editing /mnt/clone/etc/fstab PARTUUID to use 65836935
===============================
Done with clone to /dev/sda
Start - 10:42:06 End - 10:50:33 Elapsed Time - 8:27
Cloned partitions are mounted on /mnt/clone for inspection or customizing.
Hit Enter when ready to unmount the /dev/sda partitions ...
unmounting /mnt/clone/boot
unmounting /mnt/clone
===============================
Not longer needed:
6) remount der SSD Partitions, in meinem Fall sda1/sda2. Die Reihenfolge ist wichtig!
root@raspi:~# mount /dev/sda2 /mnt/clone
root@raspi:~# mount /dev/sda1 /mnt/clone/boot
7) ermitteln der neuen Partition UUID der SSD Partitions
root@raspberrypi:~# lsblk -o name,mountpoint,size,partuuid /dev/sda1
NAME MOUNTPOINT SIZE PARTUUID
sda1 /mnt/clone/boot 256M 65836935-01
root@raspberrypi:~# lsblk -o name,mountpoint,size,partuuid /dev/sda2
NAME MOUNTPOINT SIZE PARTUUID
sda2 /mnt/clone 119G 65836935-02
===== nützliche Links =====
https://projects.webvoss.de/2017/11/05/interfacing-vitovalor-300-p-with-a-raspberry-pi/
https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz/iskraemeco_mt174
https://blog.mornati.net/home-assistant-with-rpi4-improvements
https://blog.vyoralek.cz/iot/centrum-chytre-domacnosti-homeassistant-hass-io-7-cast-sonoff-pow-esphome/
https://ottelo.jimdofree.com/iskra-stromz%C3%A4hler-und-ha/
https://github.com/arendst/Tasmota/issues/7003
Auslesen über LED:
https://smarthome.ms1.de/projekte/stromverbrauch/
https://affengriff.net/2021/10/26/esp8266-stromzahler-auslesen/
-----
https://www.msxfaq.de/sonst/bastelbude/smartmeter_d0_sml.htm
http://www.montigny.info/UntersuchungFototransistoren.pdf
http://developer.mysmartgrid.de/doku.php?id=optoreader
https://www.mikrocontroller.net/topic/507286
https://de.elv.com/forum/iskra-mt174-5249
https://ottelo.jimdofree.com/iskra-stromz%C3%A4hler-und-ha/
-----
https://www.steckdosensolar.de/produkt/balkonkraftwerk-600-watt-mini-solaranlage/
https://www.steckdosensolar.de/produkt/balkonkraftwerk-300-watt-komplettset/
https://www.mpptsolar.com/de/optimale-ausrichtung-dachneigung-solaranlage.html
https://sonnstrom.com/collections/modulwechselrichter/products/modulwechselrichter-microinverter-huayu-hy-600-plus-sofort-verfugbar
https://www.bing.com/search?q=Envertech+EVT560
https://www.solarkraftwerk24.de/aid-447-Bosswerk-Mikrowechselrichter-MI600-mit-WLAN-fuer-2-PV-Module-und-Zubehoer.html
https://sonnstrom.com/products/modulwechselrichter-microinverter-huayu-hy-600-plus-sofort-verfugbar
https://www.ebay-kleinanzeigen.de/s-anzeige/balkonkraftwerk-690-watt-q-cells-hy-600-plus-wlan/1933703297-84-4204
https://tasmota.github.io/docs/Smart-Meter-Interface/
===== Tasmota Script für ISKRA MT 174 =====
>D
>B
->sensor53 r
>M 1
+1,3,o,0,300,MT174,1,100,2F3F210D0A
1,1-0:1.7.1*255(@1,Momentanverbrauch,KWh,Momentan_in,3
1,1-0:1.8.1*255(@1,Gesamtverbrauch,KWh,Gesamt_in,3
1,1-0:2.8.1*255(@1,Gesamteinspeisung,KWh,Gesamt_out,3
#
===== Tasmota Script für SGM-DD =====
>D
>B
->sensor53 r
>M 1
+1,3,s,0,9600,SGMDD
1,77070100010800ff@1000,Total Consumed,KWh,Total_in,3
1,77070100100700ff@1,Momentanverbrauch,W,Momentan,0
1,77070100020800ff@1000,Gesamteinspeisung,KWh,Total_out,3
#
Der Momentanverbrauch wird negativ, wenn eingespeist wird.
===== Tasmota Script für ZPS GS303 =====
>D
>B
->sensor53 r
>M 1
+1,3,s,0,9600,GS303
1,77070100010800ff@1000,Gesamtverbrauch,KWh,Gesamt_in,3
1,77070100100700ff@1,Momentanverbrauch,W,Momentan_in,0
1,77070100020800ff@1000,Gesamteinspeisung,KWh,Gesamt_out,3
#
===== Mosquitto MQTT 6.0.1 Homeassistant "Spezialität" =====
Die 6.0.1 Version des Mosquitto Mqtt Brokers hat leider einen Bug :-(.
(https://github.com/home-assistant/addons/issues/2020)
MQTT Config
certfile: fullchain.pem
customize:
active: true
folder: mosquitto
keyfile: privkey.pem
logins:
- username: mqtt
password: mqtt
require_certificate: false
anonymous: false
https://ottelo.jimdofree.com/iskra-stromz%C3%A4hler-und-ha/
===== Akku =====
https://www.tueftler-und-heimwerker.de/lithium-eisenphosphat-speicher-lifepo4-bauen/
https://www.script-example.com/esp32-flowmeter
https://github.com/frenck/ESP32-MQTT-LED-Controller
https://stefan.schultheis.at/2020/ota-firmware-update-fuer-esp32/
https://docs.platformio.org/en/latest/platforms/espressif32.html#over-the-air-ota-update
http://cool-web.de/esp8266-esp32/visual-studio-code-und-platform-io-ersatz-arduino-ide.htm
ESP32 Analaog Read
https://esp32.com/viewtopic.php?f=19&t=2881&start=30
ESP32 ADC stabilisieren
https://forum.arduino.cc/t/fixing-the-non-linear-adc-of-an-esp32/699190
ESP32 external ADC ADS1115
https://microcontrollerslab.com/ads1115-external-adc-with-esp32/
https://medium.com/@cedricdiego0/esp32-with-an-external-adc-ads1115-a86d3b51bb8
https://www.researchgate.net/figure/Comparison-between-ESP32-embed-ADC-and-the-external-ADC-ADS1115_fig1_360070512
===== Reverse Proxy =====
Um Homeassistant, Grafana, ... aus dem Internet zu erreichen, nutze ich Reverse Proxy mittels docker.
Was braucht man:
docker compose up
docker ps
docker stop
certbot certonly -d proxy.die-schubis.de,dtu-o.die-schubis.de,dtu.die-schubis.de,esplader.die-schubis.de,victrons-o.die-schubis.de,inverter.die-schubis.de,grafana.die-schubis.de,grafana-o.die-schubis.de