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

Client Install Fails on Pi 4 #1

Open
bigbernmcraken opened this issue May 25, 2022 · 22 comments
Open

Client Install Fails on Pi 4 #1

bigbernmcraken opened this issue May 25, 2022 · 22 comments

Comments

@bigbernmcraken
Copy link

Going through the configuration steps on a Pi 4 with Rasbian, and once I attempt the 'npm install' command in the 'client' folder, the install will error out with python issues and invalid syntax messages. Before it errors out there are a lot of warnings of deprecated packages so some things may just need to be updated
Screenshot_20220525-102558_JuiceSSH
Screenshot_20220525-102615_JuiceSSH
.

@Mrjohns42
Copy link
Owner

Thanks for bringing this forward. I don’t have a RPi4 to troubleshoot this but the logs seem to indicate it might be a python version issue.

Sometime between the creation of this project and now, OS's started shipping with Python3 as the default. The log seems to be looking for a 'python2' executable and then falling back to 'python' (which is likely symlinked to python3). This explains why that print statement gives a syntax error as it's using the Python2 print syntax.

The first thing I'd try is installing python2.

@bigbernmcraken
Copy link
Author

Thank you for the help. I was able to install python2 and get further in the client install process, but now I'm halted and the following point.

Screenshot_20220525-131550_JuiceSSH
Screenshot_20220525-131516_JuiceSSH

@Mrjohns42
Copy link
Owner

Halted as in the process hung? For how long?

Also is there any more to this error log? I'm not seeing any messaging indicating the issue.

@bigbernmcraken
Copy link
Author

Sorry. Halted as in it errored out again. I will pull the error log and send it over soon.

@bigbernmcraken
Copy link
Author

Sorry for the delay. Log file attached

log.txt
.

@Mrjohns42
Copy link
Owner

y'know I'm really not a npm expert, but going off the error at the top of that log:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'karma@1.7.1',
npm WARN EBADENGINE required: { node: '0.10 || 0.12 || 4 || 5 || 6 || 7 || 8' },
npm WARN EBADENGINE current: { node: 'v16.15.0', npm: '8.5.5' }
npm WARN EBADENGINE }

It looks like you need to downgrade your node version or upgrade the karma dependency.

Funny enough, that version of karma appears to have a recently discovered vulnerability. So perhaps try manually upgrading it version 6.3.16 or later in client/package.json, like so:

"dependencies": {
"karma": ">=6.3.16"
}
"devDependencies": {
"karma": ">=6.3.16"
}

@bigbernmcraken
Copy link
Author

Thanks for the guidance. I was able to get everything updated and running, but when I browse to the app it only seems to be pulling date and time correctly and not grabbing the weather or thermostat data. Is there a log somewhere where I can see if there are any errors?

@Mrjohns42
Copy link
Owner

Great news! Please describe what changes you made for future readers. Consider making a PR as well.

If you exit out of fullscreen (F11), you'll see the terminals running each component. There are also steps in the README to run each part separately. The server does require some setup/config for API access before it will serve up weather/thermostat data.

@bigbernmcraken
Copy link
Author

I'm attempting to use the Pi as a web server to serve up the Weatherdash dashboard, so I'm not running it full screen on the pi and instead viewing it from a browser to the pi address. I have the server configured with the necessary tokens and API keys, and when the server starts up it says it's able to refresh and update successfully, so im assuming I have a disconnect between the client and server or something like that.

@Mrjohns42
Copy link
Owner

Well, depending on how you launched the server component, the executable will log wherever you ran it.

@bigbernmcraken
Copy link
Author

I used the npm start command. Would the info be in .npm logs or elsewhere?

@Mrjohns42
Copy link
Owner

It should just be logging to stdout

@bigbernmcraken
Copy link
Author

Hmmm. Server output seems fine. It's getting successful updates at regular intervals.

@bigbernmcraken
Copy link
Author

Idk if this makes a difference, but if I try to run the startup bash script with both client and server running, it does show a connection error when trying to hit the server.

@Mrjohns42
Copy link
Owner

The startup script launches everything (server, client host, and browser with client), so if you had those running already, an error doesn't seem too unexpected.

If the server is fine, check the output for the client host process, and also the client itself (via the console in your browser's dev tools).

@bigbernmcraken
Copy link
Author

I was thinking, does the ecobee portion have the ability to specify which thermostat its reading from? I have 2 in the house, which may contribute to why that part isn't populating.

@Mrjohns42
Copy link
Owner

Mrjohns42 commented May 27, 2022 via email

@bigbernmcraken
Copy link
Author

Oh. I'll have to look for that again. I've been looking through the responses in Chrome dev tools and it looks like even when my server is on it is refusing connection. I tried to hit one of the server api call endpoints directly and I get a "Cannot GET /api/settings" message.

@bigbernmcraken
Copy link
Author

Sorry for all the messages. I think I'm getting closer but I need to make a config adjustment to how the API calls are made, specifically to change the CORS policy. Could you point me in the right direction of those calls?

@Mrjohns42
Copy link
Owner

No worries. Sounds like you're really close, so I'm rooting for you.

https://github.com/Mrjohns42/WeatherDash/blob/master/server/index.js#L31

@bigbernmcraken
Copy link
Author

That did it! She's running well now. Thank you so much for your help. I will work on putting together some documentation for the update steps I performed and such to help future users.

One more question around functionality, though. Do you think it would be a huge lift to allow the app to make thermostat changes? I can tinker with it since I know the ecobee api allows for that functionality, but I didn't know if that's something you toyed with while working on this. Ideally I would love to turn this into something I can browse to on an old tablet and mount in the guest room so visitors can adjust the temp without having to go to another floor.

@Mrjohns42
Copy link
Owner

Mrjohns42 commented May 27, 2022

So glad to hear! I will await your followup documentation before closing out this issue.

Allowing the UI to make thermostat changes definitely seems doable. You'll have to make sure your Ecobee access token has the right permissions for that.

Assuming you know a little Angular/HTML/CSS, you'd have to add a new UI element. Perhaps tapping the Target numbers brings up a dialog with options to turn your thermostat on/off and set a target temp. Check out the dialog when you tap to the location on the Outdoor section as an example:

https://github.com/Mrjohns42/WeatherDash/blob/master/client/src/app/weatherdash/weatherdash.component.html#L80
https://github.com/Mrjohns42/WeatherDash/blob/master/client/src/app/weatherdash/weatherdash.component.ts#L161

The client would then need to issue a command to the server to use the Ecobee API to change the thermostat settings. If you know a little Node.js, then it'd be easy add a REST endpoint in the server to receive the command from the client, and then call the Ecobee API. Below is an example Ecobee API call:

https://github.com/Mrjohns42/WeatherDash/blob/master/server/apis.js#L221

I'll happily consider your PR if you get it working.

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