# \[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:** 3

<div class="post-metadata">

**Author:** ![Sasan\_Khandanpour](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sasan_khandanpour/32/79941_2.png) [@Sasan\_Khandanpour](https://community.homey.app/u/Sasan_Khandanpour)\
**Post date:** [March 2, 2024, 7:34am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/41 "2024-03-02T07:34:54Z")

</div>

I tried several things:

1. ID number 0 or ID number 16 does not work.
2. with ID 100 (thats the Huawei data dongle that seems to be the master because it sends all data to the network) I can only read the adresses designated to the dongle. There I can find the total input, batterie energy flow, grid power, total load. But unfortunately I can’t read out the SOC. And from that ID 100 I can’t read the adress for SOC designated for the Battery ID 2.
3. I tried if with the Modbus module ID 100 I could now install the underlying ID1 and 2. But again when I install a new module the modbus connection gets closed immediately. Maybe the modbus master doesn’t allow more than one connection at a time! SO maybe in a huawei modbus network, when a second Module wants to get the data, the other module must first close the connection!! What do you think, that might be the problem ? If you want I can give you permission to acces my homey to check in detail?

---

<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:** [March 2, 2024, 10:27am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/42 "2024-03-02T10:27:37Z")

</div>

My heat pump has quite a lot of writable S8 values:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/5/e595a7e52765a0bd98d61978796ac17ab7343dad.png)

But even S16 won’t work, as I tried to read register 18 (which worked and returned the correct value) and then write to register 18 the exact same value I just received:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/f/5fd59e42d60dfde4b3b6146eccc437e9be436cf8.png)

Anything I can do to help?

---

<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:** [March 2, 2024, 10:30am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/43 "2024-03-02T10:30:51Z")

</div>

It seems as if negative values fail, while positive work. How do you handle negative values to be written?

Furthermore, it also seems that I can only read holding registers (FC03), while I always receive a modbus error when trying to read input registers (FC04).

---

<div class="post-metadata">

**Author:** ![Sasan\_Khandanpour](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sasan_khandanpour/32/79941_2.png) [@Sasan\_Khandanpour](https://community.homey.app/u/Sasan_Khandanpour)\
**Post date:** [March 2, 2024, 2:27pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/44 "2024-03-02T14:27:22Z")

</div>

@RonnyW in my opinion you created one of the most important apps on homey. So many people need your app to manage their transition to a carbon free world. With your app I was able to save 10 kW sollst Energy in one cloudy winter day. I could charge my car and heat my home with solar electricity. Thanks a lot for your contribution. There are so many different products and companies who use Modbus in so many different ways. So keep up adjusting the app, so that it fits to different manufacturers. I will let my sister company Svea Check If they maybe limited the amounts of connections on the Modbus interface, as reason why I can’t use to different IDs. But a second flow card where we could temporarily change id number and before and after using that flow closing and reopening the Modbus connection would be grate.  
And furthermore you made that wonderful and perfect Tesla app as well. Homey wouldn’t be as useful as it is without your contribution. Thanks so much. I did a small donation to you. Maybe all others could do the same? One question: do you get money from athom for your work? It must have been many hours and days of work to create these apps.

---

<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:** [March 2, 2024, 8:00pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/45 "2024-03-02T20:00:51Z")

</div>

Many thanks for your response and your donation.  
This app was just a prototype to try the possibilities to control my Fronius devices. But it’s nice that others can benefit.

And no, I don’t get something from Athom. It’s only from and for the community 🙂

But all apps I created are done for myself in first place and only then offered to everyone.  
The reason is that I my opinion it’s the best to make app that are used by yourself. So it’s easier to test and find good solutions to tweak the apps.

And for modbus I was thinking about an option to connect only for a flow card option. So it could be possible to have two devices where only one is connected only for the register access.  
I have to check what’s possible with the uses NodeJS modules…

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 3, 2024, 10:21pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/46 "2024-03-03T22:21:15Z")

</div>

Thank you for this app! I am currently trying to read out the Sungrow Modbus information. I am connected to the LAN port and it is reading data, but the values don’t seem to be correct, e.g. the register 13001 should show the Daily PV Generation (31.5) but just shows 3. Does anyone have any experience with this? I’m not using the Winet-Wifi-Dongle for this, just the LAN-Port on the back.

 ![Bildschirmfoto 2024-03-03 um 23.20.05](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/3/936eb6e1e163c5d3e2a18bcf32fa602f97e9a7f5.png)

