Skip to content

Instantly share code, notes, and snippets.

View KrzysztofHajdamowicz's full-sized avatar

Krzysztof Hajdamowicz KrzysztofHajdamowicz

  • Wroclaw, Poland
  • 03:27 (UTC +02:00)
View GitHub Profile
@KrzysztofHajdamowicz
KrzysztofHajdamowicz / generator.py
Created May 30, 2025 07:12
Home-Assistant, Eastron SDM72, SDM630 modbus config generator
#!/usr/bin/env python3
# Edit line 324 to adjust list od modbus addresses used in your setup!
import yaml
import re
# Template data as a string
template_yaml = """
- name: Meter_METERID_CHANGEME_volts_L1/N
slave: METERID_CHANGEME
sensor:
- platform: rest
scan_interval: 900
name: pse
unique_id: pse_rest_template
resource: https://www.pse.pl/transmissionMapService
value_template: "{{ status }}"
json_attributes:
- data
template:
@KrzysztofHajdamowicz
KrzysztofHajdamowicz / bcachefs_fua_test.py
Created March 26, 2025 12:47
bcachefs read FUA test
#!/usr/bin/env python3
import os
import glob
def list_bcachefs_devices(base_dir):
# Iterate over each bcachefs filesystem UUID directory
for uuid_dir in glob.glob(os.path.join(base_dir, '*')):
if os.path.isdir(uuid_dir):
print(f"Filesystem UUID: {os.path.basename(uuid_dir)}")
@KrzysztofHajdamowicz
KrzysztofHajdamowicz / bcachefs_hit_ratio.py
Last active February 4, 2025 11:05
Bcachefs cache hit ratio
#!/usr/bin/env python3
import os
import glob
import sys
# Base directory for the bcachefs instance.
BASE_DIR = '/sys/fs/bcachefs/' + sys.argv[1]
def format_bytes(num_bytes):
"""
@KrzysztofHajdamowicz
KrzysztofHajdamowicz / Home Assistant + ESPHome + wmbusmeters.md
Last active December 29, 2024 16:41
Home Assistant + ESPHome + wmbusmeters
# binary sensor:
- platform: template
sensors:
people_at_home:
value_template: >-
{{ is_state('group.household', 'home')
or is_state('group.family', 'home') }}
should_i_ventilate_home:
friendly_name: "Czy wietrzyć w domu?"
value_template: >-