Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking Esphome #132

Closed
swifty99 opened this issue Nov 5, 2023 · 5 comments · Fixed by #133 · May be fixed by #139
Closed

Blocking Esphome #132

swifty99 opened this issue Nov 5, 2023 · 5 comments · Fixed by #133 · May be fixed by #139

Comments

@swifty99
Copy link

swifty99 commented Nov 5, 2023

Hi,

I like this component, however there are timing issues:

[21:53:00][W][component:214]: Component esphome.coroutine took a long time for an operation (0.22 s).
[21:53:00][W][component:215]: Components should block for at most 20-30ms.

I tracked this down to the victron platform. Excluding it stops giving these warnings.

esphome version
Version: 2023.10.6

on a ESP32:

esp32:
  board: az-delivery-devkit-v4
  #board:   nodemcu-32s
  framework:
    type: arduino

when disconnectin the serial, the warnings disappear.
Looking at the code this might be a problem:

  last_transmission_ = now;
  while (available()) {
    uint8_t c;
    read_byte(&c);
    if (state_ == 0) {

while available could take some time.

more information here:
esphome/issues#4717

maybe reading the buffer state could help:
https://arduino.stackexchange.com/questions/9666/how-to-avoid-blocking-while-loop-reading-serial

cheers
Jan

@KinDR007
Copy link
Owner

KinDR007 commented Nov 6, 2023

Hi,

I like this component, however there are timing issues:


[21:53:00][W][component:214]: Component esphome.coroutine took a long time for an operation (0.22 s).

[21:53:00][W][component:215]: Components should block for at most 20-30ms.

I tracked this down to the victron platform. Excluding it stops giving these warnings.


esphome version

Version: 2023.10.6

on a ESP32:


esp32:

  board: az-delivery-devkit-v4

  #board:   nodemcu-32s

  framework:

    type: arduino

when disconnectin the serial, the warnings disappear.

Looking at the code this might be a problem:


  last_transmission_ = now;

  while (available()) {

    uint8_t c;

    read_byte(&c);

    if (state_ == 0) {

while available could take some time.

more information here:

esphome/issues#4717

maybe reading the buffer state could help:

https://arduino.stackexchange.com/questions/9666/how-to-avoid-blocking-while-loop-reading-serial

cheers

Jan

Hi Jan,

Can you please send me your full sketch ?

@swifty99
Copy link
Author

swifty99 commented Nov 6, 2023

sure.

substitutions:
  plug_name: victron
  ip_adress: "192.168.178.170"
  name: "victron"

esphome:
  name: ${plug_name}
 # esp8266_restore_from_flash: true


# device_base.yaml
preferences:
  flash_write_interval: 10min
# covers generic basics

wifi:
  networks:
  - ssid: "Bit4Thing_wz"
    password: !secret wifi_pw_home
  - ssid: "Bit_Pumpe"
    password: !secret wifi_pw_home 
  - ssid: "Bit4Thing"
    password: !secret wifi_pw_4thing 
  - ssid: "BitMobil"
    password: !secret wifi_password_mobile 

  ap:
    ssid: "${plug_name}.a"
    password: !secret web_server_password

logger:
  level: DEBUG
  logs:
    adc: ERROR

api:
  reboot_timeout: 0h

ota:

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

web_server:
  port: 80

esp32:
  board: az-delivery-devkit-v4
  #board:   nodemcu-32s
  framework:
    type: arduino





uart:
  id: uart0v
  rx_pin: 33 # Connect this this GPIO and GND to the MPPT charger
  baud_rate: 19200
  rx_buffer_size: 256

victron:
  uart_id: uart0v
  id: victron0
  throttle: 10s



binary_sensor:
  - platform: victron
    victron_id: victron0
    load_state:
      name: "${name} load state"
    relay_state:
      name: "${name} relay state"      




text_sensor:   
  - platform: victron
    victron_id: victron0
    charging_mode:
      name: "${name} charging mode"
    error:
      name: "${name} error"
    tracking_mode:
      name: "${name} tracking mode"
    firmware_version:
      name: "${name} firmware version"
    device_type:
      name: "${name} device type"
    serial_number:
      name: "${name} serial number"


# Individual sensors
sensor:
  - platform: victron
    victron_id: victron0
    max_power_yesterday:
      name: "${name} max power yesterday"
    max_power_today:
      name: "${name} max power today"
    yield_total:
      name: "${name} yield total"
    yield_yesterday:
      name: "${name} yield yesterday"
    yield_today:
      name: "${name} yield today"
    panel_voltage:
      name: "${name} panel voltage"
    panel_power:
      name: "${name} panel power"
    battery_current:
      name: "${name} battery current"
    battery_voltage:
      name: "${name} battery voltage"
    day_number:
      name: "${name} day number"
    charging_mode_id:
      name: "${name} charging mode id"
    error_code:
      name: "${name} error code"
    tracking_mode_id:
      name: "${name} tracking mode id"
    load_current:
      name: "${name} load current"

and the full log:

INFO Successfully compiled program.
INFO Connecting to 192.168.178.53
INFO Uploading .\.esphome\build/victron\.pioenvs\victron\firmware.bin (886768 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.178.53 using esphome API
INFO Successfully connected to 192.168.178.53
[18:09:55][I][app:102]: ESPHome version 2023.10.6 compiled on Nov  6 2023, 18:09:20
[18:09:55][C][wifi:546]: WiFi:
[18:09:55][C][wifi:382]:   Local MAC: 42:91:51:AB:53:10
[18:09:55][C][wifi:383]:   SSID: 'Bit_Pumpe'
[18:09:55][C][wifi:384]:   IP Address: 192.168.178.53
[18:09:55][C][wifi:386]:   BSSID: 42:8A:20:DA:9D:4E
[18:09:55][C][wifi:387]:   Hostname: 'victron'
[18:09:55][C][wifi:389]:   Signal strength: -60 dB ▂▄▆█
[18:09:55][C][wifi:393]:   Channel: 6
[18:09:55][C][wifi:394]:   Subnet: 255.255.255.0
[18:09:55][C][wifi:395]:   Gateway: 192.168.178.1
[18:09:55][C][wifi:396]:   DNS1: 192.168.42.226
[18:09:55][C][wifi:397]:   DNS2: 192.168.42.225
[18:09:55][C][logger:416]: Logger:
[18:09:55][C][logger:417]:   Level: DEBUG
[18:09:55][C][logger:418]:   Log Baud Rate: 115200
[18:09:55][C][logger:420]:   Hardware UART: UART0
[18:09:55][C][logger:424]:   Level for 'adc': ERROR
[18:09:55][C][uart.arduino_esp32:124]: UART Bus 1:
[18:09:55][C][uart.arduino_esp32:126]:   RX Pin: GPIO33
[18:09:55][C][uart.arduino_esp32:128]:   RX Buffer Size: 256
[18:09:55][C][uart.arduino_esp32:130]:   Baud Rate: 19200 baud
[18:09:55][C][uart.arduino_esp32:131]:   Data Bits: 8
[18:09:55][C][uart.arduino_esp32:132]:   Parity: NONE
[18:09:55][C][uart.arduino_esp32:133]:   Stop bits: 1
[18:09:55][C][victron:032]: Victron:
[18:09:55][C][victron:033]:   Load state 'victron load state'
[18:09:55][C][victron:034]:   Relay state 'victron relay state'
[18:09:55][C][victron:035]:   Max Power Yesterday 'victron max power yesterday'
[18:09:55][C][victron:035]:     Device Class: 'power'
[18:09:55][C][victron:035]:     State Class: ''
[18:09:55][C][victron:035]:     Unit of Measurement: 'W'
[18:09:55][C][victron:035]:     Accuracy Decimals: 0
[18:09:55][C][victron:035]:     Icon: 'mdi:power'
[18:09:55][C][victron:036]:   Max Power Today 'victron max power today'
[18:09:55][C][victron:036]:     Device Class: 'power'
[18:09:55][C][victron:036]:     State Class: ''
[18:09:55][C][victron:036]:     Unit of Measurement: 'W'
[18:09:55][C][victron:036]:     Accuracy Decimals: 0
[18:09:55][C][victron:036]:     Icon: 'mdi:power'
[18:09:55][C][victron:037]:   Yield Total 'victron yield total'
[18:09:55][C][victron:037]:     Device Class: 'power'
[18:09:55][C][victron:037]:     State Class: 'total_increasing'
[18:09:55][C][victron:037]:     Unit of Measurement: 'Wh'
[18:09:55][C][victron:037]:     Accuracy Decimals: 0
[18:09:55][C][victron:037]:     Icon: 'mdi:power'
[18:09:55][C][victron:038]:   Yield Yesterday 'victron yield yesterday'
[18:09:55][C][victron:038]:     Device Class: 'power'
[18:09:55][C][victron:038]:     State Class: 'total_increasing'
[18:09:55][C][victron:038]:     Unit of Measurement: 'Wh'
[18:09:55][C][victron:038]:     Accuracy Decimals: 0
[18:09:55][C][victron:038]:     Icon: 'mdi:power'
[18:09:55][C][victron:039]:   Yield Today 'victron yield today'
[18:09:55][C][victron:039]:     Device Class: 'power'
[18:09:55][C][victron:039]:     State Class: 'total_increasing'
[18:09:55][C][victron:039]:     Unit of Measurement: 'Wh'
[18:09:55][C][victron:039]:     Accuracy Decimals: 0
[18:09:55][C][victron:039]:     Icon: 'mdi:power'
[18:09:55][C][victron:040]:   Panel Voltage 'victron panel voltage'
[18:09:55][C][victron:040]:     Device Class: 'voltage'
[18:09:55][C][victron:040]:     State Class: ''
[18:09:55][C][victron:040]:     Unit of Measurement: 'V'
[18:09:55][C][victron:040]:     Accuracy Decimals: 3
[18:09:55][C][victron:040]:     Icon: 'mdi:flash'
[18:09:55][C][victron:041]:   Panel Power 'victron panel power'
[18:09:55][C][victron:041]:     Device Class: 'power'
[18:09:55][C][victron:041]:     State Class: ''
[18:09:55][C][victron:041]:     Unit of Measurement: 'W'
[18:09:55][C][victron:041]:     Accuracy Decimals: 0
[18:09:55][C][victron:041]:     Icon: 'mdi:power'
[18:09:55][C][victron:042]:   Battery Voltage 'victron battery voltage'
[18:09:55][C][victron:042]:     Device Class: 'voltage'
[18:09:55][C][victron:042]:     State Class: ''
[18:09:55][C][victron:042]:     Unit of Measurement: 'V'
[18:09:55][C][victron:042]:     Accuracy Decimals: 3
[18:09:55][C][victron:042]:     Icon: 'mdi:flash'
[18:09:55][C][victron:045]:   Battery Current 'victron battery current'
[18:09:55][C][victron:045]:     Device Class: 'current'
[18:09:55][C][victron:045]:     State Class: ''
[18:09:55][C][victron:045]:     Unit of Measurement: 'A'
[18:09:55][C][victron:045]:     Accuracy Decimals: 3
[18:09:55][C][victron:045]:     Icon: 'mdi:current-ac'
[18:09:55][C][victron:050]:   Load Current 'victron load current'
[18:09:55][C][victron:050]:     Device Class: 'current'
[18:09:55][C][victron:050]:     State Class: ''
[18:09:55][C][victron:050]:     Unit of Measurement: 'A'
[18:09:55][C][victron:050]:     Accuracy Decimals: 3
[18:09:55][C][victron:050]:     Icon: 'mdi:current-ac'
[18:09:55][C][victron:051]:   Day Number 'victron day number'
[18:09:55][C][victron:051]:     State Class: ''
[18:09:55][C][victron:051]:     Unit of Measurement: ''
[18:09:55][C][victron:051]:     Accuracy Decimals: 0
[18:09:55][C][victron:052]:   Charging Mode ID 'victron charging mode id'
[18:09:55][C][victron:052]:     State Class: ''
[18:09:55][C][victron:052]:     Unit of Measurement: ''
[18:09:55][C][victron:052]:     Accuracy Decimals: 0
[18:09:55][C][victron:053]:   Error Code 'victron error code'
[18:09:55][C][victron:053]:     State Class: ''
[18:09:55][C][victron:053]:     Unit of Measurement: ''
[18:09:55][C][victron:053]:     Accuracy Decimals: 0
[18:09:55][C][victron:055]:   Tracking Mode ID 'victron tracking mode id'
[18:09:55][C][victron:055]:     State Class: ''
[18:09:55][C][victron:055]:     Unit of Measurement: ''
[18:09:55][C][victron:055]:     Accuracy Decimals: 0
[18:09:55][C][victron:058]:   Charging Mode 'victron charging mode'
[18:09:55][C][victron:059]:   Error Text 'victron error'
[18:09:55][C][victron:061]:   Tracking Mode 'victron tracking mode'
[18:09:55][C][victron:063]:   Firmware Version 'victron firmware version'
[18:09:55][C][victron:065]:   Device Type 'victron device type'
[18:09:55][C][web_server:161]: Web Server:
[18:09:55][C][web_server:162]:   Address: victron.local:80
[18:09:55][C][mdns:115]: mDNS:
[18:09:55][C][mdns:116]:   Hostname: victron
[18:09:55][C][ota:097]: Over-The-Air Updates:
[18:09:55][C][ota:098]:   Address: victron.local:3232
[18:09:55][C][api:139]: API Server:
[18:09:55][C][api:140]:   Address: victron.local:6053
[18:09:55][C][api:144]:   Using noise encryption: NO
[18:09:55][D][api:102]: Accepted 192.168.42.42
[18:09:55][D][api.connection:1050]: Home Assistant 2023.11.1 (192.168.42.42): Connected successfully
[18:09:57][D][sensor:094]: 'victron battery voltage': Sending state 26.84000 V with 3 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron battery current': Sending state -0.02000 A with 3 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron panel voltage': Sending state 0.01000 V with 3 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron panel power': Sending state 0.00000 W with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron charging mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:09:57][D][text_sensor:064]: 'victron charging mode': Sending state 'Off'
[18:09:57][D][sensor:094]: 'victron tracking mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:09:57][D][text_sensor:064]: 'victron tracking mode': Sending state 'Off'
[18:09:57][D][sensor:094]: 'victron error code': Sending state 0.00000  with 0 decimals of accuracy
[18:09:57][D][text_sensor:064]: 'victron error': Sending state 'No error'
[18:09:57][D][sensor:094]: 'victron load current': Sending state 0.00000 A with 3 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron yield total': Sending state 15250.00000 Wh with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron yield today': Sending state 0.00000 Wh with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron max power today': Sending state 0.00000 W with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron yield yesterday': Sending state 610.00000 Wh with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron max power yesterday': Sending state 118.00000 W with 0 decimals of accuracy
[18:09:57][D][sensor:094]: 'victron day number': Sending state 134.00000  with 0 decimals of accuracy
[18:09:57][W][component:214]: Component esphome.coroutine took a long time for an operation (0.18 s).
[18:09:57][W][component:215]: Components should block for at most 20-30ms.
[18:10:08][D][sensor:094]: 'victron battery voltage': Sending state 26.84000 V with 3 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron battery current': Sending state -0.03000 A with 3 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron panel voltage': Sending state 0.01000 V with 3 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron panel power': Sending state 0.00000 W with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron charging mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:10:08][D][text_sensor:064]: 'victron charging mode': Sending state 'Off'
[18:10:08][D][sensor:094]: 'victron tracking mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:10:08][D][text_sensor:064]: 'victron tracking mode': Sending state 'Off'
[18:10:08][D][sensor:094]: 'victron error code': Sending state 0.00000  with 0 decimals of accuracy
[18:10:08][D][text_sensor:064]: 'victron error': Sending state 'No error'
[18:10:08][D][sensor:094]: 'victron load current': Sending state 0.00000 A with 3 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron yield total': Sending state 15250.00000 Wh with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron yield today': Sending state 0.00000 Wh with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron max power today': Sending state 0.00000 W with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron yield yesterday': Sending state 610.00000 Wh with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron max power yesterday': Sending state 118.00000 W with 0 decimals of accuracy
[18:10:08][D][sensor:094]: 'victron day number': Sending state 134.00000  with 0 decimals of accuracy
[18:10:08][W][component:214]: Component esphome.coroutine took a long time for an operation (0.18 s).
[18:10:08][W][component:215]: Components should block for at most 20-30ms.
[18:10:19][D][sensor:094]: 'victron battery voltage': Sending state 26.84000 V with 3 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron battery current': Sending state -0.02000 A with 3 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron panel voltage': Sending state 0.01000 V with 3 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron panel power': Sending state 0.00000 W with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron charging mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:10:19][D][text_sensor:064]: 'victron charging mode': Sending state 'Off'
[18:10:19][D][sensor:094]: 'victron tracking mode id': Sending state 0.00000  with 0 decimals of accuracy
[18:10:19][D][text_sensor:064]: 'victron tracking mode': Sending state 'Off'
[18:10:19][D][sensor:094]: 'victron error code': Sending state 0.00000  with 0 decimals of accuracy
[18:10:19][D][text_sensor:064]: 'victron error': Sending state 'No error'
[18:10:19][D][sensor:094]: 'victron load current': Sending state 0.00000 A with 3 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron yield total': Sending state 15250.00000 Wh with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron yield today': Sending state 0.00000 Wh with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron max power today': Sending state 0.00000 W with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron yield yesterday': Sending state 610.00000 Wh with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron max power yesterday': Sending state 118.00000 W with 0 decimals of accuracy
[18:10:19][D][sensor:094]: 'victron day number': Sending state 134.00000  with 0 decimals of accuracy
[18:10:19][W][component:214]: Component esphome.coroutine took a long time for an operation (0.17 s).
[18:10:19][W][component:215]: Components should block for at most 20-30ms.
[18:10:30][D][sensor:094]: 'victron battery voltage': Sending state 26.84000 V with 3 decimals of accuracy
[18:10:30][D][sensor:094]: 'victron battery current': Sending state -0.02000 A with 3

@raphaelsavina
Copy link

raphaelsavina commented Nov 7, 2023

Hi!

I have the exact same problem, here is my code and log (on a side note, this is working with a SmartSolar 100/50 and Smartshunt):

substitutions:
  devicename: "victron"
  device0: "smartsolar"
  device1: "smartshunt"
  devicename0: "SmartSolar 100/50"
  devicename1: "SmartShunt"
  wifi_fast_connect: "false"
  external_components_source: github://KinDR007/VictronMPPT-ESPHOME@main

esphome:
  name: ${devicename}
  platform: ESP8266
  board: nodemcu

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  power_save_mode: none
  fast_connect: $wifi_fast_connect
  manual_ip:
    static_ip: 192.168.0.201
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 8.8.8.8
    dns2: 1.1.1.1
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "${devicename} Hotspot"
    password: !secret wifi_password

captive_portal:

logger:
  baud_rate: 0
  # level: VERY_VERBOSE
  esp8266_store_log_strings_in_flash: false

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80

time:
  - platform: homeassistant

uart:
  - id: uart_0
    tx_pin: D8  # Not connected! The communication is read-only
    rx_pin: D7  # Connect this this GPIO and GND to the first MPPT charger
    baud_rate: 19200
    stop_bits: 1
    data_bits: 8
    parity: NONE
    rx_buffer_size: 512
  - id: uart_1
    tx_pin: D6  # Not connected! The communication is read-only
    rx_pin: D5  # Connect this this GPIO and GND to the second MPPT charger
    baud_rate: 19200
    stop_bits: 1
    data_bits: 8
    parity: NONE
    rx_buffer_size: 512

victron:
  - id: ${device0}
    uart_id: uart_0
  - id: ${device1}
    uart_id: uart_1

sensor:
  - platform: victron
    victron_id: ${device0}
    panel_voltage:
      name: "${devicename0} Panel voltage"
      id: pv
    battery_voltage:
      name: "${devicename0} Battery voltage"
      id: bv
    battery_current:
      name: "${devicename0} Battery current"
      id: bc
    load_current:
      name: "${devicename0} Load current"
      id: load_current
    max_power_today:
      name: "${devicename0} Max power today"
      id: max_power_today
    panel_power:
      name: "${devicename0} Panel power"
      id: panel_power
    charging_mode_id:
      name: "${devicename0} Charger mode id"
    error_code:
      name: "${devicename0} Error code"
    tracking_mode_id:
      name: "${devicename0} Tracker mode id"

  - platform: victron
    victron_id: ${device1}
    battery_voltage:
      name: "${devicename1} battery voltage"
    midpoint_voltage_of_the_battery_bank:
      name: "${devicename1} midpoint voltage of the battery bank"
    midpoint_deviation_of_the_battery_bank:
      name: "${devicename1} midpoint deviation of the battery bank"
    battery_current:
      name: "${devicename1} battery current"
    instantaneous_power:
      name: "${devicename1} instantaneous power"
    consumed_amp_hours:
      name: "${devicename1} consumed amp hours"
    state_of_charge:
      name: "${devicename1} state of charge"
    time_to_go:
      name: "${devicename1} time to go"

text_sensor:
  - platform: victron
    victron_id: ${device0}
    charging_mode:
      name: "${devicename0} Charging Mode"
    error:
      name: "${devicename0} Error"
    tracking_mode:
      name: "${devicename0} Tracking Mode"

  - platform: victron
    victron_id: ${device1}
    alarm_condition_active:
      name: "${devicename1} alarm condition active"
    alarm_reason:
      name: "${devicename1} alarm reason"
    dc_monitor_mode:
      name: "${devicename1} dc monitor mode"

binary_sensor:
  - platform: victron
    victron_id: ${device1}
    relay_state:
      name: "${devicename1} relay state"

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

log:

17:34:50 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Charging Mode': Sending state 'Off'
17:34:50 | [D] | [sensor:093] | 'SmartSolar 100/50 Tracker mode id': Sending state 0.00000  with 0 decimals of accuracy
17:34:50 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Tracking Mode': Sending state 'Off'
17:34:50 | [D] | [sensor:093] | 'SmartSolar 100/50 Error code': Sending state 0.00000  with 0 decimals of accuracy
17:34:50 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Error': Sending state 'No error'
17:34:50 | [W] | [component:214] | Component esphome.coroutine took a long time for an operation (0.06 s).
17:34:50 | [W] | [component:215] | Components should block for at most 20-30ms.
17:34:50 | [D] | [sensor:093] | 'SmartSolar 100/50 Max power today': Sending state 845.00000 W with 0 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt battery voltage': Sending state 24.74100 V with 3 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt midpoint voltage of the battery bank': Sending state 12.35400 V with 3 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt midpoint deviation of the battery bank': Sending state 0.10000 % with 0 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt battery current': Sending state 0.00000 A with 3 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt instantaneous power': Sending state 0.00000 W with 0 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt consumed amp hours': Sending state -186.84500 Ah with 3 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt state of charge': Sending state 79.90000 % with 0 decimals of accuracy
17:34:50 | [D] | [sensor:093] | 'SmartShunt time to go': Sending state -1.00000 min with 0 decimals of accuracy
17:34:50 | [D] | [text_sensor:064] | 'SmartShunt alarm condition active': Sending state 'OFF'
17:34:50 | [D] | [text_sensor:064] | 'SmartShunt alarm reason': Sending state 'No error'
17:34:50 | [D] | [text_sensor:064] | 'SmartShunt dc monitor mode': Sending state 'Battery monitor (BMV)'
17:34:50 | [W] | [component:214] | Component esphome.coroutine took a long time for an operation (0.08 s).
17:34:50 | [W] | [component:215] | Components should block for at most 20-30ms.
17:34:51 | [W] | [victron:093] | Last transmission too long ago
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Battery voltage': Sending state 24.77000 V with 3 decimals of accuracy
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Battery current': Sending state 0.00000 A with 3 decimals of accuracy
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Panel voltage': Sending state 3.16000 V with 3 decimals of accuracy
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Panel power': Sending state 0.00000 W with 0 decimals of accuracy
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Charger mode id': Sending state 0.00000  with 0 decimals of accuracy
17:34:52 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Charging Mode': Sending state 'Off'
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Tracker mode id': Sending state 0.00000  with 0 decimals of accuracy
17:34:52 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Tracking Mode': Sending state 'Off'
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Error code': Sending state 0.00000  with 0 decimals of accuracy
17:34:52 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Error': Sending state 'No error'
17:34:52 | [D] | [sensor:093] | 'SmartSolar 100/50 Max power today': Sending state 845.00000 W with 0 decimals of accuracy
17:34:52 | [W] | [component:214] | Component esphome.coroutine took a long time for an operation (0.07 s).
17:34:52 | [W] | [component:215] | Components should block for at most 20-30ms.
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Battery voltage': Sending state 24.78000 V with 3 decimals of accuracy
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Battery current': Sending state 0.00000 A with 3 decimals of accuracy
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Panel voltage': Sending state 3.16000 V with 3 decimals of accuracy
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Panel power': Sending state 0.00000 W with 0 decimals of accuracy
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Charger mode id': Sending state 0.00000  with 0 decimals of accuracy
17:34:54 | [D] | [text_sensor:064] | 'SmartSolar 100/50 Charging Mode': Sending state 'Off'
17:34:54 | [D] | [sensor:093] | 'SmartSolar 100/50 Tracker mode id': Sending state 0.00000  with 0 decimals of accuracy

Thanks!
Raphaël

@lucasimons
Copy link

I have a similar issue, when i have installed esphome 10.6 the victron component report this warning, it si strange because sometimes it works fine but for exemple today, most the time not works... I have tried to reboot but it not works

[22:24:43][W][component:215]: Components should block for at most 20-30ms.
[22:24:44][W][victron:093]: Last transmission too long ago

image

this is my config:

esphome:
  name: sottoscala-esp8266-1
  friendly_name: sottoscala-esp8266-1

esp8266:
  board: d1_mini
  
external_components:

#  - source: github://syssi/esphome-pipsolar@2424mse1
#   refresh: 0s
 - source: github://KinDR007/VictronMPPT-ESPHOME@main
   refresh: 0s
 - source: github://syssi/esphome-ant-bms@main
   refresh: 0s

# Enable logging
logger:
  baud_rate: 0





uart:
#victron
- id: uart_bus
  tx_pin: D8 # not connected !! 
  rx_pin: D7 # d7 use olny this pin and GND to MPPT chrager
  baud_rate: 19200 
  stop_bits: 1
  data_bits: 8
  parity: NONE
  rx_buffer_size: 256
 #ant bms 
- id: uart_antbms
  baud_rate: 19200
  rx_buffer_size: 384
  tx_pin: GPIO4
  rx_pin: GPIO5






ant_bms:
  - id: bms0
    uart_id: uart_antbms
    password: "12345678"
    update_interval: 5s
    supports_new_commands: false



  
victron:
  id: victron0
  uart_id: uart_bus  
  throttle: 6s






sensor:
  - platform: victron
    victron_id: victron0
    panel_voltage:
      name: "Tensione Fotovoltaico 2" 
      id: pv

    battery_voltage:
      name: "Batteria Tensione"  
      id: bv


    battery_current:
      name: "Batteria Corrente" 
      id: bc
      
    load_current:
      name: "Corrente carichi DC" 
      id: load_current
      filters:
       - sliding_window_moving_average:
          window_size: 4
          send_every: 4
    max_power_yesterday:  
      name: "Massima potenza Ieri" 
      id: max_power_yesterday
     
    max_power_today:  
      name: "Massima potenza Oggi" 
      id: max_power_today
      accuracy_decimals: 2
       
    yield_total:
      name: "Energia Totale Victron"   
      id: yield_total
      filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001

      unit_of_measurement: kWh
      accuracy_decimals: 2
    yield_yesterday:
      name: "Energia FV2 Ieri"
      filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001

      unit_of_measurement: kWh
      accuracy_decimals: 2
    yield_today:
      name: "Energia FV2 Oggi"  
      id: yt
      filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
      
      unit_of_measurement: kWh
      accuracy_decimals: 2
    panel_power:
      name: "Potenza Fotovoltaico 2"  
      id: panel_power
 
    day_number:
      name: "Day sequence number"  
      id: day_number
      icon: "mdi:calendar-today"

      
  - platform: ant_bms
    current:
      name: "bms1 current"
      
    soc:
      name: "bms1 soc"
      
    capacity_remaining:
      name: "bms1 capacity remaining"
      
    battery_cycle_capacity:
      name: "bms1 battery cycle capacity"
      
    total_voltage:
      name: "bms1 total voltage"
      
    total_runtime:
      name: "bms1 total runtime"
    average_cell_voltage:
      name: "bms1 average cell voltage"
      
    power:
      name: "bms1 power"
     
    min_cell_voltage:
      name: "bms1 min cell voltage"
      
    max_cell_voltage:
      name: "bms1 max cell voltage"
      
    min_voltage_cell:
      name: "bms1 min voltage cell"
      
    max_voltage_cell:
      name: "bms1 max voltage cell"
      
    temperature_1:
      name: "bms1 temperature 1"
      
    temperature_2:
      name: "bms1 temperature 2"
      
    temperature_3:
      name: "bms1 temperature 3"
      
    temperature_4:
      name: "bms1 temperature 4"
      
    cell_voltage_1:
      name: "bms1 cell voltage 1"
      
    cell_voltage_2:
      name: "bms1 cell voltage 2"
      
    cell_voltage_3:
      name: "bms1 cell voltage 3" 
      
    cell_voltage_4:
      name: "bms1 cell voltage 4"
      
    cell_voltage_5:
      name: "bms1 cell voltage 5"
      
    cell_voltage_6:
      name: "bms1 cell voltage 6"
      
    cell_voltage_7:
      name: "bms1 cell voltage 7"
      
    cell_voltage_8:
      name: "bms1 cell voltage 8"
      
    charge_mosfet_status_code:
      name: "bms1 charge mosfet status code"
    discharge_mosfet_status_code:
      name: "bms1 discharge mosfet status code"
    balancer_status_code:
      name: "bms1 balancer status code"

  - platform: wifi_signal
    name: "WiFi Signal Sensor Sottoscala 2"
    update_interval: 5s





  - platform: uptime
    name: "Sottoscala 2 ESP32 Uptime"
    id: uptime_s
    update_interval: 5s    
text_sensor:
 # - platform: victron
 #   victron_id: victron0
 #   charging_mode:
 #     name: "Charging Mode"
 #   error:
 #     name: "Error"
 #   tracking_mode:
 #     name: "Tracking Mode"

  - platform: ant_bms
    charge_mosfet_status:
      name: "bms1 charge mosfet status"
    discharge_mosfet_status:
      name: "bms1 discharge mosfet status"
    balancer_status:
      name: "bms1 balancer status"
    total_runtime_formatted:
      name: "bms1 total runtime formatted"






switch:

  - platform: ant_bms
    charging:
      name: "bms1 charging"
    discharging:
      name: "bms1 discharging"

    
 
        
  - platform: gpio
    name: "Rel1"
    pin: GPIO14
    
  - platform: restart
    name: "sottoscala-esp8266-1 Restart"
   
binary_sensor:
    
  - platform: gpio
    pin: GPIO0
    name: "Botola"
    device_class: door


    

@swifty99
Copy link
Author

one more remark,

there is quite a bit of a timeout until available() gets false.
Chatgpt recommended this approach, which seems ok:

void setup() {
  Serial.begin(9600); // or the desired baud rate
}

void loop() {
  // Your other loop activities can go here

  // Check if there are data available in the serial buffer
  if (Serial.available() > 0) {
    // Read data incrementally without blocking the loop
    while (Serial.available() > 0) {
      char c = Serial.read();
      // Process the read character as needed
      // Here, you might store the data in an array or process it in some way
    }

    // Add additional activities after reading the data here
  }

  // Your other loop activities can go here
}

This code uses Serial.available() to check if there is data available in the serial buffer. If data is available, it enters a loop to read the data incrementally without blocking the loop() function.

rebduilding the whole string will need to be done after no data is reveived for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants