Git Product home page Git Product logo

victronsmartshunt-esphome's Introduction

Deprecated, please use the Victron MPPT library which includes support for MPPT and Smartshunt or BMV.

VictronSmartShunt-ESPHOME

ESPHome component to monitor a Victron BMV and SmartShunt via ve.direct / UART TTL

Supported devices

All BMV and SmartShunt providing a ve.direct port.

Tested devices

  • Victron SmartShunt 500A/50mV

Requirements

Schematics

                UART-TTL
┌────────────────┐                ┌──────────────────┐
│           GND o│<-------------->│o GND             │
│ BMV or     RX o│                │       ESP32/     │
│ SmartShunt TX o│--------------->│o D7   ESP8266    │<-- GND
│       5V/3.3V o│                │                  │<-- 3.3V
└────────────────┘                └──────────────────┘

# UART-TTL jack (JST-PH 2.0mm pinch)
┌────────────────┐
│                │
│ O   O   O   O  │
│VCC  TX  RX GND │
└─── ─────── ────┘

If you are unsure about to pin order please measure the voltage between GND and VCC (5V/3.3V). If you measure a positive voltage you know the position of VCC and GND!

JST-PH jack

Pin Purpose ESP pin
1 GND GND
2 RX
3 TX D7 (RX)
4 5V

Installation

You can install this component with ESPHome external components feature like this:

Example:

external_components:
  - source: github://KinDR007/VictronSmartShunt-ESPHOME@main

uart:
  id: the_uart
  rx_pin: D7
  baud_rate: 19200
  stop_bits: 1
  data_bits: 8
  parity: NONE
  rx_buffer_size: 256

victron_smart_shunt:
  uart_id: the_uart

sensor:
  - platform: victron_smart_shunt
    battery_voltage:
      id: bv
    battery_current:
      id: bc

The uart_id is optional.

All sensors are optional.

  - platform: victron_smart_shunt
    battery_voltage:
      name: "Battery Voltage"
      id: bv

    battery_current:
      name: "Battery Current"
      id: bc

    fw_version:
      name: "fw"
      id: fw

    pid:
      name: "pid"
      id: pid

    instantaneous_power:
      name: "instantaneous power"
      id: instantaneous_power

    time_to_go:
      name: "time to go"
      id: time_to_go

    consumed_amp_hours:
      name: "consumed amp hours"
      id: consumed_amp_hours
      unit_of_measurement: Ah

    min_battery_voltage:
      name: "Min battery voltage"
      id: min_battery_voltage

    max_battery_voltage:
      name: "Max battery voltage"
      id: max_battery_voltage

    amount_of_charged:
      name: "Amount of charged"
      id:  amount_of_charged
      filters:
        - multiply: 0.001
      unit_of_measurement: kWh

    bmv_alarm:
      name: "BMV alarm"
      id: bmv_alarm

    bmv_pid:
      name: "bmv - pid"
      id: bmv_pid

    last_full_charge:
      name: "Time since last full charge"
      id: last_full_charge

    deepest_discharge:
      name: "Depth of the deepest discharge"
      id: deepest_discharge
      unit_of_measurement: Ah

    last_discharge:
      name: "Depth of the last discharge"
      id: last_discharge
      unit_of_measurement: Ah

    discharged_energy:
      name: "Amount of discharged energy"
      id: discharged_energy
      filters:
        - multiply: 0.001
      unit_of_measurement: kWh

    state_of_charge:
      id: state_of_charge
      name: "SoC"

The available numeric sensors are:

  • instantaneous_power
  • time_to_go
  • state_of_charge
  • consumed_amp_hours
  • min_battery_voltage
  • max_battery_voltage
  • amount_of_charged
  • last_full_charge
  • deepest_discharge
  • last_discharge
  • discharged_energy
  • number_of_full_dis
  • number_of_charge_cycles
  • discharged_energy

The available text sensors are:

  • bmv_alarm_text
  • bmv_text
  • charger_text
  • error_text
  • alarm_reason_text
  • tracker_text
  • fw_version
  • pid

Full example in smartshunt.yaml

Big thanks for help to ssieb

#victron #esphome #smartshunt #bmv #ve.direct

victronsmartshunt-esphome's People

Contributors

aidam avatar derekyle avatar kindr007 avatar syssi avatar yoannchaudet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

victronsmartshunt-esphome's Issues

Add MQTT and global throttle?

