Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error with latest version? TypeError: can only concatenate str #9

Closed
Boffinboy opened this issue Jun 17, 2023 · 12 comments
Closed

Comments

@Boffinboy
Copy link

Hi there, I have been running palm_soc very nicely on my Synology in a docker container for a while now. I decided it was time to update with your latest, which now deprecates palm_soc.

Unfortunately I am getting an error, not sure what is causing it. It looks like it is not getting the right load history info? See below what comes up in the log before the container stops:
File "/pi/palm/palm_unmodified.py", line 1020, in
ge.get_load_hist()
File "/pi/palm/palm_unmodified.py", line 202, in get_load_hist
logger.error("Invalid response: "+ resp.status_code)

TypeError: can only concatenate str (not "int") to st
@salewis38
Copy link
Owner

Hi, should be fixed in today's version... the logger library is quite fussy and I missed a couple of string conversions when I migrated to it... sorry about that. The bothersome line would only be called if palm.py fails to download the load history as you indicate.

@Boffinboy
Copy link
Author

Thank you. I will try again. I’m a bit confused why it wouldn’t be able to pull the load data - any ideas what could prevent that? It pulled it no problem in the version I was using previously. Has the way the data is pulled changed? I checked my Givenergy account and API key in the settings file and both seem correct.

@salewis38
Copy link
Owner

salewis38 commented Jun 18, 2023 via email

@Boffinboy
Copy link
Author

For whatever reason I still get the same error, even with your latest modifications. Is there a difference in behaviour between palm and palm_soc? I have found in the new version that palm_soc get the data, but palm does not. I am able to successfully use soc, but this is not a long term solution if you are deprecating it.

With palm I can see that it is not pulling the data from GivEnergy when it tries to contact the API (note I am pulling from 7 days before):

https://api.givenergy.cloud:443 "GET /v1/inverter/CEMYINVERTER/data-points/2023-06-11?page=1&pageSize=2000 HTTP/1.1" 401 None stdout
I know the API and inverter account number are correct, as they work in the older version of palm_soc I have been using. I did notice in the template settings file there are no longer spaces either side of the key=“APIKEY” - but I have tried adding them both back in and I still have the same issue.

I am also wondering if it’s the logging capability. You may remember I am running on Synology and docker, so if that uses a different package I need to install that in the container. Is there any extra package required vs palm SoC?

@salewis38
Copy link
Owner

salewis38 commented Jun 18, 2023

The 401 error indicates a problem with the authentication credentials that you're sending to the GE server. It's not related to the the 7-day change (tried that) or the logger (it wouldn't get this far).

Downloading palm.py and the template settings.py from Github and editing only the Solcast and GE sections of the file worked as expected here in once mode:

DEBUG:urllib3.connectionpool:https://api.givenergy.cloud:443 "GET /v1/inverter/CExxxx/data-points/2023-06-11?page=1&pageSize=2000 HTTP/1.1" 200 None
INFO:PALM:Load Calc Summary: 7.2[0.2, 0.8, 0.2, 0.2, 0.1, 0.0, 0.2, 0.1, 0.1, 0.1, 0.1, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.1, 0.3, 0.0, 0.2, 0.1, 0.1, 0.2, 1.3, 1.6, 0.2, 0.3, 0.1, 0.2, 0.2, 0.5, 0.3, 0.5, 0.7, 0.5, 0.9, 0.3, 0.2, 0.3, 0.3, 0.3, 0.2, 0.7, 0.2, 0.3, 0.3]

There are a few differences in the latest settings.py, such as the longer GE.base_load to work with 30-minute calculations, but they would throw a different error.

Please try the above and edit a fresh settings.py with your API key, etc. I would hope that fixes the problem.

@Boffinboy
Copy link
Author

Boffinboy commented Jun 18, 2023

Thanks again for looking into this. I did try re-editing the settings.py fresh. Presumably the credentials must be working OK though because palm_soc using the same settings file (not the old version I was using) is able to pull the data fine? To be clear, I downloaded fresh from GitHub, edited settings file and tried running both palm and palm_soc. Soc works, default palm does not. Do the two read or pass through the credentials in a different way from the settings file?

@salewis38
Copy link
Owner

The get_load_hist code is identical in both versions... maybe try again in a clean directory/on a different machine?

Going through it tonight, I did spot an unrelated bug, so all was not lost!

@Boffinboy
Copy link
Author

Odd! I will try again next weekend, got a bit of a crazy week ahead. Will use the soc version for now. Thanks as usual for helping.

@salewis38
Copy link
Owner

No problem. I had some time on my hands yesterday so have improved the historical load forecasting - v0.10.0 reads from a table in settings.py... the forecast consumption now uses a weighted average of arbitrary length, so can easily be set to the same day last week, etc.

@Boffinboy
Copy link
Author

Looks like an excellent addition! Hopefully I can find time at weekend to get the standard palm version working.

@Boffinboy
Copy link
Author

Seems to be working, will test overnight!

@Boffinboy
Copy link
Author

Closing this as all working fine

@Boffinboy Boffinboy reopened this Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants