[APP][Pro] Modbus

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?

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

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:

Anything I can do to help?

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).

@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.

4 Likes

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 :slight_smile:

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…

3 Likes

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.

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

and here:
Sungrow Wechselrichter mit Modbus in Iobroker in Echtzeit auslesen - noegel.io (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.


Is there an option to read it this way?

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

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

Please wait for the next update :wink:

1 Like

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:

As shown in the screenshots above.

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.

I think I got it…

See 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.

1 Like

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:


The io register 41 in 0.1 would be 4.1 kWh

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.

Same result with size 1.

New test version 0.2.0:

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

Choose a connection option:
HomeyPro_Modbus_AddDevice04

  • 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

  • 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.

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.

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

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.

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:

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.