CharlesGillanders / homeassistant-alphaESS

Monitor your energy generation, storage, and usage data using the official API from Alpha ESS.
MIT License
101 stars 22 forks source link

Integration failing to setup "unsupported operand type(s) for -: 'str' and 'float'" #129

Closed jamiergrs closed 2 months ago

jamiergrs commented 2 months ago

The integration suddenly failed to start today and no matter if you reset, delete and re-add I'm still getting the following errors; The integration shows the error as "Failed setup, will retry: unsupported operand type(s) for -: 'str' and 'float'"

Checking the logs the following can be seen Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getChargeConfigInfo?sysSn=[removed]

Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=[removed]

And addtionally `Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alphaess/coordinator.py", line 84, in _async_update_data inverterdata["Solar to Load"] = _pv - _feedin


TypeError: unsupported operand type(s) for -: 'str' and 'float'`

Not sure what's changed but haven't had any issues with the integration or month, app still works fine 
strickersuk commented 2 months ago

Same for me, I opened issue 128 just before you.

Rapt0rx commented 2 months ago

The same issue started this morning on my system.

bmannz commented 2 months ago

Yes same issue for me also. Started 1hr ago for me.

suds32 commented 2 months ago

Same for me as well

Believe it will be the same issue as https://github.com/strickersuk Raised about the same time

umrath commented 2 months ago

same

strickersuk commented 2 months ago

I closed #128 to prevent duplication.

ha-es13 commented 2 months ago

Same here

strickersuk commented 2 months ago

I commented out line 84 in coordinator.py and have most of it back. Hopefully a quick fix for someone much smarter than me.

crayner commented 2 months ago

Seeing the same here.

Also in logs: Logger: alphaess.alphaess Source: custom_components/alphaess/coordinator.py:41 integration: Alpha ESS (documentation, issues) First occurred: 15:22:20 (2 occurrences) Last logged: 15:22:20

Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getChargeConfigInfo?sysSn=xxxxxxxxxxxxxxxx Unexpected json_response : {'code': 6053, 'msg': 'The maximum number of requests has been reached', 'expMsg': None, 'data': None, 'extra': None} when calling https://openapi.alphaess.com/api/getDisChargeConfigInfo?sysSn=xxxxxxxxxxxxxxx

Logger: custom_components.alphaess Source: helpers/update_coordinator.py:354 integration: Alpha ESS (documentation, issues) First occurred: 15:21:11 (34 occurrences) Last logged: 15:57:41

Unexpected error fetching alphaess data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/alphaess/coordinator.py", line 70, in _async_update_data inverterdata["Solar to Load"] = await process_value(_pv - _feedin)


TypeError: unsupported operand type(s) for -: 'str' and 'float'

Hope this helps!  Craig
jamiergrs commented 2 months ago

I commented out line 84 in coordinator.py and have most of it back. Hopefully a quick fix for someone much smarter than me.

This also worked for me, can get all data back except obviously the Solar to Load value

Poshy163 commented 2 months ago

What da fuckkkkkkk, I'll look into it now

TheSimTek commented 2 months ago

Same here. Was fine until I restarted HA

Poshy163 commented 2 months ago

Ok, an update for yall, seems like for some fucking reason epv is a string?!?!?! No idea why this happened can only imagine it was a mistake?

image

a hot fix solution is to set line 78 of coordinator.py from

_pv = await safe_get(_onedateenergy, "epv")

to

_pv = float(await safe_get(_onedateenergy, "epv"))

this basically forces the string to be a float and fixes all the following calculations

will see if this persists in a few hours, if so ill make a pull with the code so something like this cant happen again

techmaved commented 2 months ago

It seems like the api has been fixed. The integration works as usual.

Poshy163 commented 2 months ago

Yeah, appears to be fixed now, might need a integration refresh to pull the latest API changes

image

DaveBinM commented 2 months ago

Although it’s come back, my total_load sensor is now reporting as 0, which isn't right. Curious if anyone else sees this?

jamiergrs commented 2 months ago

Although it’s come back, my total_load sensor is now reporting as 0, which isn't right. Curious if anyone else sees this?

Mine is also showing as 0 since the integration started failing yesterday

Poshy163 commented 2 months ago

Huh yeah just noticed that. eload, which we use for the total load, is showing as 0 from the API 😢 image

Most of this is our of our control unfortunately, clearly they have messed with the API last night and it has had some side effects...

Poshy163 commented 2 months ago

it has been mentioned upstream: https://github.com/alphaess-developer/alphacloud_open_api/issues/82