Closed nswfugitive closed 6 months ago
Interesting, I haven't seen that before... can you paste the entirety of the logs you're getting?
Hi - thanks for responding. Please see attached. _pw-to-pvoutput_app_1_logs(2).txt
That big section of output prior to the actual app starting message is a bit suspicious, I have a feeling what's going on is that it's trying to hit the Powerwall API repeatedly, failing for some reason, and just keeps going like that until you get rate-limited.
Can you update line 7 of the docker-compose.yml
file (restart: unless-stopped
line for the actual application itself) to read restart: no
, try to run it again, and then when it crashes attach the whole output including from your very first docker compose up
command down to where it stops? I really need to see what it's doing above here. :) And it might be worth just giving it like an hour before attempting this just to ensure any rate limiting has expired.
Hi - do you want me to remove everything from docker, I use portainer to clean it up, e.g. remove volumes, images, etc before I redo the docker-compose up -d for a clean install?
Yeah give that a go for sure. 👍🏻
Hi - tried it - getting the following:
dj@sff-7070:~/Downloads/pw-to-pvoutput$ docker-compose up -d ERROR: The Compose file './docker-compose.yml' is invalid because: services.app.restart contains an invalid type, it should be a string
the docker-compose.yml file
version: '3.3'
services: app: image: virtualwolf/powerwall-to-pvoutput-uploader:latest build: . restart: no env_file:
postgres
postgres: image: postgres:15.3-alpine3.18 restart: unless-stopped env_file:
volumes: data:
Ahh, bloody YAML! It takes the no
value and uses that as a boolean unless you explicitly put quotes around it. Try restart: "no"
and give it another try. 😅
That fixed the .yml file. I've again cleared everything out and will try again tomorrow and do a clean install tomorrow, is there a particular log that you are looking to get back? Thanks again for helping.
Cheers, dj
That fixed the .yml file. I've again cleared everything out and will try again tomorrow and do a clean install tomorrow, is there a particular log that you are looking to get back?
Nothing specific, I just want to see the whole output to hopefully get a better idea of specifically how/why/where it's failing.
Thanks again for helping.
No worries!
Actually another good thing to test would be to double-check that your credentials are actually working:
curl \
--insecure \
--url https://<YOUR_POWERWALL_ADDRESS>/api/login/Basic \
--json '{"username":"customer","email":"<YOUR_EMAIL>","password":"<YOUR_PASSWORD>>","force_sm_off": true}'
That's the same thing that the uploader does and if it's working you should get a JSON blob back with a token
field.
Ran as requested. Please see attached log file. The container exited. _pw-to-pvoutput_app_1_logs (3).txt
Also - credentials are correct.
Also - credentials are correct.
You got the token back successfully from the curl
? If so that's interesting, because it's definitely failing from the logs (line 664):
text: '{"code":401,"error":"bad credentials","message":"Login Error"}',
And if you run that curl
command again with deliberately incorrect credentials you'll see the same error returned. 🤔
A visual check - getting the following when trying to run your curl command:
curl: option --json: is unknown curl: try 'curl --help' or 'curl --manual' for more information
Also - I think there might be some confusion with regards to the credentials - they were incorrect but I fixed and re-ran - maybe look down further in the file.
Ah dang, you must be on an older version of curl
prior to --json
being an option.
Also - I think there might be some confusion with regards to the credentials - they were incorrect but I fixed and re-ran - maybe look down further in the file.
Hmm, I think whatever method it is you're using to save the logs files isn't working how you expect. 😅 The log file attached is a thousand lines exactly which is a very suspiciously round number. The very first line in that latest log is this:
2024-04-07T00:43:40.443457485Z _streamRequest: false,
Which is part-way through logging an error, and the last line is this:
2024-04-07T00:43:40.459014126Z npm notice
Which is part-way through the application startup.
I'm using portainer which you need to specify the number of lines - I've greatly increased, hopefully this will give you the info you need ;-) [Uploading _pw-to-pvoutput_app_1_logs (6).txt…]()
I don't think that uploaded properly, haha. The link is named Uploading _pw-to-pvoutput_app_1_logs (6).txt…
and the actual link itself just goes back to this issue.
(It also occurs to me that it might be worth just taking a look through that log first to ensure your credentials haven't ended up being included... 😬)
Trying again to upload the log file... _pw-to-pvoutput_app_1_logs.txt
also checked the logs - I don't see any credentials but if you do please delete the file ;-)
Hah, much better! And cool, yeah, it's definitely the credentials:
2024-04-07T02:59:16.268535153Z 2024-04-07 12:59:16 [INFO] 'App started!'
2024-04-07T02:59:26.061838410Z /opt/service/node_modules/superagent/lib/node/index.js:845
2024-04-07T02:59:26.062060531Z error = new Error(message);
2024-04-07T02:59:26.062076253Z ^
2024-04-07T02:59:26.062080945Z
2024-04-07T02:59:26.062084749Z <ref *4> Error: Unauthorized
2024-04-07T02:59:26.062089325Z at Request.callback (/opt/service/node_modules/superagent/lib/node/index.js:845:17)
2024-04-07T02:59:26.062093371Z at /opt/service/node_modules/superagent/lib/node/index.js:1070:18
2024-04-07T02:59:26.062097307Z at IncomingMessage.<anonymous> (/opt/service/node_modules/superagent/lib/node/parsers/json.js:21:7)
2024-04-07T02:59:26.062101884Z at Stream.emit (node:events:513:28)
2024-04-07T02:59:26.062105776Z at Unzip.<anonymous> (/opt/service/node_modules/superagent/lib/node/unzip.js:54:12)
2024-04-07T02:59:26.062109839Z at Unzip.emit (node:events:513:28)
2024-04-07T02:59:26.062113631Z at endReadableNT (node:internal/streams/readable:1359:12)
2024-04-07T02:59:26.062117461Z at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
2024-04-07T02:59:26.062121550Z status: 401,
I can replicate that exact error if I change my password to the wrong one. On the older version of curl
you're running, you can use this instead to accomplish the same as the --json
flag:
curl \
--insecure \
--url https://<YOUR_POWERWALL_ADDRESS>/api/login/Basic \
--header 'content-type: application/json' \
-d '{"username":"customer","email":"<YOUR_EMAIL>","password":"<YOUR PASSWORD>","force_sm_off": true}'
And if that works, I'd say try running it straight up with docker compose up
as the README says, because there's something funny going on with the password. Maybe Portainer is doing something weird (I have no idea, I'm just spitballing here but I'm completely unfamiliar with Portainer or how it works).
Do you have any special characters in your password? I'm not sure how that would be tripping it up since it's just pulling it from dotenv
as an environment variable which in turn is just a string, but...
I guess the acid test would be dropping a new line into src/app.ts
on line 6:
logger(`email is ${process.env.POWERWALL_EMAIL} and password is ${process.env.POWERWALL_PASSWORD}`);
Then running docker compose up --build
and double-checking that it matches what you think it's using.
I get the following output:
{"email":"
I edited the email address that was returned.
Also, I'm only using portainer to look at, stop and start the environment, look at logs, etc. I'm using your stock standard docker-compose to initialize and run the environment.
Well - I'm feeling pretty stupid. I figured it out with your help. I was using http instead of https. Thanks for all your help and I'm sorry to have wasted your time.
Cheers mate.
Whaaaaat, that is absolutely bizarre behaviour! So it lets you hit the API, but you get an "Unauthorised" message if you're not using HTTPS, with no indication of that being what the problem is?
Good lord. I'll definitely make a note of that in the README because that's a good thing to know, haha.
Done, and it'll bail out before even starting if the URL isn't HTTPS. 🙂
Hi - I'm trying to install but it doesn't seem to be working. I've set the debug option on and getting the above error when looking at the log for the uploader. Is there too many requests going to the powerwall? Or something else?
Any help would be appreciated.
Cheers, dj