#Description
Plugin for reading and writing on your ModbusTCP/IP and RTU devices Not compatible Wago al current time
After downloading the plugin, you must first activate it, like any Jeedom plugin :
Then, you have to start the installation of the dependencies (even if they appear OK) :
Finally, start the daemon :
Rien n’est à modifier dans le champ « Port socket interne » de la section « Configuration ».
In this same tab, you must choose the rest value between updating your equipment (by default 5 sec)
You can also choose to put a Retry to re-execute the request on a command/equipment that would be in error (by default False) You can also choose the number of attempts and the delay between these attempts.
:warning: Modbus library Log Level choice :
By default, it is configured to ERROR, the library being verbose You can change its level : you will need to save and restart the daemon
IMPORTANT :
To use the plugin, you need to know the parameters of your inputs / outputs of your modbus peripherals (data format, bit order, etc…)
For commands, there are parameters to select :
Parameter details :
IMPORTANT :
Given the time spent having to sometimes configure certain equipment, it is possible to export the commands of an equipment already created, to download it locally in .json.
You can therefore import it either on another box easily on a new equipment of the same type (just to change what differs in terms of its connection)
On the equipment page, at the bottom right, you have this insert :
Click on List of orders to export; a window opens with the existing commands on this equipment:
You can select them all if necessary using the button at the top of the window. When the commands are chosen, click on Validate.
You will now see the orders chosen and ready to be exported in this box :
You just have to click on Download Config of the orders which has just appeared.
To import commands to equipment : click at the top right of the equipment on the Import Json button :
You can also choose directly an equipment model available in the configuration of the plugin, to load commands provided in this model; Choose the chosen model, then Validate. Then you can Save.
MODBUS DETAILS :
The size of a Modbus register is 2bytes (2 bytes), i.e. 16bits
PLAYBACK CONTROLS :
For Coils inputs :
For Fc2 Read Discrete :
When you return from reading, you will have a string type command with the value of the requested bits
For Holdings Registers and Inputs Registers:
Some registers can only be read by reading several registers at the same time on the same command :
example : We create a command, choose Info and other subtype, specifying 10 registers; See Specific Parameters at the end of the documentation
WRITE COMMANDS:
On your equipment, by default there will be 3 Action/message type commands created; MultiRegister Write, Bit Write and Multicoil Write
IMPORTANT :
Their principle of operation:
:warning: NEW ONE-BIT WRITING METHOD :
To change a specific bit on a register : you can create an Action type command, and choose the Code Function ‘Write Bit’. This will only show you the 2 fields to fill out : Starting register and bit position. When saving, this will create 2 action commands : one to send 0, and one to send 1, and this will delete the one you have configured. The two new commands will have their type name :
WriteBit_Register(RegisterNum)_Position(BitPosition)_1 and WriteBit_Register(RegisterNum)_Position(BitPosition)_0
CHANGE OF BITS OF A REGISTER (Old method):
To change the bit of a register, you must use the message WriteBit command; in the configuration of the command, in the Start register field, you must choose the number of the register to write. No other configuration needed Then, on the message body of the command on the dashboard, you must use the following syntax : bitValue&indexbit Possible bit value 0 or 1 indexBit is the value between 0 and 15 (values included) Please refer to the documentation of your equipment for the index of the bit to change
NEW WRITE ON SEVERAL REGISTERS TO A REQUEST:
- By creating an Action -> Other subtype command, then choosing Fc16, and filling in the Start Register and the new Register Table line in the Command Parameters, we can execute this command to write from the start register the entered values :
Ex : Start Register : 10
Line Table Register : 10-45-22-25.6-2360
We will send on registers 10,11,12,13 and 14, the values 10,45,22,22.6 and 2360
Values must be separated by a - , and for decimal numbers, put a .
To change the values on the registers, use this syntax:
For float types, write the value as above, with a .
MultiCoil Writing : in the configuration of the command, you must enter the starting register By default, the functionCode is fc15. Please leave this configuration as default.
To change the values on the registers, use this syntax: Ex : 01110111 So this will send from the configured starting register the values True(1) or False(0) to the registers
Write Bit : in the command configuration, you need the order of bytes and word. By default, the functionCode is fc03, because this command will give the value of the register set in binary to the command info “infobitbinary”.
Please leave this configuration as default.
On the info “infobitbinary” command, you will have the binary value of the parameter register at the Write Bit command. To change the bit on the register :
valuetosend&PositionBit&Register : Ex: 1&4 We send the value 1 to the bit in position 4 from the right, to the specified register
On the info command "infobitbinary", you see the value 10000101, which corresponds to the binary value of the parameter register.
By writing 1&6, you will now have the value : 10100101 on the configured register.
IMPORTANT :
Some PLCs do not have the fc06 function See Specific Parameters at the end of the documentation
To write on a Coil :
Example for register 1 On:
Example for register 1 Off:
By acting on these action commands on your dashboard, you will therefore send True or False to your Coils.
To Write to a Holding Register :
When a write is done, whether it succeeds or not, a message appears on Jeedom. You can disable/enable this message from the plugin configuration.
HEX RETURN : To have a command that returns the value of the register in HexaDecimal (for a command that reports the errors of an equipment for example), you create your command, configure it as usual, and tick Return Hexa.
This will create a new command on return that will have the name of the original command, followed by _HEXAVALUE
MULTI-REGISTER READING : by checking LectureMultiRegistres, this will automatically create as many new commands as the number specified in Number of registers, using the name of the original command, plus the id of the command in iteration. You can of course rename the commands; when reading the original command, its value will contain a character string of the 10 register values, and will update the 10 corresponding commands.
Fc16 UNTRACKED REGISTERS : Some PLCs do not have the fc06 function You can create an Action command, under Message type, and choose fc16 Check Fc16 Register Not Tracked In the dashboard, you must use this syntax : departure register ! value & nbregisters separated by a |
Ex: 7!122.5&2 | 10!22&2 |
We will write from register 7, the value 122.5 on 2 registers and also from register 10, the value 22, on 2 registers
OPERATION ON ORDER : For an operation on the return of value : in the Operation field on the order, you can fill in a mathematical operation by putting the tag #value# to indicate the value of this command : example : (#value# / 10 ) * 2 The calculation will be performed on the return of data from this command. Make good use of * for multiplications
Read Register Bits : By choosing this on an Info command, this will create an info type command, representing the 16 bits of this register; this new command is created when the values are reported for the first time, and is then updated with each new report.
After the creation of an equipment, you can import an xlsx file for the creation of your orders The template file can be found in plugins/modbus/data/templateXlsx/exportModbus.xls You can access it and download it via your Jeedom -> Settings-> System-> File editor