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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modbus patch, to allow communication with "slow" equipment using tcp #32557
Commits on Mar 26, 2020
-
modbus: bumb pymodbus version to 2.3.0
pymodbus version 1.5.2 did not support asyncio, and in general the async handling have been improved a lot in version 2.3.0. updated core/requirement*txt
Configuration menu - View commit details
-
Copy full SHA for 715524c - Browse repository at this point
Copy the full SHA 715524cView commit details -
committing result of 'python3 -m script.hassfest'.
Configuration menu - View commit details
-
Copy full SHA for eb98d16 - Browse repository at this point
Copy the full SHA eb98d16View commit details -
modbus: change core connection to async
change setup() --> async_setup and update() --> async_update() Use async_setup_platform() to complete the async connection to core. listen for EVENT_HOMEASSISTANT_START happens in async_setup() so it needs to be async_listen. But listen for EVENT_HOMEASSISTANT_STOP happens in start_modbus() which is a sync. function so it continues to be listen().
Configuration menu - View commit details
-
Copy full SHA for 8813e44 - Browse repository at this point
Copy the full SHA 8813e44View commit details -
modbus: move setup of pymodbus into modbushub
setup of pymodbus is logically connected to the class modbushub, therefore move it into the class. Delay construction of pymodbus client until event EVENT_HOMEASSISTANT_START arrives.
Configuration menu - View commit details
-
Copy full SHA for eb1b1fb - Browse repository at this point
Copy the full SHA eb1b1fbView commit details -
modbus: use pymodbus async library
convert pymodbus calls to refer to the async library. Remark: connect() is no longer needed, it is done when constructing the client. There are also automatic reconnect.
Configuration menu - View commit details
-
Copy full SHA for 8c06336 - Browse repository at this point
Copy the full SHA 8c06336View commit details -
modbus: use async update for read/write
Use async functions for read/write from pymodbus. change thread.Lock() to asyncio.Lock()
Configuration menu - View commit details
-
Copy full SHA for 5a4de07 - Browse repository at this point
Copy the full SHA 5a4de07View commit details -
Modbus: patch for slow tcp equipment
When connecting, via Modbus-TCP, so some equipment (like the huawei sun2000 inverter), they need time to prepare the protocol. Solution is to add a asyncio.sleep(x) after the connect() and before sending the first message. Add optional parameter "delay" to Modbus configuration. Default is 0, which means do not execute asyncio.sleep().
Configuration menu - View commit details
-
Copy full SHA for 09012c9 - Browse repository at this point
Copy the full SHA 09012c9View commit details -
Modbus: silence pylint false positive
pylint does not accept that a class construction __new__ can return a tuple.
Configuration menu - View commit details
-
Copy full SHA for 37b4b03 - Browse repository at this point
Copy the full SHA 37b4b03View commit details -
Modbus: move constants to const.py
Create const.py with constants only used in the modbus integration. Duplicate entries are removed, but NOT any entry that would lead to a configuration change. Some entries were the same but with different names, in this case renaming is done. Also correct the tests.
Configuration menu - View commit details
-
Copy full SHA for b5b414c - Browse repository at this point
Copy the full SHA b5b414cView commit details -
Modbus: move connection error handling to ModbusHub
Connection error handling depends on the hub, not the entity, therefore it is logical to have the handling in ModbusHub. All pymodbus call are added to 2 generic functions (read/write) in order not to duplicate the error handling code. Added property "available" to signal if the hub is connected.
Configuration menu - View commit details
-
Copy full SHA for 09fd688 - Browse repository at this point
Copy the full SHA 09fd688View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0744ad4 - Browse repository at this point
Copy the full SHA 0744ad4View commit details -
Modbus: remove close of client
close() no longer exist in the pymodbus library, use del client instead.
Configuration menu - View commit details
-
Copy full SHA for 75352e4 - Browse repository at this point
Copy the full SHA 75352e4View commit details
Commits on Mar 27, 2020
-
Modbus: correct review comments
Adjust code based on review comments.
Configuration menu - View commit details
-
Copy full SHA for 4b1c64f - Browse repository at this point
Copy the full SHA 4b1c64fView commit details
Commits on Mar 28, 2020
-
Modbus: remove twister dependency
Pymodbus in asyncio mode do not use twister but still throws a warning if twister is not installed, this warning goes into homeassistant.log and can thus cause confusion among users. However installing twister just to avoid the warning is not the best solution, therefore removing dependency on twister.
Configuration menu - View commit details
-
Copy full SHA for 97f21bf - Browse repository at this point
Copy the full SHA 97f21bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for fae9023 - Browse repository at this point
Copy the full SHA fae9023View commit details