RichardL64 / Solar

Solis inverter / Pylontech battery arduino integration for remote panel etc outside the cloud
7 stars 1 forks source link

Tracking down PV-CT registers #3

Closed stuartsjg closed 11 months ago

stuartsjg commented 1 year ago

Hi,

Richard, you code base has been a massive help in my project. I have a Solis RAI-3K-48ES-5G, setup for UK G98 standards. Ive been able to get a number of registers reading into my project on another board via reading an HTTP JSON result. Ive added this project to my public project (First one ive posted! Its still a work in progress to prove the concept).

For my colourful energy display, i need to know the PV inverter output, battery output and grid import, but i cant find a register for the PV data from the CT connected to the RAI. The inverter LCD has the following parameters;

PV-CT voltage PV-CT current PV CT power

Do you know what the register may be for the PV-CT power reading? Your program uses 33057 for PV power, but for me that always reads as zero.

I am using the following registers: 33135 (battery direction), 33079 (inverter active power, without direction but i combine with 33135) 33130 (RS485 energy meter on grid connection)

My PV inverter is also Solis, the Mini Inverter 2500-4G, so if i need to then i can also probe that directly. If i was to do that, can you point out in your code where the MODBUS address value (currently 01 is set on the RAI inverter) would live so I could poll the Solar inverter too on the same wire?

Many thanks for any help you can provide,

Stuart

RichardL64 commented 1 year ago

Hi Stuart, Glad i've been of some help already,

Re registers - the reference document I use is called 'RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf'

I don't remember where I found it - but googling may turn something up.

I'm aware solis may use different registers in different locales & another use reported their registers in places were offset +1 or -1 etc.

Also keep in mind if you find registers outside the 3xxxx range it needs a different comand to access them - I have that code working in beta somewhere.

Note

33057 is a double width register, try 33058 for the low 16 bits

If I reference that document I see:

33128 Meter voltage U16 10 = 1V 33129 Meter current U16 10 = 1A 33130-33131 Meter power S32 1 = 1W

Note - power is a double width register so again 33131 will have the low 16 bits.

Hope that helps.

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 00:08, stuartsjg @.***> wrote:

Hi,

Richard, you code base has been a massive help in my project. I have a Solis RAI-3K-48ES-5G, setup for UK G98 standards. Ive been able to get a number of registers reading into my project on another board via reading an HTTP JSON result. Ive added this project to my public project (First one ive posted! Its still a work in progress to prove the concept).

For my colourful energy display, i need to know the PV inverter output, battery output and grid import, but i cant find a register for the PV data from the CT connected to the RAI. The inverter LCD has the following parameters;

PV-CT voltage PV-CT current PV CT power

Do you know what the register may be for the PV-CT power reading? Your program uses 33057 for PV power, but for me that always reads as zero.

I am using the following registers: 33135 (battery direction), 33079 (inverter active power, without direction but i combine with 33135) 33130 (RS485 energy meter on grid connection)

My PV inverter is also Solis, the Mini Inverter 2500-4G, so if i need to then i can also probe that directly. If i was to do that, can you point out in your code where the MODBUS address value (currently 01 is set on the RAI inverter) would live so I could poll the Solar inverter too on the same wire?

Many thanks for any help you can provide,

Stuart

— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA. You are receiving this because you are subscribed to this thread.

stuartsjg commented 1 year ago

Hi,

Thanks for getting back to me so quickly. The meter registers 33128 to 33131 i am already reading, these are the RS485 meter supplying the inverter with grid import/export power. I am pretty sure now the CTs are not in any published doc so ill get in touch with Solax.

If i have no luck, whats your thoughts about your code base being used to read another slave device address on the RS485 bus? Been having a look and im scratching my head about where to start with mods to poll another inverter, it almost feels like in the dashboard.html.h, in the "Inverter register addresses" or "Register request constants" that a slave address could be added in here. I believe this line "if(!ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, address, size)) {" in SolisComms would simply need the "1" replaced for a slave address variable? If thats the case, im not sure how this would be handled back through the Cache.

All the best, Stuart

On Sat, May 27, 2023 at 7:01 AM Richard Lincoln @.***> wrote:

Hi Stuart, Glad i've been of some help already,

Re registers - the reference document I use is called 'RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf'

I don't remember where I found it - but googling may turn something up.

I'm aware solis may use different registers in different locales & another use reported their registers in places were offset +1 or -1 etc.

Also keep in mind if you find registers outside the 3xxxx range it needs a different comand to access them - I have that code working in beta somewhere.

Note

33057 is a double width register, try 33058 for the low 16 bits

If I reference that document I see:

