stuartpittaway / diyBMSv4ESP32

diyBMS v4 code for the ESP32 and new controller hardware
Other
179 stars 80 forks source link

MQTT compatibility with HomeAssistant #49

Open vajpeters opened 3 years ago

vajpeters commented 3 years ago

Since HomeAssistant is getting a defacto standard, it would be nice to create a MQTT compatibility mode with HomeAssistant.

stuartpittaway commented 3 years ago

What's needed to make it work?

vajpeters commented 3 years ago

It's pretty well documented here: https://www.home-assistant.io/docs/mqtt/discovery/ Mainly it's about naming and structure conventions. Would this be possible?

shampeon commented 3 years ago

Just another vote for adding the necessary auto-discovery topics. This would make it incredibly easy to incorporate a diyBMS battery into Home Assistant's new Energy platform.

stuartpittaway commented 3 years ago

A battery or BMS doesn't appear to be in the list of supported discoverable devices. Is the document out of date?

shampeon commented 3 years ago

They would be sensor devices, where you set the class and unit, etc.

For example, this is the discovery topic for one of the sensors from an MPP Solar inverter.

homeassistant/sensor/Inverter_100177/Battery_voltage/config {
            "name": "Battery_voltage_Inverter",
            "uniq_id": "100177_Battery_voltage",
            "device": { "ids": "100177", "mf": "MPPSolar", "mdl": "PIP3048LV-MK", "name": "Inverter", "sw": "61.01"},
            "state_topic": "homeassistant/sensor/Inverter_100177/Battery_voltage",
            "state_class": "measurement",
            "unit_of_meas": "V",
            "icon": "mdi:battery-outline"
        }
natiz commented 2 years ago

+1 for this, I would look into adding a esphome component (a custom one for starters) instead of using mqtt directly.

Have a look at the Daly BMS component for inspiration: https://github.com/esphome/esphome/tree/dev/esphome/components/daly_bms

Linusten commented 1 year ago

+1 on this, maybe someone is able to add this :)

schmue81 commented 1 year ago

+1

stuartpittaway commented 1 year ago

It's in the pipeline!