[APP][Pro] Modbus

I think i Will try your example to stop production. I just have to find the right registers.

Did you take a look into this document? Just search for WMaxLimPct and make sure to consider the scaling factor for this register.

Hi.
I cant make my fronius to force discharge my battery, i cant find witch register to use. Have you made any flows there you discharge your battery for example during expensive hours?

Im to dumb for this, i cant find the register, i cant make the battery to discharge when the price is high either.

Hi, here is an example (sorry, only german):

Thsi flow can be started from another one (Input trigger) providing the target value.
Or you can start directly/manually with the fixed value used from the play button.

Some examples how to use Fronius registers to charge/discharge can be found in this HomeAssistant description.
Fronius and BYD battery control via Modbus

Thanks again for helping me learn. What type is used for register 40356? Instead of setting % i want to set a fixed Watt. i have followed your flow above

You can only set a percentage of max. charge/discharge power that is defined in technical inverter settings:

10000 = 100% because Fronius uses INT+SF values for Modbus/TCP. That means for percentage values, a factor 100 is used to pass INT values instead of float values via Modbus API.

The type is INT16 for 40357. I used the wrong register for the input trigger. I exchanged the screenshot in the last post.

Thanks. That was very helpful, i have tried this out and now i can discharge my battery at for example the 4 most expensive hours.

1 Like

Dear RonnyW,

thanks for the nice app.

I do have another usecase, i have a waveshare Modbus ETH Relay and that is basically 8 coils (relais)
I was not able to write to the coils. Is it possible to add a writeCoil card to your app?

With Kind regards

Sure. I haven’t added it yet because I can’t test it with my inverter. So you are my beta tester :wink:

2 Likes

New test version 0.9.0:

  • Added flow card to write Coil register
    grafik

@Oscar_Dekkers FYI. Please install the test version linked above and try if you can write your Coils. Thanks for testing.

2 Likes

will happily do it

Working as expected, thanks!

I can write the coils. Tested it with The waveshare Modbus POE ETH Relay (https://www.waveshare.com/wiki/Modbus_POE_ETH_Relay)

i’m going to crete a virtual device (probably) per coil. As a thought would that be something to enhance the modbus app with a device per coil? A coil device which you can define a channel and use the existing modbus setup. Something similiar what you did with the slave modbus.

Anyway thanks for the quick response and the enhancement

1 Like

Currently I won’t add further devices.
Most users are just using the registers in flows/automations.
Easiest way is to create an AdvancedFlow with a numeric input parameter and add your Modbus details there.
Then you can start the flow everywhere and pass your parameter.

2 Likes

Hi
Great, your APP is really usefull. Thanks

I only have one problem with my PLUGGIT because they need FC16 (preset multiple register) instead of FC04 for writing. Is there a possibility to change this?

I read in this topic there should already be FC16 within UINT32, so I am not sure what I did wrong. In the LOXONEI used exactly the same inputs and this is the protocol. Here it is taken from PLUGGIT.

I am using this:

Reading is working. If I am writing, I can immediatelly read the correct value but the device is not using it (like with LOXONE). After reconnect with LOXONE it still change the value, also the device is changing and after reread with HOMEY it’s the new value from LOXONE.
image

There is no error code, but if I do not start connection I have following error code (only for get the values for comparing with working part from LOXONE. is there any difference?
{“err”:“Offline”,“message”:“no connection to modbus server”,“request”:{“_id”:28,“_protocol”:0,“_length”:11,“_unitId”:1,“_body”:{“_fc”:16,“_address”:323,“_values”:{“type”:“Buffer”,“data”:[0,0,0,1]},“_byteCount”:10,“_numberOfBytes”:4,“_quantity”:2,“_valuesAsBuffer”:{“type”:“Buffer”,“data”:[0,0,0,1]},“_valuesAsArray”:[0,1]}}}

If you write a single register (2 bytes like UINT16), the FC 06 (Write Single Register) is used.
For multi register values (4 bytes like UINT32), the FC 16 (Write Multiple Registers) is used.

A hint for your flow action: for a signed 32 byte integer you should use INT32, not UINT32 (what means unsigned). Perhaps the written values is buffered but not stored and later overwritten due to the wrong type. Just a thought.

About start connection:
You need to connect via flow if auto-comnnect is not activated in device settings.
grafik

With this setting, the app should reconnect if the connection is closed by the server.
This setting keeps the connection closed and you can connect if needed:
grafik

Thanks for your fast response.

I also tried with signed integer which should not be a different with numbers from 0-4 (fan level), but it is still not working. At the end I used UINT32 to have no difference to other system which is working.

Thanks also for the other hint, but I tried with all different versions