33128 Meter voltage U16 10 = 1V 33129 Meter current U16 10 = 1A 33130-33131 Meter power S32 1 = 1W

Note - power is a double width register so again 33131 will have the low 16 bits.

Hope that helps.

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 00:08, stuartsjg @.***> wrote:

Hi,

Richard, you code base has been a massive help in my project. I have a Solis RAI-3K-48ES-5G, setup for UK G98 standards. Ive been able to get a number of registers reading into my project on another board via reading an HTTP JSON result. Ive added this project to my public project (First one ive posted! Its still a work in progress to prove the concept).

For my colourful energy display, i need to know the PV inverter output, battery output and grid import, but i cant find a register for the PV data from the CT connected to the RAI. The inverter LCD has the following parameters;

PV-CT voltage PV-CT current PV CT power

Do you know what the register may be for the PV-CT power reading? Your program uses 33057 for PV power, but for me that always reads as zero.

I am using the following registers: 33135 (battery direction), 33079 (inverter active power, without direction but i combine with 33135) 33130 (RS485 energy meter on grid connection)

My PV inverter is also Solis, the Mini Inverter 2500-4G, so if i need to then i can also probe that directly. If i was to do that, can you point out in your code where the MODBUS address value (currently 01 is set on the RAI inverter) would live so I could poll the Solar inverter too on the same wire?

Many thanks for any help you can provide,

Stuart

— Reply to this email directly, view it on GitHub < https://github.com/RichardL64/Solar/issues/3>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA . You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/3#issuecomment-1565225019, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7RMJU5NKUU3HK626ZOJYODXIGKDTANCNFSM6AAAAAAYQYWNYA . You are receiving this because you authored the thread.Message ID: @.***>

RichardL64 commented 1 year ago

Hi Stuart,

Re CTs I'm misunderstanding your original question - in my setup the only CT is connected via the Meter to the Inverter i.e.

Mains Live -> CT -> meter -> RS485 -> Inverter

Those are the numbers in 33128-33131

Re another slave address

"if(!ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, address, size)) {" in SolisComms would simply need the "1" replaced for a slave address variable?

Yes - thats my understanding - change slave address You're right my cache is keyed on address so it would need modifying to key on slave# too.

I'd always assumed I'd run another arduino on another device and have either the client or one of the arduino's poll the other to collate date?

I guess the question is would another device play nice with the inverter on the same bus?

