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

Modbus integration is really slow with 33 climate modbus entities and scan_interval set below 60 seconds #117684

Closed
rjulius23 opened this issue May 18, 2024 · 4 comments
Assignees

Comments

@rjulius23
Copy link
Contributor

The problem

I have a set up where I have 33 climate entities via modbus TCP. I have noticed the following:

  • The entities load perfectly i can see all the values (target/current temp, mode, fan_mode). However If I switch the mode or the fan_mode or the temperature, it would take between 20-50 seconds for the change show up on the physical device.
  • If I increase the scan_interval for the climate entities to 90 seconds, then it becomes crispier and the write_register actions turn around time from the HA UI will be around 4-6 sec not, ideal but much better.
  • I took tcpdumps as I was thinking the issue is in the network, but in the traces it is clear that the response time of the modbus server is within 500 ms.
  • The delay is E2E so from clicking on the GUI till seeing the change on the device.
  • If I send the write bypassing the HA using mbpoll then the change is instant.
  • I have enabled pymodbus debug logging, and what I see there is when the Write transaction added it goes to Transaction complete state within 500 ms. This suggests that the slowness is coming from Home Assistant itself, so when I press anything on the UI it goes to some queue, and it goes to the pymodbus later. Could it be because of the 33 entities holding a lot of syncworkers ?
  • Would it help If I split the entities between more HA instances ?

What version of Home Assistant Core has the issue?

core-2024.1.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Modbus

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/

Diagnostics information

No response

Example YAML snippet

modbus:
  - name: modbusHub
    type: tcp
    host: 10.118.91.192
    port: 22
    climates:
      - name: dh_118_201_fancoil_climate
        device_address: 2
        scan_interval: 90
        address: 1209
        data_type: int16
        max_temp: 30
        min_temp: 18
        offset: 0
        precision: 1
        scale: 0.1
        target_temp_register: 1208
        temp_step: 1
        temperature_unit: C
        hvac_onoff_register: 1202
        hvac_mode_register:
          address: 1203
          values:
            state_auto: 0
            state_cool: 1
            state_dry: 2
            state_fan_only: 3
            state_heat: 4
        fan_mode_register:
          address: 1204
          values:
            state_fan_auto: 0
            state_fan_low: 1
            state_fan_middle: 2
            state_fan_high: 3

Anything in the logs that might be useful for us?

2024-05-18 08:46:06.245 DEBUG (SyncWorker_4) [pymodbus.logging] Running transaction 1747
2024-05-18 08:46:06.245 DEBUG (SyncWorker_4) [pymodbus.logging] SEND: 0x6 0xd3 0x0 0x0 0x0 0x6 0x4 0x6 0x2 0x5b 0x0 0x4
2024-05-18 08:46:06.245 DEBUG (SyncWorker_4) [pymodbus.logging] New Transaction state "SENDING"
2024-05-18 08:46:06.245 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "SENDING" to "WAITING FOR REPLY"
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "WAITING FOR REPLY" to "PROCESSING REPLY"
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] RECV: 0x6 0xd3 0x0 0x0 0x0 0x6 0x4 0x6 0x2 0x5b 0x0 0x4
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Processing: 0x6 0xd3 0x0 0x0 0x0 0x6 0x4 0x6 0x2 0x5b 0x0 0x4
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Factory Response[WriteSingleRegisterResponse': 6]
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Adding transaction 1747
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Getting transaction 1747
2024-05-18 08:46:06.532 DEBUG (SyncWorker_4) [pymodbus.logging] Changing transaction state from "PROCESSING REPLY" to "TRANSACTION_COMPLETE"
2024-05-18 08:46:06.533 DEBUG (SyncWorker_55) [pymodbus.logging] Current transaction state - TRANSACTION_COMPLETE

Additional information

No response

@home-assistant
Copy link

Hey there @janiversen, mind taking a look at this issue as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of modbus can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign modbus Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


modbus documentation
modbus source
(message by IssueLinks)

@PeteRager
Copy link
Contributor

My guess is you need a faster computer or more RAM. What are you running it on?

@janiversen
Copy link
Member

A faster cpu is not needed for that small amount of data !

Please add a debug log as pr modbus documentation, so we can see what happens, I suspect the setting is written fast to your device, but the verify read only happens at scan interval.

You are using 2024.1.5 please update to newest ha version, as there have been many changes in modbus and we do not solve bugs in old versions.

@janiversen
Copy link
Member

Closing due to missing information.

@janiversen janiversen reopened this May 30, 2024
@janiversen janiversen closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants