How rairulyle/meralco-ph works
MERALCO PH fetches MERALCO’s monthly residential-bill PDFs, derives rates and month-over-month changes, then serves them through REST endpoints or Home Assistant MQTT sensors. The REST API caches fetched results; the add-on entry point selects REST or MQTT operation and, in MQTT mode, publishes rates and discovery data. Source excerpts show the core calls; the README documents the API and add-on capabilities. Some add-on loop details and parser internals were not sampled, so those relationships are not expanded.
Main entry points: addon_main.py Mode dispatcher · parser.py PDF rate parser · api.py Rates and health routes · mqtt_bridge.py MQTT sensor bridge
Components 14
Rate processing
- PDF rate parser
src/parser.py - Monthly comparisons
src/parser.py
REST API
- Rates and health routes
src/api.py - Monthly result cache
src/api.py
Add-on runtime
- Add-on configuration
src/addon_main.py - Mode dispatcher
src/addon_main.py - Rate publish cycle
src/addon_main.py - Supervisor MQTT lookup
src/addon_main.py
MQTT integration
- MQTT sensor bridge
src/mqtt_bridge.py
Other components
- API client
- Home Assistant user
- MERALCO PDF service
- MQTT broker
- Home Assistant MQTT
Connections 15
- API client → Rates and health routes: requests rates
README.md - Rates and health routes → Monthly result cache: gets cached data
src/api.py - Monthly result cache → PDF rate parser: fetches rates
src/api.py - PDF rate parser → MERALCO PDF service: downloads PDFs
src/parser.py - PDF rate parser → Monthly comparisons: compares months
src/parser.py - Home Assistant user → Add-on configuration: configures add-on
README.md - Add-on configuration → Mode dispatcher: selects mode
src/addon_main.py - Mode dispatcher → Rates and health routes: starts REST mode
src/addon_main.py - Mode dispatcher → Rate publish cycle: runs MQTT mode
src/addon_main.py - Rate publish cycle → PDF rate parser: fetches rates
src/addon_main.py - Rate publish cycle → MQTT sensor bridge: publishes rates
src/addon_main.py - Mode dispatcher → Supervisor MQTT lookup: looks up broker
src/addon_main.py - Supervisor MQTT lookup → MQTT broker: retrieves credentials
src/addon_main.py - MQTT sensor bridge → MQTT broker: publishes MQTT
src/mqtt_bridge.py - MQTT broker → Home Assistant MQTT: delivers discovery
README.md