Shelley mains device control Incidentaly - if your aware of shelley devices (Shelly Store UK - Smart Home https://www.google.com/aclk?sa=l&ai=DChcSEwj7mq-eiJb_AhVYxO0KHcADAmIYABA8GgJkZw&ae=2&sig=AOD64_06L2D94OrBnefF_CG64o2ItaaNxg&q&adurl&ved=2ahUKEwjx6qieiJb_AhWNbsAKHRSvC0YQ0Qx6BAgKEAEDevicesshellystore.co.ukhttps://www.shellystore.co.uk <devicesshellystore.co.ukhttps://www.shellystore.co.uk>) they can hit JSON over HTML end points and make mains switch etc decisions based on my base code.

More luck than judgement - but nice options if you need to control devices based on any inverter variable or combination. I mocked up some code here with example logic - not installed though: https://github.com/RichardL64/Solar/tree/main/Shelly%20Plus1 https://github.com/RichardL64/Solar/tree/main/Shelly%20Plus1

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 15:38, stuartsjg @.***> wrote:

Hi,

Thanks for getting back to me so quickly. The meter registers 33128 to 33131 i am already reading, these are the RS485 meter supplying the inverter with grid import/export power. I am pretty sure now the CTs are not in any published doc so ill get in touch with Solax.

If i have no luck, whats your thoughts about your code base being used to read another slave device address on the RS485 bus? Been having a look and im scratching my head about where to start with mods to poll another inverter, it almost feels like in the dashboard.html.h, in the "Inverter register addresses" or "Register request constants" that a slave address could be added in here. I believe this line "if(!ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, address, size)) {" in SolisComms would simply need the "1" replaced for a slave address variable? If thats the case, im not sure how this would be handled back through the Cache.

All the best, Stuart

On Sat, May 27, 2023 at 7:01 AM Richard Lincoln @.***> wrote:

Hi Stuart, Glad i've been of some help already,

Re registers - the reference document I use is called 'RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf'

I don't remember where I found it - but googling may turn something up.

I'm aware solis may use different registers in different locales & another use reported their registers in places were offset +1 or -1 etc.

Also keep in mind if you find registers outside the 3xxxx range it needs a different comand to access them - I have that code working in beta somewhere.

Note

33057 is a double width register, try 33058 for the low 16 bits

If I reference that document I see:

33128 Meter voltage U16 10 = 1V 33129 Meter current U16 10 = 1A 33130-33131 Meter power S32 1 = 1W

Note - power is a double width register so again 33131 will have the low 16 bits.

Hope that helps.

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 00:08, stuartsjg @.***> wrote:

Hi,

Richard, you code base has been a massive help in my project. I have a Solis RAI-3K-48ES-5G, setup for UK G98 standards. Ive been able to get a number of registers reading into my project on another board via reading an HTTP JSON result. Ive added this project to my public project (First one ive posted! Its still a work in progress to prove the concept).

For my colourful energy display, i need to know the PV inverter output, battery output and grid import, but i cant find a register for the PV data from the CT connected to the RAI. The inverter LCD has the following parameters;

PV-CT voltage PV-CT current PV CT power

Do you know what the register may be for the PV-CT power reading? Your program uses 33057 for PV power, but for me that always reads as zero.

I am using the following registers: 33135 (battery direction), 33079 (inverter active power, without direction but i combine with 33135) 33130 (RS485 energy meter on grid connection)

My PV inverter is also Solis, the Mini Inverter 2500-4G, so if i need to then i can also probe that directly. If i was to do that, can you point out in your code where the MODBUS address value (currently 01 is set on the RAI inverter) would live so I could poll the Solar inverter too on the same wire?

Many thanks for any help you can provide,

Stuart

— Reply to this email directly, view it on GitHub < https://github.com/RichardL64/Solar/issues/3 https://github.com/RichardL64/Solar/issues/3>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA . You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHub <https://github.com/RichardL64/Solar/issues/3#issuecomment-1565225019 https://github.com/RichardL64/Solar/issues/3#issuecomment-1565225019>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A7RMJU5NKUU3HK626ZOJYODXIGKDTANCNFSM6AAAAAAYQYWNYA https://github.com/notifications/unsubscribe-auth/A7RMJU5NKUU3HK626ZOJYODXIGKDTANCNFSM6AAAAAAYQYWNYA> . You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/3#issuecomment-1565456054, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWDECNQPX5R57YECU3NGKDTXIIGVHANCNFSM6AAAAAAYQYWNYA. You are receiving this because you commented.

stuartsjg commented 1 year ago

Hi,

I had the idea to use the size field to also carry significance of the slave address, so setup sizes 3 and 4 to denote address 2, size 1 and address 2, size 2. This passes from the Dashboard/Server/Cache etc fine and in SolisComms i just if/else if the 4 cases to define the size and address which form the request.

I'm not sure it's particularly elegant or reliable, i am now getting data from the PV inverter on address 2, but ive noticed the first register being requested on address 2 always comes back as error state. This can be patched by requesting something first which i'm not interested in. What is more puzzling is when the data is requested, the order of the request is important.

Eg, if I request "...R/?addr=3004.4,33135.1,33079.2,33130.2" - the 3004 register on the PV inverter will go into error state and be in the cache, but "..R/?addr=33135.1,33079.2,33130.2,3004.4" works OK, provided 3004 is not the first register in the cache on address 2. If another parallel request comes in eg just for "..R/?addr=3004.4" then this too can cause things to be unstable by taking the form of an address 2 entry surrounded by address 1 entries.

Attached here is my butchery to your lovely code base!

All the best, Stuart

On Sat, May 27, 2023 at 6:56 PM Richard Lincoln @.***> wrote:

Hi Stuart,

Re CTs I'm misunderstanding your original question - in my setup the only CT is connected via the Meter to the Inverter i.e.

Mains Live -> CT -> meter -> RS485 -> Inverter

Those are the numbers in 33128-33131

Re another slave address

"if(!ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, address, size)) {" in SolisComms would simply need the "1" replaced for a slave address variable?

Yes - thats my understanding - change slave address You're right my cache is keyed on address so it would need modifying to key on slave# too.

I'd always assumed I'd run another arduino on another device and have either the client or one of the arduino's poll the other to collate date?

I guess the question is would another device play nice with the inverter on the same bus?

Shelley mains device control Incidentaly - if your aware of shelley devices (Shelly Store UK - Smart Home < https://www.google.com/aclk?sa=l&ai=DChcSEwj7mq-eiJb_AhVYxO0KHcADAmIYABA8GgJkZw&ae=2&sig=AOD64_06L2D94OrBnefF_CG64o2ItaaNxg&q&adurl&ved=2ahUKEwjx6qieiJb_AhWNbsAKHRSvC0YQ0Qx6BAgKEAE

Devicesshellystore.co.ukhttps://www.shellystore.co.uk <devicesshellystore.co.ukhttps://www.shellystore.co.uk>) they can hit JSON over HTML end points and make mains switch etc decisions based on my base code.

More luck than judgement - but nice options if you need to control devices based on any inverter variable or combination. I mocked up some code here with example logic - not installed though: https://github.com/RichardL64/Solar/tree/main/Shelly%20Plus1 < https://github.com/RichardL64/Solar/tree/main/Shelly%20Plus1>

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 15:38, stuartsjg @.***> wrote:

Hi,

Thanks for getting back to me so quickly. The meter registers 33128 to 33131 i am already reading, these are the RS485 meter supplying the inverter with grid import/export power. I am pretty sure now the CTs are not in any published doc so ill get in touch with Solax.

If i have no luck, whats your thoughts about your code base being used to read another slave device address on the RS485 bus? Been having a look and im scratching my head about where to start with mods to poll another inverter, it almost feels like in the dashboard.html.h, in the "Inverter register addresses" or "Register request constants" that a slave address could be added in here. I believe this line "if(!ModbusRTUClient.requestFrom(1, INPUT_REGISTERS, address, size)) {" in SolisComms would simply need the "1" replaced for a slave address variable? If thats the case, im not sure how this would be handled back through the Cache.

All the best, Stuart

On Sat, May 27, 2023 at 7:01 AM Richard Lincoln @.***> wrote:

Hi Stuart, Glad i've been of some help already,

Re registers - the reference document I use is called 'RS485_MODBUS-Hybrid-BACoghlan-201811228-1854.pdf'

I don't remember where I found it - but googling may turn something up.

I'm aware solis may use different registers in different locales & another use reported their registers in places were offset +1 or -1 etc.

Also keep in mind if you find registers outside the 3xxxx range it needs a different comand to access them - I have that code working in beta somewhere.

Note

33057 is a double width register, try 33058 for the low 16 bits

If I reference that document I see:

33128 Meter voltage U16 10 = 1V 33129 Meter current U16 10 = 1A 33130-33131 Meter power S32 1 = 1W

Note - power is a double width register so again 33131 will have the low 16 bits.

Hope that helps.

R I C H A R D L I N C O L N @.***

On 27 May 2023, at 00:08, stuartsjg @.***> wrote:

Hi,

Richard, you code base has been a massive help in my project. I have a Solis RAI-3K-48ES-5G, setup for UK G98 standards. Ive been able to get a number of registers reading into my project on another board via reading an HTTP JSON result. Ive added this project to my public project (First one ive posted! Its still a work in progress to prove the concept).

For my colourful energy display, i need to know the PV inverter output, battery output and grid import, but i cant find a register for the PV data from the CT connected to the RAI. The inverter LCD has the following parameters;

PV-CT voltage PV-CT current PV CT power

Do you know what the register may be for the PV-CT power reading? Your program uses 33057 for PV power, but for me that always reads as zero.

I am using the following registers: 33135 (battery direction), 33079 (inverter active power, without direction but i combine with 33135) 33130 (RS485 energy meter on grid connection)

My PV inverter is also Solis, the Mini Inverter 2500-4G, so if i need to then i can also probe that directly. If i was to do that, can you point out in your code where the MODBUS address value (currently 01 is set on the RAI inverter) would live so I could poll the Solar inverter too on the same wire?

Many thanks for any help you can provide,

Stuart

— Reply to this email directly, view it on GitHub < https://github.com/RichardL64/Solar/issues/3 < https://github.com/RichardL64/Solar/issues/3>>, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA < https://github.com/notifications/unsubscribe-auth/AWDECNQ2IJV6RHWV5H7PSH3XIEZWRANCNFSM6AAAAAAYQYWNYA

. You are receiving this because you are subscribed to this thread.

— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/3#issuecomment-1565225019 <https://github.com/RichardL64/Solar/issues/3#issuecomment-1565225019>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/A7RMJU5NKUU3HK626ZOJYODXIGKDTANCNFSM6AAAAAAYQYWNYA < https://github.com/notifications/unsubscribe-auth/A7RMJU5NKUU3HK626ZOJYODXIGKDTANCNFSM6AAAAAAYQYWNYA

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/RichardL64/Solar/issues/3#issuecomment-1565456054>, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AWDECNQPX5R57YECU3NGKDTXIIGVHANCNFSM6AAAAAAYQYWNYA . You are receiving this because you commented.

— Reply to this email directly, view it on GitHub https://github.com/RichardL64/Solar/issues/3#issuecomment-1565618905, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7RMJU4JVJPGVOKLPXK6H4DXII545ANCNFSM6AAAAAAYQYWNYA . You are receiving this because you authored the thread.Message ID: @.***>