This project reads raw CANBus frames from Midnite Solar charge controllers and publishes decoded metrics to MQTT for Home Assistant, Node-RED, and other consumers.
Uses:
- CANable / CANable Pro (candleLight firmware)
- SocketCAN on Linux / Raspberry Pi
- Python script (
can2mqtt_hbay.py) to decode CAN frames
Supported controllers:
- Hawkes Bay
- Barcelona
- Rosie (experimental)
- Reads CANBus frames from
can0 - Decodes:
- Battery voltage, current, power
- State of charge
- Temperatures
- PV MPPT voltage & current
- Whizbang Jr current
- Daily kWh
- Throttled MQTT publishing
- Clean MQTT topic structure
- Optional Home Assistant Discovery
- Optional systemd service
- Raspberry Pi
- started with CANable / CANable Pro (candleLight firmware)
- but now using Innomaker USB2CAN ( shows up as Can0 without a lot of setup)
- CAN-H & CAN-L wired to charge controller pin 4 Can High pin 5 Can Low
- Linux with SocketCAN
- Python 3.8+
- MQTT broker (Mosquitto recommended)
sudo apt install can-utils
pip3 install paho-mqtt python-cangit clone https://github.com/<your-username>/hawkesbay-canbus-mqtt.git
cd hawkesbay-canbus-mqttsudo ip link set can0 up type can bitrate 250000''' sudo ip link set can0 down sudo ip link set can0 type can bitrate 500000 sudo ip link set can0 up '''
Verify:
ifconfig can0Monitor live CAN:
candump can0python3 can2mqtt_hbay.pysudo chown pi:pi can2mqtt_hbay.pychmod +x can2mqtt_hbay.pysudo cp can2mqtt_hbay.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now can2mqtt_hbay.servicesudo journalctl -fu can2mqtt_hbay.servicehawkesbay/battery/voltage
hawkesbay/battery/current
hawkesbay/battery/power
hawkesbay/pv/voltage_mppt2
hawkesbay/pv/current_mppt2
hawkesbay/daily/kwh_today
hawkesbay/whizbang/amps
hawkesbay/state
sensor:
- platform: mqtt
name: "HB Battery Voltage"
state_topic: "hawkesbay/battery/voltage"
unit_of_measurement: "V"
- platform: mqtt
name: "HB PV Watts"
state_topic: "hawkesbay/pv/watts"
unit_of_measurement: "W"- Barcelona and Rosie decoding may require refining.
- PRs welcome for new CAN frame IDs or captured logs.
PRs welcome — especially:
- New CAN frame IDs
- Expanded controller support
- Documentation improvements
MIT License
hawkesbay-canbus-mqtt
CAN → MQTT bridge for Midnite Solar Hawkes Bay, Barcelona, and potentially Rosie charge controllers.
📡 Overview
This project reads raw CANBus frames from Midnite Solar charge controllers and publishes decoded metrics to MQTT. It allows you to view full system telemetry in:
Home Assistant
Node-RED
MQTT Explorer
Any MQTT-compatible system
This project uses:
A CANable / CANable Pro flashed with candleLight firmware
SocketCAN on Raspberry Pi / Linux
A Python script (can2mqtt_hbay.py) that decodes CAN frames and publishes MQTT topics
Supported controllers:
✔ Hawkes Bay
✔ Barcelona
⚠ Rosie (experimental — needs frame captures)
🚀 Features
Reads CANBus frames via SocketCAN (can0)
Decodes:
Battery voltage, current, power
State of charge
Temperatures
PV (MPPT) voltage & current
Whizbang Jr current readings
Daily kWh production
Throttled publishing to reduce MQTT noise
Clean MQTT topic structure: