Saturday, 31 January 2026

Improving Smart Home Resilience

(Fri 6th Feb 2026)

I aim to actually start monitoring at least one device and service today.

Does the Fritz!Box 7530 KI has an API I can use?

https://fritz.support/resources/SmarthomeRestApiFRITZOS82.html


https://fritzconnection.readthedocs.io/en/1.10.3/sources/getting_started.html

(.venv) coderdojo@rhubarb:~/workspace/TolaSmartHome$ pip3 install fritzconnection
...
(.venv) coderdojo@rhubarb:~/workspace/TolaSmartHome$ date
Fri 06 Feb 2026 09:31:24 GMT
(.venv) coderdojo@rhubarb:~/workspace/TolaSmartHome$ fritzconnection -s -i 192.168.1.1
fritzconnection v1.15.1
FRITZ!Box 7530 at http://192.168.1.1
FRITZ!OS: 8.21
Servicenames:
                    any1
                    WANCommonIFC1
                    WANDSLLinkC1
                    WANIPConn1
                    WANIPv6Firewall1
                    DeviceInfo1
                    DeviceConfig1
                    Layer3Forwarding1
                    LANConfigSecurity1
                    ManagementServer1
                    Time1
                    UserInterface1
                    X_AVM-DE_Storage1
                    X_AVM-DE_WebDAVClient1
                    X_AVM-DE_UPnP1
                    X_AVM-DE_Speedtest1
                    X_AVM-DE_RemoteAccess1
                    X_AVM-DE_MyFritz1
                    X_VoIP1
                    X_AVM-DE_OnTel1
                    X_AVM-DE_Dect1
                    X_AVM-DE_TAM1
                    X_AVM-DE_AppSetup1
                    X_AVM-DE_Homeauto1
                    X_AVM-DE_Homeplug1
                    X_AVM-DE_Filelinks1
                    X_AVM-DE_Auth1
                    X_AVM-DE_HostFilter1
                    X_AVM-DE_USPController1
                    WLANConfiguration1
                    WLANConfiguration2
                    WLANConfiguration3
                    Hosts1
                    LANEthernetInterfaceConfig1
                    LANHostConfigManagement1
                    WANCommonInterfaceConfig1
                    WANDSLInterfaceConfig1
                    X_AVM-DE_WANMobileConnection1
                    WANDSLLinkConfig1
                    WANEthernetLinkConfig1
                    WANPPPConnection1
                    WANIPConnection1
(.venv) coderdojo@rhubarb:~/workspace/TolaSmartHome$ 

Cool!



(Thurs 5th Feb 2025)

Got Python3 development environment set up on Linux Mint 22 laptop. Uses PyCharm and local git and remote github. Got MQTT publish, time and date, device and service objects started.




(Mid-Jan 2026)

The other day I noticed the button on my Android MQTT Dash app wasn't turning my kitchen sink LEDs on and off.

That night my smart home failed to charge up my LFP batteries on cheap rate electricity.

The next morning I investigated and found that the sionnach RPi3 whose Node-Red program was responsible for both kitchen LEDs and LFP charging was off line.

Power cycling this computer fixed everything.

However, I decided after this that I must monitor my smart home better.

This blog post tracks my actions to achieve this!


DESIGN GOALS

1) Monitor all machines and services

2) Provide a fail safe RED / YELLOW / GREEN display

3) Provide hourly detailed status reports.

4) Write code in object oriented Python3 (or on ESP32 MicroPython)


DETAILED BREAKDOWN

My smart home is based on an LTE router for Internet access which is connect to a Fritz!Box router for local LAN/WiFi access.

The later has DHCP running to assign IP addresses to the various devices (i.e. RPi3s. Zigbee routers, etc.)


So what do we want to check on?

a) Is the LTE router connected to the internet?

b) Is the Fritz!Box connected to the internet?

c) Are the N devices with IP addresses online?

d) Are the M services supplied by the N devices running?

How can we do this?

Let's make every device and service created and update a MQTT topic periodically

Let's have the RPi4 devices check these topics for updates using object oriented Python3 scripts

Let's update a ESP32-C6-GEEK display with RED / YELLOW / GREEN every 10 secs based on the results of our checks

Let's publish details of these checks to other MQTT topics




Thursday, 15 January 2026

Battery monitoring over BLE

 Well, it's been a minute. So this post details how to talk to three 24V LFP batteries over bluetooth.




The goal is to run a Python3 script as a system service on a Raspberry Pi to update via MQTT the battery voltages, currents and SoC % every few minutes.

The BMS run by each battery is below:

 BLE MAC              Name                     Type
'A4:C1:37:10:00:D2', 'SP10S009-L8S-100A-B-U', 'JK?'
'04:7F:0E:00:1A:7C', 'BR2262e-s',             'Xiaoxiang'
'40:18:04:01:23:34', 'DL-401804012334',       'Daly'

 

Here's the pseudo code:

For each of the three batteries {
    connect to battery (MAC_ADDDRESS, BMS_TYPE )
    get_voltages()
    get_current()
    get_SoC()
    disconnect()
    publish_to_MQTT()
}

This will use object orientated Python3 code and timeouts if async calls need to be used in blocking function calls.

So, examining the https://github.com/KrystianD/smart_bms.git code which works with the "JK?" type BMS lets see how it get the job done...

The smart_bms/TransportBLE.py code makes a BLE connection to the battery using the Bleak library to provide a client.