# \[APP\]\[Pro\] Modbus - Connect every Modbus devices

**URL:** <https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497>\
**Category:** Apps\
**Tags:** app, homey-pro, advancedflow\
**Created:** [February 20, 2024, 7:13pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497 "2024-02-20T19:13:05Z")\
**Posts on this page:** 20\
**Page:** 11

<div class="post-metadata">

**Author:** ![CaptainVoni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/captainvoni/32/3549_2.png) [@CaptainVoni](https://community.homey.app/u/CaptainVoni)\
**Post date:** [April 3, 2024, 6:49am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/201 "2024-04-03T06:49:55Z")

</div>

@RonnyW Yes, writing is actually working now! Many thanks!

Two observations:

- One has to provide the size of 2 when writing, otherwise a Modbus error occurs. I was under the impression that size is ignored for anything but string, but this obviously isn’t the case here.
- When writing in test mode, the bytes returned are not in the order that they are actually written, e.g. when writing -2500 in test mode with INT32-LE (16-bit Word LE) the bytes FF FF F6 3C are returned instead of F6 3C FF FF.

And one more thing: I don’t think that INT32-LE (16-bit Word LE) is a good term here:

- The individual registers itself are in Big Endian, not Little Endian.
- I wouldn’t use LE for the ordering of the registers, as this might be confusing. Maybe something like “INT32 (reverse register order)” might be more intuitive?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 5:23pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/202 "2024-04-03T17:23:36Z")

</div>

