Skip to content

Instantly share code, notes, and snippets.

@enkiusz
enkiusz / fronius-mqtt.py
Last active October 4, 2026 19:20
Poll the Fronius Datamanager Solar API and publish realtime inverter data to MTQQ
#!/usr/bin/env -S uv run --script
# /// script
# dependencies = ["structlog", "aiomqtt", "pyfronius"]
# ///
"""
Scrape statistics from Fronius Datamanager and publish to MQTT using SenML format.
Published topics:
{topic_base}/logger/info - Datalogger metadata (retained)
{topic_base}/active_devices - Active devices (retained)
@enkiusz
enkiusz / gist:4d79a1a4d959d43437789b407f317780
Last active September 18, 2026 11:31
`uv.lock` generated as a result of trying to `uv run` with onnxruntime dependency and a cpython-3.10 venv
version = 1
revision = 3
requires-python = ">=3.10"
resolution-markers = [
"python_full_version >= '3.12'",
"python_full_version == '3.11.*'",
"python_full_version < '3.11'",
]
[[package]]
set -x
for target_cpu in arm arm64; do
echo "CROSS clang -> $target_cpu: ----------------------------"
rm -rf out/; rm -rf third_party/libdatachannel/repo/build; rm tls.cpp.o
gn gen out/libdatachannel_test --args='chip_support_webrtc_python_bindings=true target_cpu="'$target_cpu'" is_clang=true'
@enkiusz
enkiusz / zketech-ebc-a20.py
Last active August 6, 2026 19:31
ZKETECH EBC-A20 Control code
#!/usr/bin/env python3
"""
A simple CLI tool to control and monitor the ZKETECH EBC-A20 battery
tester from https://www.zketech.com/en/
It can trigger charge or discharge as well as perform charge-discharge
cycles to measure battery capacity.
Currenly only the CC (Constant Current) load type is implemented, the
CP (Constant Power) load type is a simple fixme. Additionally, some
@enkiusz
enkiusz / gist:482fab68ef7a630c8cfaad6f13f63919
Created October 2, 2023 18:11
DNS-320L Buildroot 2023.08-650-gc913d310e5 boot log
** MARVELL BOARD: DB-88F6702A-BP LE
U-Boot 1.1.4 (Aug 22 2012 - 17:06:54) Marvell version: 3.6.0.DNS-320L.01
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00
Soc: 88F6702 A1 CPU running @ 1000Mhz L2 running @ 500Mhz
SysClock = 400Mhz , TClock = 166Mhz
DRAM (DDR2) CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
@enkiusz
enkiusz / tuyamcu-sniffer.py
Created December 19, 2022 15:16
A sniffer for the TuyaMCU protocol
#!/usr/bin/env python3
# Sniffer for the TuyaMCU serial port protocol. This protocol is used between an application MCU
# and the Tuya radio modules.
# Reference: https://tasmota.github.io/docs/TuyaMCU/#tuya-protocols
import serial
import argparse
import structlog
import sys
@enkiusz
enkiusz / gist:03690c7792e9135b62876ed3ea65f10d
Created December 7, 2022 20:11
Build log for boehm-gc on emulated armv6l-linux
$ nix-build '<nixpkgs>' -A boehmgc --argstr system armv6l-linux
this derivation will be built:
/nix/store/00pqhyghjmqspci2cc4j8h909xp8hj98-boehm-gc-8.0.6.drv
building '/nix/store/00pqhyghjmqspci2cc4j8h909xp8hj98-boehm-gc-8.0.6.drv'...
unpacking sources
unpacking source archive /nix/store/1x0ganp58lgr5zhrc5iigzqp0a0jf6mg-gc-8.0.6.tar.gz
source root is gc-8.0.6
setting SOURCE_DATE_EPOCH to timestamp 1632862100 of file gc-8.0.6/test-driver
patching sources
updateAutotoolsGnuConfigScriptsPhase
@enkiusz
enkiusz / gist:3ec49a48fe8ed64500106452ef8221cf
Created July 25, 2022 20:34
DES25-32GD09BC1DC-B042 console output when booting
PKG is 0x02
SPI Init
D4B 00000000
SLP3
RA_Loader
L1FBH CH:
00
SysClk:300MHz
#!/usr/bin/env python3
import serial
import struct
import sys
# Reference: https://archive.org/details/rc-3563-manual-english
def test_current(resistance, unit, range):
if resistance == 'OL':
return None
@enkiusz
enkiusz / GSD800S_config.bt
Created February 9, 2021 21:49
Planet GSD-800S switch binary configuration dump format.
//------------------------------------------------
//--- 010 Editor v8.0 Binary Template
//
// File: Planet GSD-800S switch binary configuration dump format.
// Authors: Maciej Grela <enki@fsck.pl>
// Version: 0.8
// Purpose:
// Category:
// File Mask:
// ID Bytes: