This project helps you integrate your B2500 storage system with both the official mobile app and local home automation systems. It solves two common integration challenges:
- Using the official app with a locally configured storage system
- Using home automation with a storage system configured for the official Hame cloud
The B2500 storage system can be configured to use either:
- The official Hame MQTT broker (default) - allows control via the mobile app but not local automation
- A local MQTT broker - allows local automation but breaks mobile app control
This tool bridges these two scenarios by forwarding MQTT messages between your local broker and the Hame broker. It has two modes controlled by the inverse_forwarding
option:
- Use this when your storage is configured to use your local MQTT broker
- The relay forwards necessary messages to the Hame broker
- Allows you to keep using the official mobile app while your storage runs on local MQTT
- Use this when your storage is using the default Hame MQTT broker
- The relay forwards messages from your local broker to Hame
- Allows local home automation control without reconfiguring your storage
- Either:
- Docker environment
- Home Assistant OS or a Home Assistant Supervised installation
- Your storage's Device ID and MAC
- Optional: Configure storage with local MQTT broker (see below)
You can get your Device ID and MAC address by logging into the Energy Management System with your account. The Device ID is the 24-digit value below "Device Configuration". The MAC address is listed below.
This step is optional depending on your chosen setup:
- If you want to use the storage with a local broker (
inverse_forwarding: false
), follow these steps - If you want to keep using the Hame broker (
inverse_forwarding: true
), skip this section
- Enable the MQTT option through the Energy Management System by toggling "MQTT enabled" on
- Open the Power Zero/Marstek App and connect to your storage via Bluetooth
- Under "Settings" you'll see an option "MQTT" now
- Fill out your MQTT broker settings. Make sure to enable or disable the checkbox "SSL connection enabled", depending on whether your broker supports SSL (disable if unsure)
- Save
Now your storage can be controlled through your own MQTT broker. See this document for more information.
The relay can be run either directly with Docker or using Docker Compose.
- Create a directory for your configuration:
mkdir hame-relay
cd hame-relay
mkdir config
- Create a config file (
config/config.json
):
{
"broker_url": "mqtt://username:password@your-broker-url",
"inverse_forwarding": false,
"devices": [
{ "device_id": "24-digit-device-id", "mac": "maccaddresswithoutcolons" }
]
}
- Run the container:
docker run -d \
--name hame-relay \
--restart unless-stopped \
-v "$(pwd)/config:/app/config" \
ghcr.io/tomquist/hame-relay:main
- Create a directory for your configuration:
mkdir hame-relay
cd hame-relay
mkdir config
-
Create a config file (
config/config.json
) with the same content as above. -
Create a
docker-compose.yml
file:
version: '3.8'
services:
mqtt-forwarder:
image: ghcr.io/tomquist/hame-relay:main
container_name: hame-relay
restart: unless-stopped
volumes:
- ./config:/app/config
- Start the container:
docker compose up -d
-
Add this repository to your Home Assistant add-on store:
https://github.com/tomquist/hame-relay
-
Install the "Hame Relay" add-on
-
Configure your device details (see below)
-
Start the add-on
Example configuration:
# Optional: only needed if not using Home Assistant's MQTT service
mqtt_uri: "mqtt://username:password@host:1883"
# Choose your operation mode (see "How It Works" section above)
inverse_forwarding: false
devices:
- device_id: "0123456789abcdef01234567"
mac: "01234567890a"
- device_id: "0123456789abcdef01234567"
mac: "01234567890a"
The add-on will automatically use your Home Assistant MQTT settings if configured. You only need to provide the mqtt_uri
if you want to use a different MQTT broker.
devices
: List of your B2500 devices with their IDs and MAC addresses
inverse_forwarding
: Choose your operation mode:false
(default): Storage uses local broker, maintain app functionalitytrue
: Storage uses Hame broker, enable local control
For development instructions, see CONTRIBUTING.md