> [@CaptainVoni](#):
>
> One has to provide the size of 2 when writing, otherwise a Modbus error occurs. I was under the impression that size is ignored for anything but string, but this obviously isn’t the case here.

The write card has no size input field. You can only select the type and the amount ob bytes is defined internally.

> [@CaptainVoni](#):
>
> when writing -2500 in test mode with INT32-LE (16-bit Word LE) the bytes FF FF F6 3C are returned instead of F6 3C FF FF.

I found the bug. The app first swaps the bytes and writes then. It must be in other order 🙂  
So the FF FF F6 3C are written. I wonder why you got the correct value reading again?  
I’ll provide a fix for that.

> [@CaptainVoni](#):
>
> I don’t think that INT32-LE (16-bit Word LE) is a good term here:

It’s LE, but only based on 16bit/2byte pairs instead of single bytes.  
Example (BE):  
11 22 33 44 55 66 77 88  
LE:  
88 77 66 55 44 33 22 11  
16bit-LE:  
77 88 55 66 33 44 11 22

You see, it’s LE over all, but some Modbus manufacturer are reading the 16bit registers as single 16bit element these elements are placed in LE order. Only for 32bit it looks as just the registers are switched.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 5:38pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/203 "2024-04-03T17:38:45Z")

</div>

New **test version 0.7.2** :

- Fixed (U)INT-LE 16bit for write register flow card

@CaptainVoni FYI

---

<div class="post-metadata">

**Author:** ![CaptainVoni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/captainvoni/32/3549_2.png) [@CaptainVoni](https://community.homey.app/u/CaptainVoni)\
**Post date:** [April 3, 2024, 6:21pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/204 "2024-04-03T18:21:43Z")

</div>

> [@RonnyW](#):
>
> The write card has no size input field. You can only select the type and the amount ob bytes is defined internally.

Sorry, I meant to write “One has to provide the size of 2 when **reading** ”. When I provide the type INT32, why should it need the size?

> [@RonnyW](#):
>
> I found the bug. The app first swaps the bytes and writes then. It must be in other order 🙂  
> So the FF FF F6 3C are written. I wonder why you got the correct value reading again?  
> I’ll provide a fix for that.

I’m a little afraid that this fix will break it here, but I’ll try. 😉

---

<div class="post-metadata">

**Author:** ![CaptainVoni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/captainvoni/32/3549_2.png) [@CaptainVoni](https://community.homey.app/u/CaptainVoni)\
**Post date:** [April 3, 2024, 6:38pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/205 "2024-04-03T18:38:04Z")

</div>

> [@CaptainVoni](#):
>
> I’m a little afraid that this fix will break it here, but I’ll try. 😉

This 👆 exactly. It’s now broken again. It displays now the bytes in the correct order when using “test mode”, but writing is completely screwed up. If I want to write -1000 (FF FF FC 18, which should be written as FC 18 FF FF if “INT32-LE (16-bit Word LE)” is used), I now have to write -65470465 (FC 18 FF FF).

Reading still works!

---

<div class="post-metadata">

**Author:** ![Antohagg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/antohagg/32/48013_2.png) [@Antohagg](https://community.homey.app/u/Antohagg)\
**Post date:** [April 3, 2024, 6:41pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/206 "2024-04-03T18:41:20Z")

</div>

Actually I found out that my charger uses Modbus ascii and I can comunicate with the charger wireless via the Elfin-11 from my laptop. But as far as i can see, this app only support Modbus RTU, so need to ask @RonnyW if he could implement support for ascii (just sending a RAW message as a string). 😊

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 7:16pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/207 "2024-04-03T19:16:13Z")

</div>

Strange. That would mean the device exports registers as LE, but writes as BE and internally converts to LE 🤔

The app is writing now in the same way how the registers are read.  
So I think I will keep it as it is for now. But in your case, writing as INT32 should work, too, because it’s using the unswapped bytes.

Perhaps @Edwin_Biemond has used such 16bit LE values for writing in his app?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 7:21pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/208 "2024-04-03T19:21:32Z")

</div>

New **test version 0.7.3** :

- Fixed type based size in read register flow card.

@CaptainVoni Size is fixed now. It’s only needed for dynmaic size values like String and Byte.

---

<div class="post-metadata">

**Author:** ![CaptainVoni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/captainvoni/32/3549_2.png) [@CaptainVoni](https://community.homey.app/u/CaptainVoni)\
**Post date:** [April 3, 2024, 7:22pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/209 "2024-04-03T19:22:29Z")

</div>

> [@RonnyW](#):
>
> But in your case, writing as INT32 should work, too, because it’s using the unswapped bytes.

Correct. For reading I now have to use “INT32-LE (16-bit Word LE)” with size 2 (size 1 returns an error), and for writing I have to use INT32. Very strange.

---

<div class="post-metadata">

**Author:** ![CaptainVoni](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/captainvoni/32/3549_2.png) [@CaptainVoni](https://community.homey.app/u/CaptainVoni)\
**Post date:** [April 3, 2024, 7:24pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/210 "2024-04-03T19:24:15Z")

</div>

> [@RonnyW](#):
>
> @CaptainVoni Size is fixed now. It’s only needed for dynmaic size values like String and Byte.

Fixed it - now reading also works without size. Thanks!

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 7:40pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/211 "2024-04-03T19:40:04Z")

</div>

> [@Antohagg](#):
>
> support for ascii (just sending a RAW message as a string)

Is the “Elfin” a LAN/TCP dongle and supports Modbus TCP?  
Then you can use this app. Try to read a register with type STRING. I’m curious to see if this works

---

<div class="post-metadata">

**Author:** ![Antohagg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/antohagg/32/48013_2.png) [@Antohagg](https://community.homey.app/u/Antohagg)\
**Post date:** [April 3, 2024, 8:42pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/212 "2024-04-03T20:42:07Z")

</div>

Thats correct, the Elfin device just passes the information it gets over wifi over to the modbus device and passes the reply back.  
Not sure what I should use as the adress and size. The message Looks like this `!0 01` and The reply is `>0 01 v6.0`. More info regarding the commands is here: [https://www.hjemmeautomasjon.no/applications/core/interface/file/attachment.php?id=5817](https://www.hjemmeautomasjon.no/applications/core/interface/file/attachment.php?id=5817)

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 3, 2024, 9:09pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/213 "2024-04-03T21:09:03Z")

</div>

The app (and used NodeJS module) only supports Modbus TCP, not ASCII.

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 4, 2024, 4:42pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/214 "2024-04-04T16:42:36Z")

</div>

I can’t access the URL.  
Can you configure the dongle to use ModbusTCP on LAN and ASCII on serial side?

---

<div class="post-metadata">

**Author:** ![Peter\_Bittner](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_bittner/32/16698_2.png) [@Peter\_Bittner](https://community.homey.app/u/Peter_Bittner)\
**Post date:** [April 10, 2024, 7:07am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/215 "2024-04-10T07:07:52Z")

</div>

Ronny - I see you updated Modbus recently. The flowcards I set up previously now have a Mode entry - Test or Live.  
Do I need to go and set all these to live?  
 ![Screenshot 2024-04-10 at 5.07.35 PM](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/1/a195c001ff0ec0eb25f6381da661df1ed014c26e.png)

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 10, 2024, 7:48am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/216 "2024-04-10T07:48:41Z")

</div>

No, not needed to change this. “Live” is default - see flow card hint (question mark). The test mode is to check the resulting bytes that would be written based on type conversion.

---

<div class="post-metadata">

**Author:** ![Franz\_K](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/franz_k/32/83505_2.png) [@Franz\_K](https://community.homey.app/u/Franz_K)\
**Post date:** [April 15, 2024, 1:12pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/217 "2024-04-15T13:12:11Z")

</div>

I have used the IP and Port 502 to connect homey to my device but it will not connect. Homey write connect EALREADY and my IPs. If I use a modbus Software to check homey it seems that homey is not reachable as if the port is blocked. Do I have to do somenting in the settings in homey?

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 15, 2024, 1:47pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/218 "2024-04-15T13:47:11Z")

</div>

Hi,  
you inserted the IP/port of your Modbus device?  
And this device is configured to use Modbus/TCP?

You can’t reach Homey on this port. Homey connects to the target device and uses a random  
outgoing port.  
Perhaps the target device doesn’t disconnect. You cna try to restart the app in Homey and try again.

---

<div class="post-metadata">

**Author:** ![freki](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/freki/32/7111_2.png) [@freki](https://community.homey.app/u/freki)\
**Post date:** [April 17, 2024, 7:33am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/219 "2024-04-17T07:33:31Z")

</div>

Hi,

Thanks for your effort with this very long awaited app Ronny! Great!

I’m using the app for Modbus TCP and it works very well!

But I’m also trying to connect to units using Modbus RTU, with a 8-bit protocol. (For this I’m using a TCP/RTU converter.)

I manage to read data but cannot write.  
My guess is that I need a possibility to read/write using Int8/Uint8-formats as well.  
Would it be possible to implement this as well? 🙏

Thanks in advance!

BR, Fredrik

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [April 17, 2024, 3:16pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/220 "2024-04-17T15:16:49Z")

</div>

Hi,  
Modbus TCP uses 16bit registers.  
Are you sure, your device uses 8bit registers? What values are you trying to write? Also 8bit or 16bit (2x8bit like writing a 32bit INT into 2 registers on Modbus TCP)?  
I think a TCP/RTU converter should convert the 16bit TCP register in 2 8bit values. But I don’t know any RTU details.

What data type are you using to read an 8bit register? One of the little endian types to get filled the first of the two bytes?

[Previous page](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497.md?page=10)

[Next page](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497.md?page=12)
