Custom firmware applications for Ubiquiti's mFi line of power monitoring and
switching devices. Includes an MQTT client for Home Assistant integration, a REST
API server, and a CLI tool — all built on a shared C++ library that wraps the mFi
hardware interface.
mfi-mqtt-client ─┬─ hass_mqtt_device (Home Assistant MQTT discovery)
├─ mfi (hardware abstraction: sensors, relays, LEDs)
└─ shmuelie-shared (string utilities)
mfi-rest-server ─┬─ mgpp (Mongoose C++ wrapper)
├─ mfi
└─ shmuelie-shared
mfi-cli ─────────┬─ mfi
└─ shmuelie-shared
| Project |
Description |
Version |
| mfi |
Hardware abstraction for sensors, relays, LEDs |
1.0.0 |
| hass_mqtt_device |
Home Assistant MQTT device library |
1.0.0 |
| mgpp |
C++ wrapper around Mongoose |
1.0.0 |
| shmuelie-shared |
String helper functions |
1.0.0 |
There are several community shell-script projects for controlling mFi devices.
This project differs in being a compiled C++ solution with a proper hardware
abstraction layer, native MQTT, and Home Assistant auto-discovery.
| Feature |
mfi-custom-code |
mpower-tools |
mFi-tools |
| Language |
C++ |
Shell scripts |
Shell scripts |
| MQTT |
Native (libmosquitto) |
Via mosquitto_pub |
Via mosquitto_pub |
| Home Assistant |
Auto-discovery (switches + sensors) |
Manual YAML config |
Manual YAML config |
| REST API |
Yes (Mongoose) |
No |
No |
| CLI tool |
Yes |
No |
No |
| Sensor data |
Power, current, voltage, power factor |
Power, energy |
Power, energy |
| Change-only updates |
Yes (reduces MQTT traffic) |
No (polls on interval) |
No (polls on interval) |
| Hardware abstraction |
C++ library |
Direct file I/O |
Direct file I/O |
| Cross-compilation |
Buildroot toolchain |
Not needed |
Not needed |
| Unit tests |
Catch2 |
None |
None |
| Install complexity |
Build + deploy binary |
Copy scripts |
Copy scripts |
- Building — packages, CMake presets, build commands, testing
- Deploying — binary sizes, UPX, boot scripts, SCP
- mFi Notes — persistent storage, save, boot hooks
- cfgmtd — flash configuration utility internals