smartbox2mqtt
v1.5.0
Published
MQTT to smartbox heater adapter
Readme
smartbox2mqtt
MQTT bridge for smartbox electric heaters.
Overview
smartbox2mqtt is a standalone Node.js adapter that bridges MQTT and smartbox electric heaters. It provides a simple MQTT interface for monitoring and controlling heater modes, target temperatures, and real-time power consumption.
This project is based on the hass-smartbox Home Assistant integration and the smartbox Python library. Adapted to Node and MQTT by Claude.
Installation
npm install -g smartbox2mqttConfiguration
Create a configuration file at ~/.config/smartbox2mqtt/config.json (Linux) or ~/Library/Preferences/smartbox2mqtt/config.json (macOS):
{
"smartbox": {
"username": "smartbox email",
"password": "smartbox password",
"apiName": "key of one of /src/smartbox-client.js:6, for example 'api-hjm'",
"reconnectInterval": 600000
},
"mqtt": {
"host": "localhost",
"port": 1883,
"username": "mqtt username",
"password": "mqtt password",
"baseTopic": "smartbox"
}
}Configuration Options
smartbox section
username(required): Your smartbox account emailpassword(required): Your smartbox account passwordapiName(required): API endpoint key (e.g.,api-hjm). See/src/smartbox-client.js:6for available optionsreconnectInterval(optional): Interval in milliseconds for periodic Socket.IO reconnection. Default: 600000 (10 minutes). This ensures the WebSocket connection stays fresh and auth tokens are refreshed. Set to0to disable periodic reconnects.
mqtt section
host(required): MQTT broker hostnameport(optional): MQTT broker port. Default: 1883username(optional): MQTT broker usernamepassword(optional): MQTT broker passwordbaseTopic(optional): Base topic prefix for all MQTT messages. Default:smartbox
Usage
smartbox2mqttThe bridge will:
- Connect to your smartbox account
- Discover all available heaters
- Connect to your MQTT broker
- Start publishing status updates and listening for commands
MQTT Topics
For each heater ({nodeName}), topics are structured as: {baseTopic}/{nodeName}/...
Control Topics (Write)
{baseTopic}/{nodeName}/mode/set- Set heater mode:manual,auto, oroff{baseTopic}/{nodeName}/temperature/set- Set target temperature in °C
Status Topics (Read-only)
{baseTopic}/{nodeName}/mode- Current mode{baseTopic}/{nodeName}/temperature- Target temperature (°C){baseTopic}/{nodeName}/current_temperature- Measured room temperature (°C){baseTopic}/{nodeName}/comfort_temperature- Comfort mode temperature (°C){baseTopic}/{nodeName}/eco_temperature- Eco mode temperature (°C){baseTopic}/{nodeName}/ice_temperature- Frost protection temperature (°C){baseTopic}/{nodeName}/active- Actively heating:ONorOFF{baseTopic}/{nodeName}/power- Real-time power consumption in Watts{baseTopic}/{nodeName}/online- Connection status:ONorOFF
Bridge Topics
{baseTopic}/lwt- Bridge availability:OnlineorOffline(retained, with MQTT Last Will)
Example Usage
Set heater to manual mode
mosquitto_pub -t "smartbox/living-room/mode/set" -m "manual"Set target temperature to 21°C
mosquitto_pub -t "smartbox/living-room/temperature/set" -m "21.0"Monitor current temperature
mosquitto_sub -t "smartbox/living-room/current_temperature"Monitor power consumption
mosquitto_sub -t "smartbox/living-room/power"