Sunday, August 31, 2025

Martian 0.0.0.0 Packets identified ESP8266 Tasmota

 Hi,

recently i stumbled over a tremendous amount of Log entries:

kernel: IPv4: martian destination 0.0.0.0 from XXX.XXX.XXX.XXX , dev eth0


I tracked the Ip down to a tasmota esp8266 device. Alle Networ settings were correct. However, the Syslog  logging was switched to something > 0 and no host was given. 
So every message went to 0.0.0.0 I suppose.

Switched logging to 0 and martian packets were gone.


The following debugging might help if this does not solve your issue:
tcpdump -i eth0 host XXX.XXX.XXX.XXX

The following was logged: IP XXX.XXX.XXX.XXX.55246 > 0.0.0.0.syslog: SYSLOG local0.info

Sunday, June 11, 2023

Saturday, May 13, 2023

Tuesday, December 13, 2022

Easy mount dd *.iso Image in ubuntu

 https://superuser.com/questions/117136/how-can-i-mount-a-partition-from-dd-created-image-of-a-block-device-e-g-hdd-u


losetup --partscan --find --show disk.img

mount /dev/loop0p1 /mnt

to free up loop0, use after umount:

losetup -d /dev/loop0

Sunday, April 24, 2022

Stromzähler über ESP8266 Tasmota mit Hichi Infrarot PAFAL 20EG3c auslesen zu iobroker

Vorneweg: Es war wohl das Projekt welches am längsten gedauert hat im Punkt der Gesamtzeit, da das Testen im Sicherungskasten nicht einfach und täglich mal eben machbar ist.

Meine Tipps:

  • Macht euch klar ob Ihr SML oder Obis Protokoll bei eurem Stromzähler braucht. Sucht euch hierzu die Doku für den Stromzähler
  • Sucht nach Baugleichen Stromzählern und Scripten hierzu. Solltet ihr das haben geht es sehr schnell und einfach.
  • Versucht gerne erst über PC/Laptop /Raspi mit einem USB Adapter auf Infrarot Ebay Hichi Erfolg zu haben bevor ihr die Lösung mit Tasmota umsetzt
  • Sucht euch generell möglichst gleiche Setups zu eurem, damit ihr Fehlerquellen wie Zähler etc. ausschließen könnt
  • Fragt gleich bei eurem Stromanbieter an ob auf den Zählern eine Pin oder Freischaltcode ist, damit ihr diesen habt.
  • Prüft gerne mit Handy und Co, google hilft, wie man prüft ob die Diode sendet.

Mein Vorgehen war konfus und wirklich voran bin ich erst zum Schluss gekommen. Diesen geraden Weg versuche ich zu skizzieren:

Vorbedingung:
  • Lauffähigen Iobroker
  • Adapter Sonoff installiert
  • Tasmota ist heruntergeladen und der Master kompilierbar 
    • Bei mir war das VS Code und Plattform IO: https://tasmota.github.io/docs/PlatformIO/
    • Zum einbinden einfach über Open Folder den Tasmota Ordner öffnen. 
  • ESP8266 Hardware und Flashadapter: Z.B:ESP 8266
  • Hichi Leseadapter: 
  • Es gibt den IR Adapter und den ESP auch zusammen: Ebay Aber Vorsicht vor der Empfangsstärke im Sicherungskasten!
  • Lektüre der Ursprungsanleitung dieses Artikels und meine Beste Quelle:  https://docplayer.org/198519837-How-to-tasmota-sml-stand-tasmota-dev-branch.html Vielen Dank an den Autor, das war die generelle und grundlegende Herangehensweise und hat mich zum Ziel geführt!
So nun gehts also an die Umsetzung:
Anpassungen im Tasmota Code, in der Datei: user_config_override.h:

#define USE_SCRIPT 
#endif
#ifdef USE_RULES
#undef USE_RULES
#endif
#define USE_SML_M
#define SML_REPLACE_VARS
#define USE_SML_SCRIPT_CMD

Es gibt noch direkt viele Einstellungen die euch WLAN etc setzen. Das schaut ihr bitte selbst nach

Danach kompiliert ihr in Plattform IO mittels Erstellen. Die Datei ist dann unter Tasmota-master\.pio\build\tasmota\firmware.bin

Tasmota flashen, entweder über das Webinterface auf dem Tasmota und OTA, wenn die Grundversion schon 11 oder größer ist. Oder ihr schließt mittels des Flashadapters an. Ich flashe immer mit Tasmotizer

Entweder im Code oder nach dem Flashen müsst ihr den Tasmota in euer WLAN bringen und am Iobroker MQTT anmelden. Das ist eigentlich selbsterklärend.

Nun installiert ihr den erreichbaren ESP8266 am Stromzähler. 
  • Den Adapter versorgt ihr an VCC mit +3,3v und an GND mit -3,3. 
  • TX und RX gehen an TX und RC am ESP8266. Bei mir der s01 war das 
    • Pin: 



