GivEnergy - Battery/Inverter + home power things

Yes you can remove the other ports that you don’t use.
The error you see are related to the previous cache files. If you go to the /config/GivTCP folder and delete any pkl files then restart it should run smoothly.

Thanks will try that now. I have also seen that runall hangs but readdata is in fact returning what I’d expect to see… Will upd8 shortly

OK, thanks, it seems to die on the getData side, which explains why readData works, but presumeably the data doesn’t update…

I presume it’s this:
GivTCP_1 | 2022-09-27 11:49:08,939 - read - [ERROR] - Error processing registers: (<class ‘KeyError’>, KeyError(‘Current_Rate’), <traceback object at 0x7fde01bdb980>)
GivTCP_1 | 2022-09-27 11:49:08,939 - read - [ERROR] - Invertor Update failed so using last known good data from cache (2022-09-27T10:46:53.902233+00:00)

The readdata always returns the same values so I guess the 1st interrogation works - now got this and readdata tells me failure to find data cache which the message does say it’s removing it:

GivTCP_1 | 2022-09-27 11:51:55,174 - GivLUT - [CRITICAL] - Consecutive failure count= 11
GivTCP_1 | 2022-09-27 11:51:55,174 - GivLUT - [CRITICAL] - 10 failed invertor reads in a row so removing regCache to force update…
GivTCP_1 | 2022-09-27 11:51:55,174 - read - [ERROR] - Error processing registers: (<class ‘KeyError’>, KeyError(‘Current_Rate’), <traceback object at 0x7fde01bdb980>)
GivTCP_1 | 2022-09-27 11:51:55,175 - read - [ERROR] - Invertor Update failed so using last known good data from cache (2022-09-27T10:49:08.935601+00:00)

I’m sure it’s me somehow but can’t see what

Should I have self-run as TRUE or is it wholly read from the HASS side?

The key Error is the problem, its picking up an old data cache, did you delete the pkl files? I think the code doesn’t delete one of the pkl files, so I need to update the error handling in the next release!

I suggest you leave self_run as true and that will constantly update the data cache then you can just pull readData via REST as you need.

Just for my info, any reason you don’t use MQTT to integrate into HASS?

I did delete all the .pkl files before the restarts. I had the self-run as TRUE before and did a delete of pkls, commented out self-run and restarted. Now readdata is updating when I refresh but runall still hangs and the sensors are unavailable in Hass. By eye as it scrolls I’m also not seeing the key error however the worker timeout is there.

If (as it seems) readdata is working but runall isn’t - is it worth adjusting givtcp.yaml URL to call that instead?

wrt MQTT - it just seemed an added layer of complexity so as the REST was working didn’t feel it was worth it. I did read some tutorials but at the time they seemed unclear and contradictory.

It looks to me as if the data is getting from inverter to cache - it’s just not reaching the sensors…

Ok, I changed runall to readdata and I now see sensors in Hass. Unfortunately, the updates that were working in givtcp now aren’t - the values are static. Sooo - I will change self-run back and see what that brings…


********* I am an idiot


When you pointed me at the givtcp.yaml I just copied it and didn’t update the image so was using the dev one from that file all this time. I Just pulled the latest and reset all to run as REST in givtcp and runAll in hass - it is now as it was yesterday.

I apologise profusely for wasting your time! I owe you many coffees at the very least!

Hi there,

Been using GivTCP successfully for a month or so, however it appears to have stopped and is spitting some errors.

Can anyone help me decipher the below error log?

Just in case related, apart from the usual updates to Home Assistant, another change that could be related is that I recently moved my Home Assistant install to an SSD (from the SD).

2022-10-12 09:59:54,021 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:54,532 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:55,034 - GivLUT - [CRITICAL] - Consecutive failure count= 4
2022-10-12 09:59:55,036 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fadf67b00>)
2022-10-12 09:59:55,102 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:55,617 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:56,138 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:56,665 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:57,172 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:57,680 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:58,185 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 09:59:58,687 - GivLUT - [CRITICAL] - Consecutive failure count= 5
2022-10-12 09:59:58,689 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fba62e280>)
2022-10-12 10:00:04,100 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:04,605 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:05,109 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:05,613 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:06,132 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:06,636 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:07,141 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:07,644 - GivLUT - [CRITICAL] - Consecutive failure count= 6
2022-10-12 10:00:07,646 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fadf6bd40>)
2022-10-12 10:00:07,730 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:08,242 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:08,747 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:09,251 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:09,768 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:10,272 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:10,779 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:11,280 - GivLUT - [CRITICAL] - Consecutive failure count= 7
2022-10-12 10:00:11,282 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fba62eb40>)
2022-10-12 10:00:16,693 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:17,221 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:17,747 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:18,258 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:18,778 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:19,282 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:19,790 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:20,294 - GivLUT - [CRITICAL] - Consecutive failure count= 8
2022-10-12 10:00:20,297 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fadf73b40>)
2022-10-12 10:00:20,332 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:20,838 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:21,351 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:21,855 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:22,362 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:22,872 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:23,377 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:23,879 - GivLUT - [CRITICAL] - Consecutive failure count= 9
2022-10-12 10:00:23,882 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fba62ef00>)
2022-10-12 10:00:29,287 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:29,793 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:30,298 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:30,804 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:31,308 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:31,831 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:32,336 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:32,838 - GivLUT - [CRITICAL] - Consecutive failure count= 10
2022-10-12 10:00:32,841 - read - [ERROR] - Error collecting registers: (<class 'KeyError'>, KeyError(HR:013), <traceback object at 0x7fadf73d40>)
2022-10-12 10:00:32,920 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:33,425 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:33,931 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:34,485 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:34,991 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:35,496 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:36,000 - sync - [ERROR] - Connection to (10.0.0.80, 8899) failed: [Errno 111] Connection refused
2022-10-12 10:00:36,502 - GivLUT - [CRITICAL] - Consecutive failure count= 11
2022-10-12 10:00:36,503 - GivLUT - [CRITICAL] - 10 failed invertor reads in a row so removing regCache to force update...
Traceback (most recent call last):
  File "/app/GivTCP_1/read.py", line 54, in getData
    GEInv=plant.inverter
  File "/usr/local/lib/python3.10/site-packages/givenergy_modbus/model/plant.py", line 32, in inverter
    return Inverter.from_orm(self.inverter_rc)
  File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 577, in from_orm
    values, fields_set, validation_error = validate_model(cls, obj)
  File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 1055, in validate_model
    value = input_data.get(field.alias, _missing)
  File "/usr/local/lib/python3.10/site-packages/givenergy_modbus/model/register_getter.py", line 15, in get
    self.get('inverter_serial_number_1_2'),
  File "/usr/local/lib/python3.10/site-packages/givenergy_modbus/model/register_getter.py", line 69, in get
    return getattr(self._obj, key, default)
  File "/usr/local/lib/python3.10/site-packages/givenergy_modbus/model/register_cache.py", line 26, in __getattr__
    val = self[register]
