-
Notifications
You must be signed in to change notification settings - Fork 1
Data API over MQTT
The MQTT Interface is key to controlling the software, you must have a MQTT server running on your network for you to use this.
DIY Battery BMS will send out the current status on the topic that is set in the UI, plus Data as the key, this Data key will contain a JSON string with the current state:
{"RealTime":true,"battsoc":93,"battvoltage":5319,"battcurrent":-56,"chargeenabled":true,"dischargeenabled":true,"forcecharge":false,"chargecurrent":51111,"dischargecurrent":100000,"totalheap":316320,"freeheap":202928}
By parsing the JSON string you can be kept up to date in any application that supports consuming MQTT data.
To use the data you need to do some calculations.
- Battery voltage is in mV
- Battery Current divide by 10 to get the amps.
- Charge Current and Discharge Current is in mA.
Charge Enable is the current state to allow charge or not. Discharge Enable is the current state to allow charge or not. Force Charge is for charging from Grid, state will be true if it is.
Total Heap and Free Heap are the memory available and free out of the total, this is more for debugging purposes.
DIY Battery BMS Subscribes to the "topic" set in the UI with set and the following keys:
- ChargeEnable
- DischargeEnable
- ForceCharge
For example sending:
- DIY-SMARTBMS/set/ChargeEnable with RAW value of OFF will stop charging, the Charge Current will be set to 0. Sending ON will revert the setting.
- DIY-SMARTBMS/set/DischargeEnable with RAW value of OFF will stop discharging, the Discharge Current will be set to 0. Sending ON will revert the setting.
- DIY-SMARTBMS/set/ForceCharge with RAW value of ON will make the Inverter charge from Grid, Sending OFF will revert the setting.
See the Home Assistant yaml file for details.