-
Notifications
You must be signed in to change notification settings - Fork 2.2k
P183 modbus RTU #5390
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
base: mega
Are you sure you want to change the base?
P183 modbus RTU #5390
Changes from 79 commits
38c20bc
46f2a50
7d0e802
cc31b10
53ec930
a715544
5f8868a
aa34ac3
02f46b3
11cf754
e7aabda
1ee2b35
18e8b86
bd7661e
8c66411
fc27c88
8f5e5f9
a4dfca1
7795cc1
6e201fb
280e8bf
4515c8c
21b427e
8d5ce4d
5ba2f9f
b432092
c182cea
67134da
3495afe
abe1a67
e93b4c3
ef31d27
c322798
da1e31d
0098e3c
7e01a41
934b595
610c3e9
33e4439
6b774aa
7efc42d
68bba7f
2e2ab34
bb28e71
470d3c2
884deb3
c66aee9
79ffeb4
afa1b6a
0f9c1dd
d254ae4
9111e0d
30d2b12
115cb39
6f2cb43
e5583da
a2dc9e0
01985f9
c117ebd
298517c
c723180
8517192
90c3a19
305d41e
c8abfef
49e803b
67bdaf7
281d0e6
485c46b
a741bee
e7eac10
d68d88b
1af346c
41d11b5
3a873c5
e90a72f
afa7ca5
7b7649b
e831f0f
98effa0
814016c
eb3327d
a68f5eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| .. include:: ../Plugin/_plugin_substitutions_p18x.repl | ||
| .. _P183_page: | ||
|
|
||
| |P183_typename| | ||
| ================================================== | ||
|
|
||
| |P183_shortinfo| | ||
|
|
||
| Plugin details | ||
| -------------- | ||
|
|
||
| Type: |P183_type| | ||
|
|
||
| Port Type: |P183_porttype| | ||
|
|
||
| Name: |P183_name| | ||
|
|
||
| Status: |P183_status| | ||
|
|
||
| GitHub: |P183_github|_ | ||
|
|
||
| Maintainer: |P183_maintainer| | ||
|
|
||
| Used libraries: |P183_usedlibraries| | ||
|
|
||
| Introduction | ||
| ------------ | ||
|
|
||
| Modbus is a serial communication protocol commonly used for connecting industrial electronic devices. | ||
| It is a master/slave (or client/server) protocol, which means that one device (the master) initiates communication and the other devices (the slaves) respond. | ||
| Modbus RTU (Remote Terminal Unit) is a variant of the Modbus protocol that uses binary representation of data and is typically used over serial communication lines such as RS-485 or RS-232. | ||
| This plugin supports Modbus RTU communication over a serial interface. To support RS-485 communication, an external RS-485 to TTL converter is required. | ||
|
|
||
| Modbus RTU uses a register-based addressing scheme, where each device has a unique address and data is stored in registers. | ||
| Registers can be of different types, such as holding registers, input registers, coils, and discrete inputs. | ||
| This plugin supports reading holding registers (function code 03) and writing to holding registers (function code 06). | ||
|
|
||
| The plugin can be configured to read up to 4 holding registers from a Modbus slave device and store the values in user variables. | ||
| It can also write values to a specified holding register on the Modbus slave device. | ||
|
|
||
| The plugin can use a cache to store a limeted amount of consequitive register values. These registers are available through commands. | ||
|
|
||
| The plugin does not support any hardware specific features. Instead it is a generic plugin that can be used with any Modbus RTU compatible device. You have to lookup the correct register addresses and data formats in the documentation of the Modbus device you want to communicate with. | ||
| For more complex devices dedicated plugins may be available that support the specific device and its features. | ||
|
|
||
| Supported hardware | ||
| ------------------ | ||
|
|
||
| |P183_usedby| | ||
|
|
||
| Configuration | ||
| ------------- | ||
|
|
||
| * **Name**: Required by ESPEasy, must be unique among the list of available devices/tasks. | ||
|
|
||
| * **Enabled**: The device can be disabled or enabled. When not enabled the device should not use any resources. | ||
|
|
||
| Sensor | ||
| ^^^^^^ | ||
|
|
||
| .. image:: P183_device_settings.png | ||
|
|
||
| The available Modbus protocol settings here depend on the build used. | ||
|
|
||
| * **Modbus Link**: The Modbs link the device is connected to. The link must be configured in the Interfaces page. | ||
|
|
||
| * **Modbus Device Address**: The Modbus slave device ID to communicate with (1..247). | ||
|
|
||
| * **Cache size**: Number of holding registers that will be read into the cache. Set to zero to disable reading data into the cache. | ||
|
|
||
| * **Cache start address**: The address of the first holding register to be read into the cache. | ||
|
|
||
| Output Configuration | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| .. image:: P183_output_config.png | ||
|
|
||
| * **Number Output Values**: The number of output values to provide. Each value corresponds to a holding register the plugin will read (1..4). | ||
|
|
||
| * **Holding register for valueX**: The Modbus holding register address to read for valueX (X=1..4). | ||
|
|
||
| The holding register address is a 16-bit value (0..65535). This is the register address as specified with the Modbus device and is used directly in the Modbus read holding registers (function code 03). The plugin will read the number of values specified, starting with value1 | ||
|
|
||
| Commands available | ||
| ^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| .. include:: P183_commands.repl | ||
|
|
||
| .. Events | ||
| .. ~~~~~~ | ||
|
|
||
| .. .. include:: P183_events.repl | ||
|
|
||
| Get Config Values | ||
| ^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Get Config Values retrieves values or settings from the sensor or plugin, and can be used in Rules, Display plugins, Formula's etc. The square brackets **are** part of the variable. Replace ``<taskname>`` by the **Name** of the task. | ||
|
|
||
| .. include:: P183_config_values.repl | ||
|
|
||
| Modbus RTU facility | ||
| ------------------- | ||
|
|
||
| This plugin uses a Modbus facility that allows multiple Modbus devices to share the same Modbus link. | ||
| The serial link parameters are defined for each link, not for the device itself. The Modbus facility is configured on the interfaces page, Modbus tab. Multiple Modbus devices can be connected to the same Modbus link as long as they share the same link settings. | ||
| The modbus facility can support multiple Modbus links in parallel. Use the **Modbus link** setting to select the link to be used by this device. | ||
|
|
||
| The Modbus facility uses a queue to process Modbus requests one after another. The Modbus facilty will not block the plugin or other ESPEasy software while the queue is processed. It even allows to process multiple Modbus links in parallel without blocking each other. | ||
| This queueing implies that the plugin must cache the data read from the Modbus and that the values the plugin provides may be delayed. This P183 plugin reads the global cache once per second. Values are read through the Modbus from the device at the configured interval. | ||
| At that moment the plugin will stil present the value from its internal cache. Once the reply is received from the hardware then the plugin will update both the cache and the value. Note that the cache for the values is separate from the global holding register cache. | ||
| The holding register address for the values can be configured outside the cache range. | ||
|
|
||
| Change log | ||
| ---------- | ||
|
|
||
| .. versionchanged:: 2.0 | ||
| ... | ||
|
|
||
| |added| | ||
| Major overhaul for 2.0 release. | ||
|
|
||
| .. versionadded:: 1.0 | ||
| ... | ||
|
|
||
| |added| | ||
| Initial release version. | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| .. csv-table:: | ||
| :header: "Command", "Extra information" | ||
| :widths: 20, 30 | ||
|
|
||
| " | ||
| ``modbus,write,<address>,<value>`` | ||
|
|
||
| "," | ||
| Write value ``<value>`` into the holding register ``<address>``. | ||
| " | ||
| " | ||
| ``modbus,read,<address>`` | ||
|
|
||
| "," | ||
| Read the value from the holding register ``<address>``. The ``<address>`` shall be within the configured cache. Note that the value is read from the Modbus device but it will not be returned as part of the command. The value is printed in the logging. | ||
| " | ||
| " | ||
| ``modbus,scan`` | ||
|
|
||
| "," | ||
| Scans the modbus address range for responding units. It will do a read function for holding register 1. Note this will take some time. Ouput is in the logging. | ||
| " | ||
| " | ||
| ``modbus,dump,<start>,<end>`` | ||
|
|
||
| "," | ||
| Dumps the holding registers in the address range ``<start>`` until ``<end>``. The output is un the logging. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. It is mend for debugging. I don't know how I can provide a table for debugging purposes in another way. Or do you only intend to attend to the spelling mistake. By the way: I also don't know how I can best provide a holding register from the cache as result of a command. |
||
| " | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .. csv-table:: | ||
| :header: "Config value", "Information" | ||
| :widths: 20, 30 | ||
|
|
||
| " | ||
| | ``[<taskname>#register,<reg>]`` | ||
| "," | ||
| | Returns the value of holding register ``<reg>`` of the device. The value is read from the plugin cache. The holding register number ``<reg>`` shall be defined within the configured cache range. | ||
| Note: some custom build versions may allow reading outside the cache range at the cost of serious hiccups in ESPEasy software as it blocks all software while waiting for a response from teh Modbus device. | ||
|
flashmark marked this conversation as resolved.
Outdated
|
||
| " | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.