KeyError: HR:013
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/GivTCP_1/read.py", line 861, in <module>
    globals()[sys.argv[1]]()
  File "/app/GivTCP_1/read.py", line 559, in self_run2
    runAll("False")
  File "/app/GivTCP_1/read.py", line 522, in runAll
    multi_output=pubFromPickle()
  File "/app/GivTCP_1/read.py", line 535, in pubFromPickle
    result=getData(True)
  File "/app/GivTCP_1/read.py", line 77, in getData
    GivLUT.consecFails()
  File "/app/GivTCP_1/GivLUT.py", line 252, in consecFails
    os.remove(GivLUT.regcache)
FileNotFoundError: [Errno 2] No such file or directory: '/config/GivTCP/regCache_1.pkl'```

Hi britkat, first off let me say how good your GivEnergy Home Assistant add on is. I running GivTCP
Current version: 2.0.1…all sensors, setting up time charges etc etc work great. The only thing I can’t get working is the day rate, night rate, export rate etc. If I put my Octopus go rates into the config they don’t seem to flow across to the relevant sensors… Am I doing something silly or is this a feature to be updated in the next release ?? any help would be appreciated

It’s currently not working, to be fixed in the next release.
Hoping to find some time to do this soon.

Hi britkat, thanks for creating this, I’m using the Addon and so long as I don’t make any changes withe GivEnergy android app, it works fine :slight_smile:

Is there an entity that show the monetary value of exported electricity?

I know that the export rate is there and know there are issues with the rates that you plan to fix when you can have the time, which is fine :slight_smile:

Thanks again

Working happily here now.
I’m trynig to set up an automation to charge the battery along with the car in Intelligent Octopus slots.
is there an easy way to code it to start/stop charging “now”?
thanks

Is anyone using multiple batteries ? I have 2 and only 1 is being discovered

I am using 2 batteries, and both show up.

Are both batteries showing in the GivEnergy dashboard? Mine were misconfigured upon installation, and had to be recommissioned.

Secondly, I believe you must set the environment variable NUMBATTERIES_1 to have a value of 2.

Thanks for the reply. In the inverter section, it does state 2 batteries and the combined capacity is correct, is that why you mean or does your battery data show 2 separate batteries ?

Mine shows this:
image

Ah right, yes mine shows that. I’ll have a look at that setting. Thanks

That setting was already set to 2 thanks.

Looking at my logs, it looks like its finding both batteries but the 2nd serial number is missing ?

The asterisks show up as squares in the log

2022-12-21 16:37:52,261 - read - [INFO] - Getting Battery Details
2022-12-21 16:37:52,262 - read - [INFO] - Building battery output: 
2022-12-21 16:37:52,262 - read - [INFO] - Battery BJ223xxxxxx added
2022-12-21 16:37:52,262 - read - [INFO] - Building battery output: 
2022-12-21 16:37:52,262 - read - [INFO] - Battery ************* added

Maybe I’ll give GivEnergy a call tomorrow.

I called GivEnergy and they confirmed I have 2 batteries connected.

If I put 3 batteries in the config, then the other battery is detected but no device is created for it:

2022-12-22 08:11:10,269 - read - [INFO] - Getting Battery Details
2022-12-22 08:11:10,269 - read - [INFO] - Building battery output:
2022-12-22 08:11:10,270 - read - [INFO] - Battery BJ111111112 added
2022-12-22 08:11:10,270 - read - [INFO] - Building battery output:
2022-12-22 08:11:10,270 - read - [INFO] - Battery ************* added
2022-12-22 08:11:10,270 - read - [INFO] - Building battery output:
2022-12-22 08:11:10,270 - read - [INFO] - Battery BJ111111111 added
2022-12-22 08:11:10,270 - read - [INFO] - Building battery output:
2022-12-22 08:11:10,271 - read - [INFO] - Battery added