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

Component jk_modbus took a long time for an operation.... and cause esp to halt after sometime #122

Closed
paulsteigel opened this issue Apr 22, 2024 · 2 comments

Comments

@paulsteigel
Copy link

paulsteigel commented Apr 22, 2024

No description provided.

@syssi
Copy link
Owner

syssi commented Apr 22, 2024

Could you provide your complete YAML? I'm a bit confused because you mentioned CAN bus communication and a crash/reboot which isn't part of the log above.

The warning doesn't cause reboots normally.

@syssi syssi closed this as completed Apr 22, 2024
@paulsteigel
Copy link
Author

paulsteigel commented Apr 22, 2024

Hi @syssi
I am sorry for posting on the wrong area, I tried reposting on JK-BMS. But you are so responsive so, let me post it here for you to help!

external_components_source: github://syssi/esphome-jk-bms@main
 # components
 # github://syssi/esphome-jk-bms@main  
 
esphome:
 #includes: wifi_config.cpp
 name: ${name}
 on_boot:
   then:
     - switch.turn_on: switch_charging
     - switch.turn_on: switch_discharging
     - switch.turn_on: switch_chg_float
     
# +--------------------------------------+
# | ESP32 settings                       |
# +--------------------------------------+
# For a stable Bluetooth connection keep the "esp-idf" framework
esp32:
 board: lolin_s2_mini
#  board: esp32doit-devkit-v1
#  framework:
#    type: esp-idf

# for automatic updating new ip on changes
time:
 - platform: sntp
   # ...

external_components:
 - source: ${external_components_source}
   refresh: 0s
 - source: github://pr#5586
   components: [ ota_http ]

logger:
 level: DEBUG

packages:
 extrapkg: !include ./commons/dyndns.yaml


# Please use the native `api` component instead of the `mqtt` section.
# If you use Home Assistant, the native API is more lightweight.
# If there is no HA server connected to this API, the ESP32 reboots every 15 minutes to try to resolve the problem.
# If you don't use Home Assistant please uncomment the "reboot_timeout: 0s" option.
#api:
#  reboot_timeout: 0s

# If you don't want to use ESPHome's native API you can use MQQT instead.
# In this case don't forget to remove the 'api:' section.
mqtt:
 broker: myhome.sfdp.net.com
 username: mqtt_user
 password: abcxya
 client_id: ${name}_mqtt

# In the event of problems with the WiFi network, the ESP32 will reboot every 15 minutes to try to resolve the problem.
# If we don't want to connect the ESP32 to the WiFi network please remove the 4 lines below.

wifi:
 use_address: ${name}.freemyip.com
 ap:
   ssid: "ESP32S2Lolin"
#    password: !secret wifi_ap_password
   ap_timeout: 10min

captive_portal:

ota:
 password: abcxyz
 # Forward this TCP port to do OTA updates remotely
 port: 8266

<<: !include ./commons/ota_http.yaml

#web_server:
#  port: 80
#  log: false
#  ota: false

<<: !include ./commons/globals.yaml

output:
 - platform: gpio
   pin: 15
   id: led
   inverted: true

light:
 - platform: binary
   output: led
   id: blue_led
   name: "Blue LED"
   internal: true

# +--------------------------------------+
# | JK-BMS UART connection               |
# +--------------------------------------+

uart:
 id: uart_0
 baud_rate: 115200
 rx_buffer_size: 384
 tx_pin: ${tx_pin}
 rx_pin: ${rx_pin}
 debug:
   direction: BOTH

jk_modbus:
 id: modbus0
 uart_id: uart_0

jk_bms:
 id: bms0
 jk_modbus_id: modbus0
 update_interval:  2s
 # enable_fake_traffic: true

.....
# +--------------------------------------+
# | CAN bus script                       |
# +--------------------------------------+
canbus:
 - platform: esp32_can
   tx_pin: ${can_tx_pin}
   rx_pin: ${can_rx_pin}
   can_id: 4
   bit_rate: 500kbps
   on_frame:
   - can_id: 0x305 # Inverter ACK - SMA/LG/Pylon/Goodwe reply
     then:
       - light.toggle:
           id: blue_led
       - lambda: |-
           id(can_ack_counter) = 0;                              // Reset ACK counter
           id(can_status) = "ON";                                // Set CANBUS Status to ON
           id(canbus_status).publish_state(id(can_status));      // Publish text sensor
           ESP_LOGI("main", "received can id: 0x305 ACK");

interval:
 # activate the limits check
 #- interval: 60s
 #  then:
 #    - lambda: |-
 #        ESP_LOGI("main", "Trigger limit_check_script...");
 #        if (!id(limit_check_script).is_running()) id(limit_check_script).execute();          
       
 - interval: 120s
   then:
     - lambda: id(can_ack_counter) = 0;                          // Reset ACK counter for test inverter ACK
         
 - interval: 100ms
   then:
......

When i changed the update_interval to 2s, I saw the problem is link to MQTT also

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

No branches or pull requests

2 participants