Fabian-Schmidt / esphome-victron_ble

Use official Victron BLE endpoint for fetching data from Victron devices via Bluetooth LE via ESPHome.
GNU General Public License v3.0
158 stars 16 forks source link

Additional sensors? Switches possible? #2

Closed snipah closed 1 year ago

snipah commented 1 year ago

Hi Fabian!

As everything is working great, I'd like to ask some questions:

  1. Is it possible to implement additional sensors or is everything, that is being announced via Victron BLE already implemented? I'm wondering, because e. g. the momentary consumption in Watts is not included. I have it implemented in Home Assistant by multiplying the current * 12V, but I assume Victron publishes this info via BLE.
  2. Is you are using an announcement-protocol via BLE I assume Switches are not possible, e. g. for the load-output :)

Thanks a lot for your time and patience!

Fabian-Schmidt commented 1 year ago

Hi, I have implemented all possible data available in the data (and documented by Victron). Watts current consumption you setup on the device as voltage * amps. I will provide you an example when I am on my computer later today. As for consumed Wh is complex and cannot be done accurately.

The data is only broadcasted and no changes to device settings (eg load ouput) is possible. But you could setup your MPPT rx port as load output enabled and provide the signal from your ESP (binary output) via a cable.

Fabian-Schmidt commented 1 year ago

Example calculation of current Watts of shunt:

  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Battery voltage"
    type: BATTERY_VOLTAGE
    id: shunt_BATTERY_VOLTAGE
  - platform: victron_ble
    victron_ble_id: MySmartShunt
    name: "Current"
    type: BATTERY_CURRENT
    id: shunt_BATTERY_CURRENT
  - platform: template
    id: shunt_WATT
    lambda: |-
      const auto voltage = id(shunt_BATTERY_VOLTAGE).state;
      const auto current = id(shunt_BATTERY_CURRENT).state;
      if(std::isnan(voltage) || std::isnan(current)) {
        return NAN;
      } else {
        return voltage * current;
      }
snipah commented 1 year ago

Thanks! Implemented and works like a charm :)