Nun geht ihr auf das Webinterface des Tasmota: Consoles --> Edit Script und gebt das aus dem PDF oben ein:
>D
>B
=>sensor53 r
>M 1
+1,3,o,0,9600,OBIS
1,1-0:1.8.1*255(@1,Total consumption,KWh,Total_in,4
1,1-0:2.8.1*255(@1,Total Feed,KWh,Total_out,4
1,=d 2 10 @1,Current consumption,W,Power_curr,0
1,1-0:0.0.0*255(@#),Meter Nr,, Meter_number,0
#

Klickt auf enable Script und save und dann im Menü davor auf Console.  
Falls euer Zähler ein Init oder ein Acknowledge braucht findet ihr in dem PDF die notwendige Herangehensweise oder beim Hersteller. Probiert das aus!
Ihr gebt in der Console nun ein Sensor53 d0 was die Debugausgabe im Fenster ausgibt.

Hier kommt nun irgendein String in dem ihr so etwas findet: 1.8.1(011324.383*kWh)
Sollte das nicht kommen müsst ihr am Init oder Acknowledge rumspielen.

Wenn das kommt. Ändert die Zeile die nach der Zeile mit dem Obis kommt entsprechend ab:
von 1,1-0:1.8.1*255.... auf 1,1.8.1(......


Nun sollte nach dem Speichern in der Console ein String kommen der euren aktuellen Stromwert ausgibt.

Viel Erfolg

Saturday, April 2, 2022

Friday, November 19, 2021

Tuesday, November 16, 2021

Docker config Portainer

 https://docs.portainer.io/v/ce-2.9/start/install/server/docker/linux

Saturday, November 13, 2021

Docker add Portmapping in existing Container

 Just got this from:

https://stackoverflow.com/questions/19335444/how-do-i-assign-a-port-mapping-to-an-existing-docker-container

or:

https://mybrainimage.wordpress.com/2017/02/05/docker-change-port-mapping-for-an-existing-container/


If you run docker run <NAME> it will spawn a new image, which most likely isn't what you want.

If you want to change a current image do the following:

docker ps -a

Take the id of your target container and go to:

cd /var/lib/docker/containers/<conainerID><and then some:)>

Stop the container:

docker stop <NAME>

Change the files

vi config.v2.json

"Config": {
    ....
    "ExposedPorts": {
        "80/tcp": {},
        "8888/tcp": {}
    },
    ....
},
"NetworkSettings": {
....
"Ports": {
     "80/tcp": [
         {
             "HostIp": "",
             "HostPort": "80"
         }
     ],

And change file

vi hostconfig.json

"PortBindings": {
     "80/tcp": [
         {
             "HostIp": "",
             "HostPort": "80"
         }
     ],
     "8888/tcp": [
         {
             "HostIp": "",
             "HostPort": "8888"
         } 
     ]
 }

Restart your docker and it should work.

Sunday, October 17, 2021

Ubuntu 20.04 sd card to usb drive complete move Raspi4

 So far the only suitable guide for moving an existing ubuntu 20.04. installation completely to USB boot:

https://www.instructables.com/Raspberry-Pi-4-USB-Boot-No-SD-Card/

Sunday, August 8, 2021

influx Install and backup/move

 Influx install:

https://www.verdrahtet.info/2020/02/14/installation-von-influxdb-grafana-inkl-verbindung-zu-iobroker/

Influx Backup:

https://forum.iobroker.net/post/429747

Also ich mache mein Backup von der normalen Linux Kommandozeile aus und nicht unter der Influxdb-Konsole...

Das schaut dann so aus bei meiner Datenbank die iobroker heißt:

root@DietPi:~# sudo influxd backup -portable -database iobroker -host 127.0.0.1:8088 /tmp/iobroker_influx_backup
2020/05/10 20:28:39 backing up metastore to /tmp/iobroker_influx_backup/meta.00
2020/05/10 20:28:39 backing up db=iobroker
2020/05/10 20:28:39 backing up db=iobroker rp=autogen shard=49 to /tmp/iobroker_influx_backup/iobroker.autogen.00049.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:40 backing up db=iobroker rp=autogen shard=50 to /tmp/iobroker_influx_backup/iobroker.autogen.00050.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:40 backing up db=iobroker rp=autogen shard=51 to /tmp/iobroker_influx_backup/iobroker.autogen.00051.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:40 backing up db=iobroker rp=autogen shard=52 to /tmp/iobroker_influx_backup/iobroker.autogen.00052.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:41 backing up db=iobroker rp=autogen shard=53 to /tmp/iobroker_influx_backup/iobroker.autogen.00053.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:41 backing up db=iobroker rp=autogen shard=54 to /tmp/iobroker_influx_backup/iobroker.autogen.00054.00 since 0001-01-01T00:00:00Z
2020/05/10 20:28:42 backup complete:
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.meta
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s49.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s50.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s51.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s52.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s53.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.s54.tar.gz
2020/05/10 20:28:42 /tmp/iobroker_influx_backup/20200510T182839Z.manifest
root@DietPi:~#

Vorher muss aber die Influxdb.config bearbeitet werden...:

Hatte mich damals hiernach gerichtet und entsprechend meinen Anforderungen umgesetzt...:

https://solaranzeige.de/phpBB3/viewtopic.php?t=310

Einen Restore hatte ich auch schon gemacht - ging problemlos.



https://solaranzeige.de/phpBB3/viewtopic.php?t=310





Recently I got an error on influxdb. The log file was not clearly stating an error. But Health target was not reached. Starting the service stated to read the error log, journalctl -xe .


Finally I saw the config pattern:

LimitNOFILE=65536 which basically could limit the number of files the service oder user??? can occupy.


After commenting with # . The service starts succesfully.

This is not due to the case having more than 65k open, but perhaps in contradiction to system limits .

This solved my issues on ubuntu but not on my original raspbian.


Thursday, August 5, 2021

ESP2866-01 Wiring

 Some ESP8266-01 Boards need the Ping CH_PD pulled, high, otherwise it is in rest mode.

Pulled high means putting a 10kOhm resistor between CH_PD and VCC.




Sunday, July 18, 2021

Tasmota Time settings

 ntpserver1 yourntpgoeshere


Germany: Timezone 99



https://tasmota.github.io/docs/Commands/

Sunday, May 23, 2021

ESP8266 via MQTT Iobroker

 https://www.smarthome-tricks.de/allgemein/nodemcu-esp8266-sensoren-an-iobroker-ueber-mqtt/

https://www.smarthome-tricks.de/esp8266/pubsubclient-fuer-mqtt-mit-benutzername-passwort-und-port/


https://github.com/knolleary/pubsubclient



Sunday, February 28, 2021

Grafana View Collection

 Internet Connection View:

https://www.smarthome-tricks.de/grafana/5-3-grafana-dashboard-fuer-die-internet-geschwindigkeit/

Tuesday, January 19, 2021

Information on Linux systems live

 Process overview: top, htop, nmon

Disk/read/write: iotop -o -b -d 10

Tuesday, December 22, 2020

Beware ! Minecraft Windows 10 Edition from Microsoft store

 To my knowledge there is no satisfactory solution to share a Minecraft Win 10 licence from MS Store on a Win10 Computer among different users with differen MS Store accounts.

No App Sharing as known from Apple or Google possible. 

The MS Solution is to buy the licence X-Times!

Not Cool!

Monday, October 19, 2020

Granting Access for non Root to GPIOs

https://stackoverflow.com/questions/30938991/access-gpio-sys-class-gpio-as-non-root



Anleitung dafür Rechte auf GPIOs zu setzen aus:
http://www.netzmafia.de/skripten/hardware/RasPi/RasPi_GPIO_Shell.html

Datei:
# /etc/udev/rules.d/80-gpio-noroot.rules
# Zugriff auf GPIO ohne root-Rechte ermoeglichen
#
# Gruppe aendern
SUBSYSTEM=="gpio", RUN+="/bin/chown -R root.gpio /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chown -R root.gpio /sys/devices/virtual/gpio"
# Sticky-Bit setzen
SUBSYSTEM=="gpio", RUN+="/bin/chmod g+s /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chmod g+s /sys/devices/virtual/gpio"
# Zugriffsrechte setzen
SUBSYSTEM=="gpio", RUN+="/bin/chmod -R ug+rw /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chmod -R ug+rw /sys/devices/virtual/gpio"


#Jetzt müssen Sie nur noch den udev-Daemon von den Änderungen wissen lassen (beim nächsten Reboot passiert das dann automatisch):
sudo service udev restart
sudo udevadm trigger --subsystem-match=gpio

Iobroker zur Gruppe gpios hinzufügen:
sudo usermod -aG gpio iobroker



Nun ist folgendes passiert: 
Die Rechte auf die GPios wurden auf die Gruppe GPIO erweitert.
Dies wird bei jedem Boot wiederholt.
Der Nutzer Iobroker wurde dieser Gruppe hinzugefügt und kann nach einem Neustart nun die GPios schalten.


Saturday, September 26, 2020

Ubuntu Blocking Packages from update

 https://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package

dpkg

Put a package on hold:

echo "<package-name> hold" | sudo dpkg --set-selections

Remove the hold:

echo "<package-name> install" | sudo dpkg --set-selections

Display the status of your packages:

dpkg --get-selections

apt

Hold a package:

sudo apt-mark hold <package-name>

Remove the hold:

sudo apt-mark unhold <package-name>

Show all packages on hold:

sudo apt-mark showhold