Changes

m
testing added
Line 66: Line 66:  
{| class="wikitable"
 
{| class="wikitable"
 
|1.  Format version
 
|1.  Format version
|0
+
|'''0'''
 
|-
 
|-
 
|2. Cookie
 
|2. Cookie
Line 72: Line 72:  
|-
 
|-
 
|3. IP Type
 
|3. IP Type
|0 - IPv4; 1 - IPv6; 2 - hostname
+
|'''0''' - IPv4; '''1''' - IPv6; '''2''' - hostname
 
|-
 
|-
 
|4. IP
 
|4. IP
|IPv6 must be in full format (for example: 2001:0db8:0000:0000:0000:8a2e:0370:7334)
+
|IPv6 must be in full format (for example: '''2001:0db8:0000:0000:0000:8a2e:0370:7334''')
 
|-
 
|-
 
|5. Port
 
|5. Port
|Port number (for example: 502)
+
|Port number (for example: '''502''')
 
|-
 
|-
 
|6. Timeout in seconds (time to wait for response)
 
|6. Timeout in seconds (time to wait for response)
|from 1 to 999
+
|from '''1''' to '''999'''
 
|-
 
|-
 
|7. Slave ID - Indicates to which slave request is sent
 
|7. Slave ID - Indicates to which slave request is sent
|from 1 to 255
+
|from '''1''' to '''255'''
 
|-
 
|-
 
|8. Function
 
|8. Function
|3 - read registers; 6 - write single register; 16 - write multiple registers
+
|'''3''' - read registers; '''6''' - write single register; '''16''' - write multiple registers
 
|-
 
|-
 
|9. Number of first register from which information will be read or written
 
|9. Number of first register from which information will be read or written
|from 1 to 65535
+
|from '''1''' to '''65535'''
 
|-
 
|-
 
|10. Registry value
 
|10. Registry value
|If function is 3 - from 1 to 123 (first register + registry value can not go out of range);  
+
|If function is 3 - from '''1''' to '''123''' (first register + registry value can not go out of range);  
If function is 6 - from 0 to 65535
+
If function is 6 - from '''0''' to '''65535'''
   −
If function is 16 - from 1 to 123 (first register + registry value can not go out of range), Registry values separated by commas without spaces. Example.: 1,2,3,654,21,789. There has to be as many values, as specified number of registers, and each value must be between 0 and 65535. If number of registries is 0, there should be no registry values
+
If function is 16 - from '''1''' to '''123''' (first register + registry value can not go out of range), Registry values separated by commas without spaces. Example.: '''1,2,3,654,21,789'''. There has to be as many values, as specified number of registers, and each value must be between '''0''' and '''65535'''. If number of registries is 0, there should be '''no registry values'''
 
|}
 
|}
 +
[[File:Networking MQTT modbus message format publisher v1.png|border]]
 +
 +
===Examples===
 +
{| class="wikitable"
 +
|Setting relay (on) (Relay address is 202, which means 'Number of first register will be 203)
 +
|'''0 65432 0 192.168.1.1 502 5 1 6 203 1'''
 +
|-
 +
|Getting uptime
 +
|'''0 65432 0 192.168.1.1 502 5 1 3 2 2'''
 +
|}
 +
 +
== Testing MQTT Publisher and Subscriber on flespi.io ==
 +
Login and navigate to MQTT Board on https://flespi.io
 +
 +
Add a subscriber:
 +
 +
# Press '''''<nowiki/>'+'''''' button on the top right corner
 +
# Select '''''<nowiki/>'Subscriber''''''
 +
# In the topic field enter '''''<nowiki/>'response''''''
 +
# Press '''''<nowiki/>'Subscribe'''''' button
 +
 +
[[File:Networking MQTT Modbus flespi subscriber config1 v1.png]]            [[File:Networking MQTT Modbus flespi subscriber config2 v1.png]]
 +
 +
 +
Add a Publisher:
 +
 +
# Press '''''<nowiki/>'+'''''' button on the top right corner
 +
# Select '''''<nowiki/>'Publisher''''''
 +
# In the topic field enter '''''<nowiki/>'request''''''
 +
# In the message field enter message, for this example 'Getting uptime' is used
 +
# Press '''''<nowiki/>'Publish'''''' button
 +
 +
[[File:Networking MQTT Modbus flespi publisher config1 v1.png|434x434px]]          [[File:Networking MQTT Modbus flespi publisher config2 v1.png|365x365px]]

Navigation menu