MicroPython-based power monitoring system using a Raspberry Pi Pico and BH1750 light sensor for pulse detection.
- Light pulse detection and counting for energy monitoring
- MQTT integration with Home Assistant
- Async/await architecture for concurrent sensor reading and MQTT publishing
- Syslog support for remote logging
- WiFi connectivity
- Raspberry Pi Pico W
- BH1750 light sensor (I2C)
- LED indicator (built-in Pico LED)
Copy cfgsecrets_template.py to cfgsecrets.py and configure:
- WiFi SSID and password
- MQTT broker hostname
This project uses UV for Python dependency management:
# Install test dependencies
uv sync --extra test
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --covUse the deploy script to upload code to the Pico.
- async_mqtt_client.py: Async MQTT client implementation
- lib.py: Syslog logging functionality
- main.py: Main application with sensor and MQTT tasks
- unittests/: Comprehensive test suite