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

pymodbus 1.5.0 #294

Merged
merged 36 commits into from
Apr 27, 2018
Merged

pymodbus 1.5.0 #294

merged 36 commits into from
Apr 27, 2018

Conversation

dhoomakethu
Copy link
Contributor

No description provided.

dhoomakethu and others added 30 commits October 26, 2017 11:15
Currently some of the asynchronous dependencies (pyasn1, pycrypto) are
listed under a 'twisted' extra, but twisted is not. This commit moves
twisted to the 'twisted' extra, so that `pip install pymodbus['twisted']
installs twisted and all async dependencies, and `pip install pymodbus`
installs only pyserial.
Add issue field specific to Modbus server /client used
…#242)

to see weather the thread in which the helpers are executed are the
Main thread or the spawned thread.

This infomation is passed to reactor.run() to the flag
installSignalHandlers. True is passed if the thread is a main
thread, else false.

This is done to prevent errors when running the helpers from a
spawned thread.
* New helper function to help stop Asynchronous server are being added.
Calling this helper function will kill the main thread

* #84: Removing redundant parameters to method _is_main_thread

* #84: Fixed loggers

* #84: Retaining one generic StopServer command that will cater to both TCP and Seriel Server

* #84 Add docuementation to StopServer helper function
* PYM-2:
- The issue listed was due to wrong messages being passed by the user.
Upon passing the right messages codes, the parser works as expected
on all counts.

- There is also changes that make the parser compatible with python2
and python3

- Verifier that the tool works on both python3 and python2 for all
MODBUS message codes on TCP, RTU, and BIN

* PYM-2: Checking the incoming framer. If te Framer is a Binary Framer,
we take the unit address as the second incoming bite as opposed
to the first bite.
This is was done while fixing the message parsers for binary messages

* PYM-2: Changed the modbus binary header size from 2 to 1.
According to the docs:
    Modbus Binary Frame Controller::

        [ Start ][Address ][ Function ][ Data ][ CRC ][ End ]
          1b        1b         1b         Nb     2b     1b

* PYM-3: Script is now compatible with both python2 and python3

* WIP

* PYM-2: Added a new switch: -t --transaction
This switch is meant to be used when we wish to parse messages directly
from the logs of Modbus.
The format of a message as shown in the logs is like bellow:
        0x7b 0x1 0x5 0x0 0x0 0xff 0x0 0x8c 0x3a 0x7d
We can pass this as the message to the parser along with the -t witch
to convert it into a compatible message to be parsed.
EG:

(modbus3) [~/pymodbus/examples/contrib]$ ./message-parser.py -b -t -p binary -m "0x7b 0x1 0x5 0x0 0x0 0xff 0x0 0x8c 0x3a 0x7d"
================================================================================
Decoding Message b'7b01050000ff008c3a7d'
================================================================================
ServerDecoder
--------------------------------------------------------------------------------
name            = WriteSingleCoilRequest
transaction_id  = 0x0
protocol_id     = 0x0
unit_id         =
                . [1]
skip_encode     = 0x0
check           = 0x0
address         = 0x0
value           = 0x1
documentation   =
    This function code is used to write a single output to either ON or OFF
    in a remote device.

    The requested ON/OFF state is specified by a constant in the request
    data field. A value of FF 00 hex requests the output to be ON. A value
    of 00 00 requests it to be OFF. All other values are illegal and will
    not affect the output.

    The Request PDU specifies the address of the coil to be forced. Coils
    are addressed starting at zero. Therefore coil numbered 1 is addressed
    as 0. The requested ON/OFF state is specified by a constant in the Coil
    Value field. A value of 0XFF00 requests the coil to be ON. A value of
    0X0000 requests the coil to be off. All other values are illegal and
    will not affect the coil.

ClientDecoder
--------------------------------------------------------------------------------
name            = WriteSingleCoilResponse
transaction_id  = 0x0
protocol_id     = 0x0
unit_id         =
                . [1]
skip_encode     = 0x0
check           = 0x0
address         = 0x0
value           = 0x1
documentation   =
    The normal response is an echo of the request, returned after the coil
    state has been written.

* PYM-2: Removing additional dependancy and making use of existing porting tools

* PYM-3: Removing additional dependancy and making use of existing porting tools

* Initial Bitbucket Pipelines configuration

* bitbucket-pipelines.yml edited online with Bitbucket

* bitbucket-pipelines.yml edited online with Bitbucket

* PYM-2: Updated the transaction tests for BinaryFramerTransaction.
The header for Binary trasaction is of size 1. This was recrtified
earlier commits of this branch.
The test ensure these changes

* PYM-6: Minor Cleanup task

Removing the argument handler in TCP Syncronous server.
This argument is not used any where.

* PYM-6:
ModbusUdpServer and ModbusTcpServer will now accept any legal
Modbus request handler. The request handler being passed will have
to be of instance ModbusBaseRequestHandler.

The default request handler is ModbusDisconnectedRequestHandler.
I.e., is no handler is passed, or if the handler is not of type
ModbusBaseRequestHandler, ModbusDisconnectedRequestHandler will
be made use of.

* PYM-6: Removing uneccessary check if handler is of type ModbusBaseRequestHandler

* PYM-8: Example that read from a database as a datastore

* PYM-8: Added two new datastores that can be used.
- SQLite3
- Reddis

* Small fixes

* Small fixes

* Small fixes

* Cleanup

* PYM-8: Updated the example to first write a random value at a random afddress to a database and then read from that address

* PYM-8: Added neccessary checks and methods to allow hassle free writes to database. The process first checks if the address and value are already present in the database before performing a write. This ensures that database transaction errors will now occur in cases where repetetive data is being written.

* Cleanup: Removing pdb placed during testing and other comments

* bitbucket-pipelines.yml deleted online with Bitbucket

* #240 Fix PR failures

* #240 fix Travis build failures

* #190 fix import error in dbstore-update-server example

* Small changes and typo fixed in pymodbus utilities and redis datastore helpers

* Added tests for redis datastore helpers

* Minor fixes to SQL datastore

* Unit tests for SQL datastore - 100% coverage

* Tests now compatible with python3 and python2
* Trying to fix #210
1. Using if __name__ == "__main__" clause in example to avoid running them while generating docs
2. Trying to enforce PEP-8 compliant code + PYTHON2-3 compatibale code with examples as much as possible
3. Renaming examples with "-" to "_" for the ease of documentation generation
4. Minor changes  with setup and setup commands
5. Support documentation creation from make file
6. Remove unnecessary html and pdf files from the doc folder

* Fix makefile

* Remove unwanted files and folders from doc folder

* Add seperated requirements for Docs and add .readthedocs.yml

* Update requirements for docs
Add more unit-tests
… and BinaryPayloadBuilder

2. #138 Updated tests and examples (#190)
3. #209 Bump version to 1.4.0
Fallback to socket.error on Python 2 when we catch TimeoutError.

Also, socket.timeout can still be raised on Python 3 with different
semantics than TimeoutError, so we catch it as well.

Fix #263.
Fix scraper simulator example
dhoomakethu and others added 6 commits April 26, 2018 18:39
*  Modbus sync client timing enhancements #221
 Fix TCP server #256, #260

* Fix #221 timing enhancements, #188 workarounds

* 1. #284 Async servers - Option to start reactor outside Start<server>Server function
2. #283 Fix BinaryPayloadDecoder/Builder issues when using with pymodbus server
3. #278 Fix issue with sync/async servers failing to handle requests with transaction id > 255
4. #221 Move timing and transcational logic to framers for sync clients
5. #221 More debug logs for sync clients
6. Misc updates with examples and minor enhancements

* 1. #277 MEI message reception issue with UDP client
2. Fix unit tests
3. Update changelog

* Patch 1 (#292)

* Fix #289 and other misc enhancements

* Replace nosetest with pytest

* Update Changelog

* serial sync client wait till timeout/some data is available in read buffer + update changelog

* serial sync client read updates when timeout is None and Zero

* fix sync client unit test and example
iter.next() was removed in python 3 so the code is broken on line 218.
This edit brings compatibility to python 3.
Successfully tested with Pythin 2.7.13 and 3.5.3
* easily to check for errors in stead of having to manually compare
response codes
@dhoomakethu dhoomakethu merged commit 8f3fc71 into master Apr 27, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants