GivEnergy Solar Inverter

I have just had a GivEnergy battery and PV system installed so installed this integration. Firstly, thanks for creating this.

I have 2 identical batteries, both 5.2KWh. On install, I input 2 batteries and 2 where created but there seems to be an issue as you can see below, any idea how to solve this ?

battery 1

battery 2

There is this warning entry in the logs (as well as a few modbus errors)

Logger: custom_components.givenergy_local
Source: custom_components/givenergy_local/sensor.py:350
Integration: GivEnergy Local (documentation, issues)
First occurred: 1:22:39 PM (1 occurrences)
Last logged: 1:22:39 PM

Ignoring battery 1 due to missing serial number
Logger: givenergy_modbus
Source: /usr/local/lib/python3.10/site-packages/givenergy_modbus/modbus.py:52
First occurred: 1:27:40 PM (1 occurrences)
Last logged: 1:27:40 PM

Modbus Error: [Input/Output] No Response received from the remote unit/Unable to decode response
NoneType: None
Logger: givenergy_modbus
Source: custom_components/givenergy_local/coordinator.py:69
Integration: GivEnergy Local ([documentation](https://github.com/cdpuk/givenergy-local), [issues](https://github.com/cdpuk/givenergy-local/issues))
First occurred: 1:27:39 PM (2 occurrences)
Last logged: 1:27:40 PM

* Did not receive expected response type: ReadInputRegistersResponse != ReadHoldingRegistersResponse
* Did not receive expected response type: ReadInputRegistersResponse != ModbusIOException
Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:374
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 1:35:10 PM (1 occurrences)
Last logged: 1:35:10 PM

Entity sensor.givenergy_ac_inverter_consumption_today from integration givenergy_local has state class total_increasing, but its state is not strictly increasing. Triggered by state 2.0 (2.1) with last_updated set to 2022-12-14T13:30:28.217979+00:00. Please report it to the custom integration author.

I’ve now published another integration that I wrote for Octopus Agile Export.

The README includes some example YAML template sensors which can be extended for your setup and requirements. I’m deliberately not tying the two projects together so they’re of use to people who might only have GivEnergy PV or Agile Export, but not both.

Hope that’s of some use.

Still using this as a reliable and robust integration - Thank you.
Negative Battery Temperatures: I have noticed during the cold weather that my Battery Temperature can show very large values like 6,552.6 C; when the dashboard shows around -3 C. (My inverter is outside and therefore colder than I would like.) At a guess this could be because the sign of 16bit integer is being misinterpreted somewhere along the processing chain. This is not important - if I wanted to I could correct it with a template. But it seemed worth noting.

Just checked my history and I can see the same value - 6552.6 C. Looks like an issue in givenergy-modbus rather than the integration itself. The datatype on the temperature fields is set to the default (unsigned 16-bit int) but it should be signed. Applying the correct maths as per register.py gives the expected result.

        if self == self.INT16:
            # Subtract 2^n if bit n-1 is set:
            if value & (1 << (16 - 1)):
                value -= 1 << 16
            if scaling != 1:
                return value / scaling
            return value

65526 - 2^16 = -10 then apply the factor of 10 scaling and you get -1 celcius.

I’m not going to raise an issue against the project as it’s in the middle of a significant rewrite. Personally I think the recent temperatures are infrequent enough that I’ll just leave it.

Interesting, but unfortunately I don’t have two batteries to investigate. Sometimes these errors indicate a temporary issue in reading the various registers. The more values you have to read (due to more batteries) I guess the more likely you are to hit these. That’s a complete guess - is anyone else with multiple batteries able to confirm whether the integration is working?

If you’d like to buy me another battery I’d gladly take a more detailed look :santa: :gift:

The total_increasing warning is something else - whenever I’ve seen this the inverter has indeed reported a value that’s gone down when it should only logically go up.

Thanks for checking - your approach seems very sensible.

Hi, thanks for the reply

The total_increasing error seems to have gone now

I installed givtcp and the mqtt only spat out one battery I checked in my GivEnergy app and it does say 2 batteries though.

Wonder if it just reporting the total of the 2.

I reinstalled the integration stating only one battery and all the values went into one battery and it does match what the app states.

I’ll monitor it for a bit as my batteries aren’t getting much charge from the sun at the minute.

So I charged my batteries to 100% from the grid and the one configured battery shows 100% but remaining capacity is at ~5.2kW so it’s definitely only one battery.

The GivTCP addon shows only one battery also but the remaining capacity as 99.03 (I assume this is 9.903kWh), SOC as 100%, design capacity as 102.0 (10.2kWh ?) and installed capacity as 99.13 (9.913kWh ?)

EDIT: I found out these figures are Ah. So are only showing 1 battery. 102Ah is 5.22kWh, my GE dashboard shows 204Ah 10.44kWh

Hi

I’m a novice at Home Assistant, but the integration of the GivEnergy hybrid inverter is exactly what I want.
I’ve followed the installation instructions, added a custom repository in HACS (using the GitHub link provided), and restarted. While under HACS if I select GivEnergy local (HACS-INTEGRATION-EXPLORE AND DOWNLOAD RESPOSITORIES - Givenergy local) it just bombs out into the instructions page. If I try to add it to the core Integrations (SETTINGS - DEVICES and SERVICES - + ADD INTEGRATION) its not listed.
I can never got the configuration page where it asks for the IP address of the inverter.
Any suggestiion as to what I’m doing wrong?

On further investigation, GivEnergy confirmed I have 2 batteries connected correctly.

If I add 3 batteries in the config, the other battery shows up but not all entities are populated for each:

Maybe. HACS is a little confusing if you’re new to it. If you’re pressing “Explore and Download Repos”, that’s actually not what you want, despite it sounding like the right thing to do. Have you checked out these instructions? https://hacs.xyz/docs/faq/custom_repositories/

Following a restart of HA, you should be able to find it via the main HA Integrations page.

Interesting. Could be another problem in the givenergy-modbus library but I think it’d take someone with two batteries and some Python knowledge to work it out. Unfortunately this sort of stuff can’t be found in public documentation, so it takes a bit of reverse engineering to work out.

When I looked at that library, the section that counts the batteries, does a break when it finds a battery with an invalid number. As mine are ordered battery 0 with a serial then battery 1 without a serial then battery 2 with a serial, maybe it stops at battery 1 ?

I’ve posted an issue on the main GivTcp GitHub, hopefully someone will be able to figure it out

It’s strange because they show up correctly on GivEnergy API.

Thanks

So looking more into this and it seems to discover the batteries with serials (0 and 2) and ignore the one with blank serial (1). This is when I config 3 batteries ( I have 2 )

The correct info and 5 sensors are generated for battery 0, BJxxxxGxx1, GivBat 1

The basic sensors are missing for battery 2, BJxxxxGxx2, GivBat 2

This is in the log:

2023-01-04 08:44:41.861 ERROR (MainThread) [homeassistant.components.sensor] Platform givenergy_local does not generate unique IDs. ID BJxxxxGxx1_battery_soc already exists - ignoring sensor.givbat_1_charge

2023-01-04 08:44:41.864 ERROR (MainThread) [homeassistant.components.sensor] Platform givenergy_local does not generate unique IDs. ID BJxxxxGxx1_battery_num_cycles already exists - ignoring sensor.givbat_1_cycles

2023-01-04 08:44:41.867 ERROR (MainThread) [homeassistant.components.sensor] Platform givenergy_local does not generate unique IDs. ID BJxxxxGxx1_v_battery_out already exists - ignoring sensor.givbat_1_output_voltage

Any ideas ?

Thanks

Installed this and get to the activation page to input the IP address. It throws an error saying cannot connect to the host.
I have setup a ping entity that shows the Pi can see the inverter address. Is there anything obvious I am missing? I have reset the wifi access of the inverter (AC3.0).
I’ve read through the comments and not come across this specific error.
Help is much appreciated.

Any more detail in the HA logs? If the connection is being flaky then simply trying a few more times might get it to work. It could of course be something along the way blocking the traffic (TCP 8899), but unlikely on a simple home network.

There’s a mention of time format so I made sure it was synced. Otherwise it says:
“Failed to validate inverter configuration”
Network is a mesh. The pi and inverter are on different nodes. That’s the only thing I can think of right now. Trouble with that is they are opposite ends of the house so connecting to the same would be hard (pi is hard wired).

“Failed to validate inverter configuration” is a message from the integration but it should be accompanied by a stack trace showing more detail about the cause (select the entry via the HA log screen?). I don’t think you’re the first AC inverter user, so an incompatibility there seems less likely. Unfortunately everyone’s setup is different, so we’ll need to get more detail to work out what’s going on.

1 Like

File “/usr/local/lib/python3.10/site-packages/givenergy_modbus/model/register.py”, line 48, in convert
return time(hour=int(f’{value:04}’[:2]), minute=int(f’{value:04}’[2:]) % 60)
ValueError: hour must be in 0…23

This is the line that looks to be failing.
To be sure of the connection I have reset the Givenergy dongle which has given a new IP address. I changed the IP ping setting in HA and tht entity is showing a connection. I can also see it on my network admin and ping from PC and phone.
I found a thread online suggesting the dongles dont play nice with mesh systems and many of the commenters had deco systems (as do I). I tried the fix they suggested with toggling fast roam and mesh but still no joy.
Now the inverter is reconnected I will try resyncing the time again. Does anyone know how to translate the error above?

Thanks again! I know I’m being difficult. I’ll post the whole log if needed but the other lines in it don’t seem to relate to any issues.

Just want to say thank you to cdpuk for developing this integration.
I just had my givEnergy inverter and battery installed and everything is working great with HA!

1 Like