[APP][Pro] Modbus

Aah, I’ll have a search.

Sorry for maybe beeing a stupid question, but will this app work with comunicating with my emh1 charger throug an rs485 to wifi device (elfin-11a). Here is the documentation of the charger. https://www.ablmobility.de/global/downloads/anleitungen/emh1/Schnittstellenbeschreibung_Modbus-ASCII.pdf?m=1652185246&

Hello Antohagg, modbus uses to different protocols. TCP IP via LAN Network like Homey and RTU, what is mainly done by RS485. The Modbus App uses, as I understood TCP IP, thats why you have to fill in the IP adress of your Modbus device.

1 Like

I thought that the Elfin-ew11 would convert between tcp and RTU, but maybe im totally wrong. :face_with_peeking_eye:.

My plan is Homey<-(Tcp)->Elfin-ew11<-(rs485)->Emh1

Could work. I think the app can connect to this dongle. But you need to know the device IDs and registers to use vis ModbusTCP. I only know that Fronius has different Modbus references/manuals for RS485/TCP.

Ronny, I think I found it. The inverters are based on the Sunspec standard.
Register info,

Edit - I don’t think the sunspec above is correct as it doesn’t match the info below. I’m pretty sure the register mapping is as per this spreadsheet, but I am getting it checked as it says Gen24 and mine is a Primo SnapINverter.
https://1drv.ms/x/s!Aue4WxhPdBbbgqZNNYGrC34bDwIRIA?e=3zLPst

And here is a YouTube video given by the Australian Fronius techno’s on this topic. It’s long so I don’t expect you to go through it but thought I would include it just in case it was useful.
https://www.youtube.com/watch?v=UMR_4rqxZts
I also found this link written by a.HA enthusiast in Australia. It is for the Gen24 though so I have written to him to check the mapping is the same for my Primo.
https://forums.whirlpool.net.au/go?https%3A%2F%2Fwww.smartmotion.life%2F2023%2F09%2F12%2Fhome-assistant-and-amber-electric-your-pathway-to-smarter-energy-management%2F

1 Like

Ronny, using the info in the spreadsheet above I modified the Flow as per below. Still needs some work but it ran without error. It gave me a “result” of 50361 and at the time I was producing approx 3250W, but it’s quite possible the the register I chose was not holding the data for the AC Power being produced by my solar system.
Register 40092 read 17657 and register 40084 read 32704. 32704 would be very close to solar production if it was divided by 10.

You can try the registers from the Fronius documentaion.
https://www.fronius.com/~/downloads/Solar%20Energy/Operating%20Instructions/SE_EI_Modbus_Sunspec_Maps_State_Codes_Events_EN.zip

Try the file “Meter_Register_Map_Int&SF_v1.0.xlsx” for power meter data or “Inverter_Register_Map_Int&SF_v1.0_with_SYMOHYBRID_MODEL_124.xlsx”. Perhaps Symo registers are similar.

Bsed on this, 40084 is voltage between two phases.

Thanks Ronny. I will get back to you on the register mapping topic shortly. I have been doing a lot of research and gathering docs, so now I want to do some more testing before I respond with detail.
I have been reading what others have done with HA (I referenced that doc above) and seeing you also use HA i thought you may be able to help with how to adopt some HA code to Homeyscript if that makes sense.
Could you modify this script to HomeyScript for me?

sensor: - platform: template   sensors:     amber_feedin_price_negative:
       value_template:  '{{ states.sensor.solar_array_feed_in_price.state | multiply(100) | int(1) <= 0 }}'
       availability_template: '{{ states.sensor.solar_array_feed_in_price.state not in ["unavailable", "unknown"] }}'

Ronny,
I am 99% sure now that this spreadsheet (https://1drv.ms/x/s!Aue4WxhPdBbbgqZPQKiFVqAcMDBK3g?e=TTqODI) has the correct mapping for my Primo inverter.
In a video I found given by Fronius Australia staff (https://www.youtube.com/watch?v=UMR_4rqxZts) they laid out the steps to limit output at various levels for various periods of time. e.g. to limit output to 50% and stay at 50% indefinitely then:
Set 40233 → 5000, 40234->0, 40235->0, 40236->0 and 40237->1
Do you agree with this?
Now all I have to do is work out how to properly write to them using your Modbus flow cards. They are all uint16 except for 40237 which is enum16.
Any help in doing this would be greatly appreciated.

My registers start at 40001. Does your method still apply?

You have to set the starting Number to #1 the rest should work. Just try holding register if that not works the other function to read

That’s a template sensor based on another sensor value (prices). I think you need an Homey app/device like Tibber if you want to use dynamic prices as trigger.

Holding register should be ok. It seems Fronius is only using these ones. And use the “Register #1” option because Fronius is using Register naming in the documentation.

Enum16 should be an UINT16. Only difference is, that only the defines values are allowed (enum list).

Thanks @Itz_Volker

New test version 0.6.0:

  • Added new Types: little-endian (LE) for all typed,
  • Removed FLOAT16

@Itz_Volker: FYI. If I’m right you wanted FLOAT32LE as type?

Hi Ronny, float32 LE thats right. Thanks a lot for your work. I am just on holydays, but I will test it as soon as I am back.
Volker

Ronny,

Thanks again for your help. I have set it up to read the following registers but I don’t know how to interpret the results, and I thought I should make sure I get this right before starting to write to them. Here are the results I got. Do they make sense to you?
Screenshot 2024-03-23 at 12.59.15 pm
In the spreadsheet there is a column headed Function Codes which has 3 hex values stated 0x03, 0x06 and 0x10. Do you know what these are used for?
Sorry, another question. Someone above said that when addressing registers, when you want register 40233, you actually have to enter 40232. Is that correct or does your Register, starting with #1 take that into account?

Manufactures are using address and register format.
Fronius uses register format starting at 1. So just choose the “Register starting at #1” option in the flow card. Then you can insert the Fronius register numbers and the app is converting to address number (just minus 1). So it’s easier when using the numbers from the list.

Thanks.
What I really need help with Ronny is understanding the data I am reading from the registers. When I compare it to the expected values in the table the values I read they don’t seem equitable. For example if I am supposed to write 5000 into register 40233 how come it currently reads 11665 when the expected value is supposed to be 0 to 100. As I understand it 5000 is divided by 100 equaling 50%. If I did that then the register has 117%.
I hope you can find the time to help me. It’s just a hurdle I need to get over in order to understand the fundamentals of equating the register data to the Modbus commands.

I don’t know how to help you in detail. I can only give some examples from the Gen24.

Example for discharge rate:

The register gives you an percentage 0 … 100,00%. If you are using the INT-SF format in Fronius settings, this value is returned as INT value. Means: the range is 0 … 10000. The upper range is defined by the scale factor.

This factor you can read from the corresponding register:

The default is -2. Means: Shift decimal places by -2, or: *10^-2
So you can convert the 10000 * 10°-2 = 100,00.
If you know the factor, you can just do this in your flows or set 5000 if you want to have 50%.

Flow example:
grafik

If you are reading the scale factor with the app, you can get the factor for easy calculation in flows:


But as said, you don’t need this if your using factor /100 directly.