Closed justvervaart closed 6 years ago
Hi @justvervaart
There are no parts of zwift-mobile-api mentioned in that error message or call stack. It suggests some sort of dns lookup error, which could affect anything that tries to make an internet request (which zwift-mobile-api obviously does via axios and node.js libraries). How stable is your network connection from that device?
Even with a rock solid network though, internet requests sometimes fail. zwift-mobile-api wraps Zwift's api to make it easier for you to call it, but it doesn't attempt to handle errors or anything like that.
I like the project by the way :-)
Thx for the feedback and the compliment. The network is quit stable. For now i made a bash script that relaunches after a crash. Does the job.
until node zwiftfan_script.js; do echo "Zwiftfan crashed! ....respawning..." >&2 sleep 1 done
Congrats on the GCN multi-tool :-)
People in the tinker/makerspace community without real coding skills want to build stuff (like the Smart Fan) for use with Zwift but need a more easy way to call the Zwift API endpoints. I see three options.
ps. there really has only to be 1 endpoint, one that returns all the values from riderStatus (speed, heart rate etc) for any given rider which you can call with the Zwift credentials once per second. If anyone can build this, that would be really nice.
I think option 2 is best.
At it's most basic, zwift-mobile-api only does 2 things:
Call the authentication end-point to get a bearer token and attach it to subsequent API calls as "Authorisation" header.
Decode protobuf data.
The first is just a convenience, and the second should be easy in C/C++: https://developers.google.com/protocol-buffers/docs/cpptutorial
I know this issue is already closed, but just to add: as far as I know there is nothing stopping node.js from running on Arduino and/or Raspberry Pi. A brief web search turns up hits for both.
Never thought of that. Will look into it. Thx!
I use the library in this project https://www.instructables.com/id/Internet-Connected-Fan-for-Use-With-Zwift/ and my javascript crashes every x minutes, but with errors outside my script. Can u tell if the problem lies somewhere in your library? (was very glad to find the library by the way, made my project possible!)