A list of access registers and data types can be found here:

> <https://gist.github.com/dnoegel/6ac76fdbd3dd4e2425162207508cbd53>

and here:  
[Sungrow Wechselrichter mit Modbus in Iobroker in Echtzeit auslesen - noegel.io](https://noegel.io/posts/2022-10-09-sungrow/) (German)

When trying with software i get the right values when switching from register to io register. The pv Generation (31.5) in register 13001 is the value 315, see screenshots.

 ![IMG_0020](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/8/98b2638e5eb0d9e5454e127fdf661edd0ce99159.png)  
 ![IMG_0021](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/4/54d1947f478dbd7e7cfc9af4446053040312c2d1.png)

Is there an option to read it this way?

---

<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:** [March 4, 2024, 5:52am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/47 "2024-03-04T05:52:37Z")

</div>

Do you have more information about the difference between ‘registers’ and ‘io registers’?

---

<div class="post-metadata">

**Author:** ![Sasan\_Khandanpour](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sasan_khandanpour/32/79941_2.png) [@Sasan\_Khandanpour](https://community.homey.app/u/Sasan_Khandanpour)\
**Post date:** [March 4, 2024, 8:18am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/48 "2024-03-04T08:18:33Z")

</div>

Update: many inverter companies restrict the number of clients connecting to the Modbus interface. Huawei makes it depending on the inverter model. My inverters are restricted to 2 connections. But I don’t know of one client is already reserved for the communication Between the components. I asked my provider if he could check the settings. If you want to have more clients connection you must pay for the licence.  
As Google AI says all companies might have such restrictions. I’ll give you update when I have news about this

---

<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:** [March 4, 2024, 8:21am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/49 "2024-03-04T08:21:26Z")

</div>

Please wait for the next update 😉

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 4, 2024, 11:00am UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/50 "2024-03-04T11:00:54Z")

</div>

Sorry, I don‘t have at the moment. Just seeing this from a user side without more technical details. Just what I am seeing in the app (connected Modbus) with this app:

> **[‎Mtcp](https://apps.apple.com/de/app/mtcp/id1467488841)**
>
> ‎Hi, I'm Stanislav. A few weeks ago, I created the Mtcp application for my own use. I needed to get quickly to the integer data stored in the PLC. The applications enabled me to connect to an industrial device via WiFi and use ModbusTCP protocol to...

As shown in the screenshots above.

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 4, 2024, 1:51pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/51 "2024-03-04T13:51:46Z")

</div>

> [@RonnyW](#):
>
> Do you have more information about the difference between ‘registers’ and ‘io registers’?

Could it be this?

The types of registers referenced in Modbus devices include the following:  
• Coil (Discrete Output)  
• Discrete Input  
• Input Register  
• Holding Register

[Modbus Protocol Reference](https://csimn.com/MHelp-VP3-TM/vp3-tm-appendix-C.html#:~:text=Input%20registers%20are%2016%2Dbit,requirement%20for%20%22holding%22%20data).

---

<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:** [March 4, 2024, 3:12pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/52 "2024-03-04T15:12:37Z")

</div>

I think I got it…

See [https://www.csimn.com/CSI\_pages/Modbus101.html](https://www.csimn.com/CSI_pages/Modbus101.html)  
prragraph “Modbus: When 40001 Really Means 1, or 0 Really Means 1”

That’s why I had to substract 1 from the modbus address in the documentation.  
But:

- Many documentations are using Modbus register numbers.
- The app uses Modbus address numbers for reading.

That means:  
You have to substract 1 from the documented Modbus address to get the right address when using a documented register.  
You have to use the current address is it’s documented as address.

I your case, I would assume the 13001 address should be right. But peraps the Github code says addres, but in real it’s a register.

Can you try to use 13000 or 13002 as parameter and give me a feedback?  
I think the UInt16 is reading 2 Bytes and your are 1 too low and you get only the “0003” and not the whol enumber “0315”. That’s why I think using 13000 should read the correct value.

I think about renaming current flow actions to “read/write address” and adding a second flow action pair to “reaad/write register” where the app substracts 1 from the give register number. So it won’t break existing flows.

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 4, 2024, 5:44pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/53 "2024-03-04T17:44:22Z")

</div>

Today i had 4.1 kWh

The results are:  
13000 / Size 2 / UINT16: -1  
13001 / Size 2 / UINT16: 3  
13002 / Size 2 / UINT16: 0

Doesn’t seem to match…

And this app shows:

 ![IMG_7426](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/5/0569c2e022f70fd617e59678a00377d18afe9560.png)  
 ![IMG_7427](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/1/511fdf5d8a9c40b758d9ae5a943bea038c8d82c3.png)

The io register 41 in 0.1 would be 4.1 kWh

---

<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:** [March 4, 2024, 6:32pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/54 "2024-03-04T18:32:00Z")

</div>

> [@Thomas\_Stolz](#):
>
> 13000 / Size 2 / UINT16: -1  
> 13001 / Size 2 / UINT16: 3  
> 13002 / Size 2 / UINT16: 0

Can you please check you used size 1?

Edit: I think there is a wrong function used for UINT16 (reading INT16 instead, but it makes no difference in my case). Will fix it soon.

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 4, 2024, 7:32pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/55 "2024-03-04T19:32:07Z")

</div>

Same result with size 1.

---

<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:** [March 4, 2024, 7:40pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/56 "2024-03-04T19:40:33Z")

</div>

New **test version 0.2.0** :

- Added connection type to device settings.
- Added addressing option to flow cards.
- Fixed UINT16 reading

> **[Modbus](https://homey.app/en-us/app/org.modbus/Modbus/)**
>
> Connect every Modbus devices

Choose a connection option:

 ![HomeyPro_Modbus_AddDevice04](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/6/664e58b59a44b3fc505fd6cefbd771a81e72796a.png)

- Keep connection: the device connects immediately and keeps th econnection active.
- Single connect: Connects automatically on flow actions and disconnects after processing. This is useful for an auto connect for every flow cards without keeping connected all the time
- manually: Connect and disconnect with flow actions. So you can process several flow actions between.

Addressing option:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/7/57a06a8ea3b915b7a690bea49eb2478c332ef3f9.png)

- Register: Use this for register numbers startign at #1
- Address: Use this for address numbers starting at #0

@Sasan_Khandanpour FYI, please try the single connection if this works to have only short connects to the inverter.

@Thomas_Stolz Please check if UINT16 is correct now. But I don’t think it makes a difference.

---

<div class="post-metadata">

**Author:** ![Valentin\_Ciopei](https://avatars.discourse-cdn.com/v4/letter/v/6bbea6/32.png) [@Valentin\_Ciopei](https://community.homey.app/u/Valentin_Ciopei)\
**Post date:** [March 4, 2024, 8:06pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/57 "2024-03-04T20:06:39Z")

</div>

Can you elaborate on the difference between manual and single connect?  
When do I need to use the Connect and Disconnect cards and when not.

---

<div class="post-metadata">

**Author:** ![Thomas\_Stolz](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/thomas_stolz/32/67089_2.png) [@Thomas\_Stolz](https://community.homey.app/u/Thomas_Stolz)\
**Post date:** [March 4, 2024, 8:59pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/58 "2024-03-04T20:59:26Z")

</div>

Thank you for your work. Unfortunately, the requested information has not yet been provided. (checked different variants).

 ![Bildschirmfoto 2024-03-04 um 21.58.21](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/b/4b0c2080abfc5eeb77c500d255baeb225c493b6c.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:** [March 4, 2024, 9:06pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/59 "2024-03-04T21:06:08Z")

</div>

With single connect a connection is done automatically when a flow action is processed and it’s disconnected after the flow card is finished.

With manual mode, you have to connect/disconnect manally with your flow cards.

---

<div class="post-metadata">

**Author:** ![Sasan\_Khandanpour](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sasan_khandanpour/32/79941_2.png) [@Sasan\_Khandanpour](https://community.homey.app/u/Sasan_Khandanpour)\
**Post date:** [March 4, 2024, 9:45pm UTC](https://community.homey.app/t/app-pro-modbus-connect-every-modbus-devices/104497/60 "2024-03-04T21:45:21Z")

</div>

Hi,  
thanx for changing. Once after installation of all 3 IDs and changing to single connection, I could one time read out ID2 (this was unable at the old version). Since this one time succesfull connection, unfortunately the whole meodbus app doesn’t work any more. Now I get everytime at any ID the error code “req time out”.  
So I am sorry. I used it in this flow:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/f/3fce55a8c7abc5b1ef251fb30e24b34bf29c015e.jpeg)

Even when I choose manual mode with this flow only, it is still not working. I mean it worked for one connection (in the old verison it didn’t work at all). I was first so mega happy, but since the second try, nothing works any more.

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

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