I had no problem adding the setup info and connecting to my MQTT broker to my ESP32 but could not find anywhere that ESPHome would allow me to add a global throttle. Rather than add a throttle to each topic, I ended up using your VictronMPPT-ESPHOME/smartshunt-esp8266-example.yaml and modifying it for an ESP32 (it's working great even though I find the MQTT topic structure to be rather long-winded).

I tried this first as I only have the SmartShunt and was using the ESP32 but it didn't suit my needs without being able to throttle down the runaway messages I was getting.

ld.exe: cannot find crt1-sim.o

Hi,

I've spent hours trying trying to make this work, but no such luck. Do I have a defective board?
Arduino: 1.8.15 (Windows 10), Board: "SparkFun ESP32 Thing, 80MHz, Default, 921600, None"

C:\Users\kevin\OneDrive\Documents\SmartShuntWiFi\SmartShuntWiFi.ino:138:32: warning: multi-character character constant [-Wmultichar]

 val = Vser.readStringUntil('\r\r\n');              // this is the line that reads the value of the label

                            ^

C:\Users\kevin\OneDrive\Documents\SmartShuntWiFi\SmartShuntWiFi.ino: In function 'void loop()':

C:\Users\kevin\OneDrive\Documents\SmartShuntWiFi\SmartShuntWiFi.ino:138:40: warning: large integer implicitly truncated to unsigned type [-Woverflow]

 val = Vser.readStringUntil('\r\r\n');              // this is the line that reads the value of the label

                                    ^

At global scope:

cc1plus.exe: warning: unrecognized command line option '-Wno-frame-address'

c:/users/kevin/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory

c:/users/kevin/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "WiFiUdp.h"

Used: C:\Users\kevin\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0\libraries\WiFi

Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

Not used: C:\Users\kevin\OneDrive\Documents\Arduino\libraries\WiFi

Not used: C:\Users\kevin\OneDrive\Documents\Arduino\libraries\WiFiEspAT

Multiple libraries were found for "SoftwareSerial.h"

Used: C:\Users\kevin\OneDrive\Documents\Arduino\libraries\EspSoftwareSerial

Not used: C:\Users\kevin\OneDrive\Documents\Arduino\libraries\espsoftwareserial-master

exit status 1

Error compiling for board SparkFun ESP32 Thing.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Battery Capacity entity

hello, Im trying to create a temple to display my battery
remaining capacity in Ah.

here is my code:

- platform: template 
   name: " ${devicename} rem. capacity " 
    id: rc 
    unit_of_measurement: Ah 
    device_class: energy 
    state_class: total_increasing 
    accuracy_decimals: ${accuracy} 
    lambda: |- 
          float i = 0.0;  
          float e = id(bv).state; 
          float w = id(kWhc).state; 
          if (w > 0) { 
            i =  w / e; 
          } 
          return {i}; 

but I get the flollowing error:

Captura

I do have a similar template for battery charge in kWh and that one works:

- platform: template
    name: " ${devicename} charge "
    id: kWhc
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: ${accuracy}
    lambda: |-
          float i = 264 + id(consumed_amp_hours).state; 
          float e = id(bv).state;
          float w = 0.0;
          if (i > 0) {
            w =  i * e;
          }
          return {w};

I just added the id:kWhc to name: " ${devicename} charge "
please advice.
best regards,
Miguel

Second Victron Smart shunt

Hello to everyone,
I installed my second battery pack with second Victron Smart shunt. I set-up the esp8266 as the first one, and i pasted same code of the first one, but doesn't work.
In the working one, there are 38 items, and in the new one there is only one entity.
Screenshot_2023-02-06-17-12-22-073-edit_io homeassistant companion android
Screenshot_2023-02-06-17-11-58-977-edit_io homeassistant companion android

Would same one help me to find the problem?
Thank you for your help

Battery Temperature

Hello,

First of all, this is awesome. Thanks for putting this together, worked like a charm.

I have a VictronSmartShunt with a temperature sensor connected to the aux, would it be possible to pull temperature?

Cheers,
Dick

Energy monitoring in HA

Hi,
[request for enhancement]

Would it be possible, please, to add an entity into the code to allow Home Assistant to pick it up for Baterry monitoring (Energy dashboard)?

image

image

Victron BMV 700

Hello,
i just wanted to ask if the victron BMV 700 is supported.
Victron itself says that the smartshunt is a BMV 712 just without display and potential free relay.
The BMV 700 is a BMV 712, just without bluetooth and the ability to measure the middle voltage of a battery bank.
So it should not be so hard to support it, if it doesnt work right now, should it?

Smart shunt filter data import (not issue)

hello sir,

For a project, I have to find a way to import individual data from the smart shunt. To get the data dump in the first place I have used python code from Github. Using a VE direct cable I was able to get data every second. The problem is that I only need the voltage, current, power and SOC and not all data that the smart shunt sends every second. Do you have an idea how to only get the right data from the data dump?

All information that I used to get the data from the smart shunt you can find here karioja/vedirect.

your sincerely,
livestyle4

issues with smartshunt model SHU065150050 IP65

the other threat was close.
sorry if I doble posted.
in regars of issue #33

image

I got this device and it resets to 100% every single day between 8 am and 9 am, also my %SoC has some really weird spikes of 900%.
i dont think that is the yaml code but definitely theres something wrong.

I have connected the posisitve of the smart shunt to the positive of the batterty and the shart shunt in series with the load and the smartshunt TX to esp8266 D7. no GND to the VE.DIRECT port, but that doesnt eplain why the smart shunt restest to 100% by itself.

image

my yaml code

esphome:
  name: "${lower_devicename}"
  platform: ESP8266
  board: d1_mini
  comment: "Monitor and a Victron Smart Shunt via TTL"

external_components:
  - source: github://KinDR007/VictronSmartShunt-ESPHOME@main
    refresh: 0s

substitutions:
  lower_devicename: "smartshunt"
  devicename: "SmartShunt"
  config_version: "v2021.06.02.001"
  wifi_fast_connect: "true"
  accuracy: "3"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

  manual_ip:
    static_ip: 192.168.0.23
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 192.168.0.1
    dns2: 8.8.8.8
 
  ap:
    ssid: "${devicename} Hotspot"
    password: !secret wifi_ap_password

captive_portal:

logger:
  baud_rate: 0

api:

ota:

web_server:
  port: 80

time:
  - platform: homeassistant

uart:
  id: uart_0
  tx_pin: D8
  rx_pin: D7
  baud_rate: 19200
  stop_bits: 1
  data_bits: 8
  parity: NONE
  rx_buffer_size: 256

victron_smart_shunt:
  uart_id: uart_0

sensor:
  - platform: victron_smart_shunt
    battery_voltage:
      name: "Battery Voltage"
      id: bv
      accuracy_decimals: ${accuracy}

    battery_current:
      name: "Battery Current"
      id: bc 
      accuracy_decimals: ${accuracy}


    instantaneous_power:
      name: "instantaneous power"
      id: instantaneous_power
      filters:
        - multiply: 0.001
      unit_of_measurement: kWh
      accuracy_decimals: ${accuracy}

    time_to_go:
      name: "time to go"
      id: time_to_go

    consumed_amp_hours:
      name: "consumed amp hours"
      id: consumed_amp_hours
      unit_of_measurement: Ah
      accuracy_decimals: ${accuracy}

    min_battery_voltage:
      name: "Min battery voltage"
      id: min_battery_voltage
      accuracy_decimals: ${accuracy}

    max_battery_voltage:
      name: "Max battery voltage"
      id: max_battery_voltage
      accuracy_decimals: ${accuracy}

    amount_of_charged:
      name: "Amount of charged"
      id:  amount_of_charged   
      filters:
        - multiply: 0.000001
      unit_of_measurement: MWh
      device_class: energy
      state_class: total_increasing
      accuracy_decimals: ${accuracy}
      
    bmv_alarm_text:
      name: "BMV alarm"
      id: bmv_alarm
     
    last_full_charge:
      name: "Time since last full charge"
      id: last_full_charge

    deepest_discharge:
      name: "Depth of the deepest discharge"
      id: deepest_discharge
      unit_of_measurement: Ah
      accuracy_decimals: ${accuracy}

    last_discharge:
      name: "Depth of the last discharge"
      id: last_discharge
      unit_of_measurement: Ah
      accuracy_decimals: ${accuracy}

    state_of_charge:
      id: state_of_charge
      name: "SoC"

    discharged_energy:
      name: "Amount of discharged energy"
      id: discharged_energy   
      filters:
        - multiply: 0.000001
      unit_of_measurement: MWh
      device_class: energy
      state_class: total_increasing
      accuracy_decimals: ${accuracy}
      
  - platform: template
    name: " ${devicename} discharge "
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: ${accuracy}
    lambda: |-
          float i = id(consumed_amp_hours).state;
          float e = id(bv).state;
          float w = 0.0;
          if (i < 0) {
            w = i * e;
          }
          return {w * -1} ;
        
     
    
  - platform: template
    name: " ${devicename} charge "
    filters:
      - multiply: 0.001
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: ${accuracy}
    lambda: |-
          float i = 792 + id(consumed_amp_hours).state; 
          float e = id(bv).state;
          float w = 0.0;
          if (i > 0) {
            w =  i * e;
          }
          return {w} ;

  - platform: template
    name: " ${devicename} Rem. Capacity "
    unit_of_measurement: Ah
    device_class: energy
    state_class: total_increasing
    lambda: |-
      if (id(state_of_charge).state) {
        return 792 * (id(state_of_charge).state * 0.01f); 
      }
      return NAN;


switch:
  - platform: restart
    icon: mdi:reload-alert
    name: "${devicename} Restart"

Best Regards,
M.

Rename component to victron_smart_shunt

Do you agree to rename this component to victron_smart_shunt? Without the name clash between VictronMPPT-ESPHOME and VictronSmartShunt-ESPHOME both components could be used simultaneously at the same ESP (on different UARTs).

model SHU065150050 IP65

has anyone tried to use the new smartshunt model
SHU065150050 IP65 . its waterproof and the ve. direct is a cable instead of a port

thanks
Miguel

BMV 712 Not sending info.

so everything works and uploads fine but I can not for the life of me get it to show anything from the BMV everything is unavailable I've changed pins and everything I can think of. I checked the voltage and I should be correct haha. Has anyone gotten anything other than the smart shunt to read?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.