I build a Zwift connected fan

(Rogerio Costa) #41

| // Zwift username |
|   | module.exports.username = “neoprotheus@msn.com”;  (email???) |
|   | // Zwift password |
|   | module.exports.password = “123456”; (exemple) |
|   | // Zwift player id (find the playerId on your PC running the Zwift client. There is a folder named userXXXXXX. These |
|   | // numbers are the playerId.) |
|   |

module.exports.playerId = “123456”;  (numbers only)

thanks again


(Sebastian Linz) #42

Hi Rogerio ,

Yes, username is the same you use to logon on zwift. Your password on zwift and only the digits as player id. Hope it’s going to work now. Looking forward reading about your success.
Ride on

(Rogerio Costa) #43

Hi Sebastian

error code:
GET /getFanLevel 200 19.567 ms - 28
Wed Jul 25 2018 06:35:27 GMT-0300 (GMT-03:00) - error: couldn’t resolve promise riderStatus


please help me again


(Sebastian Linz) #44

Hi Rogerio,

I assume something with your credentials. Please check username, password and player-id. You can tryout the player-id of another rider just for testing. You find random online player-Id in logs. In first lines after starting the node-app there is a line …player-id. You can use this player-Id just for testing the app. You use this with your credentials. They are for authorization purpose. Using the fan with another’s player-id wouldn’t make sense. I just use to see if everything is working fine even if I am not riding. I don’t like to sit in front of my notebook sweating in bibshorts. Good luck!
Best regards,

(Rogerio Costa) #45

Hi Sebastian,

when I start “npm start” this error appears:

SyntaxEditor Code Snippet

Thu Jul 26 2018 05:41:52 GMT-0300 (GMT-03:00) - debug: ZwiftAdapter.constructor()
(node:3272) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
 at JSON.stringify (\<anonymous\>)
 at ZwiftAdapter.account.getWorld.riders.then.catch.error (C:\FanControl-master\ZwiftAdapter.js:17:35)
 at process.\_tickCallback (internal/process/next\_tick.js:68:7)
(node:3272) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:3272) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The fan works in I, II or III but in "simulation" or "workout" this error appears:
Thu Jul 26 2018 05:32:26 GMT-0300 (GMT-03: 00) - Error: could not resolve promise riderStatus

thanks and sorry


(Sebastian Linz) #46

Hi Rogerio,
unfortunately I don’t have access to my computer next days. Maybe you want to try out by commenting out all lines and add them one by one to find out what’s going wrong. I’m sorry I have no better idea for the moment.
Best regards,

(Rogerio Costa) #47

I deleted everything and started again and it worked!
thank you so much
you are nice guy
ride on!

(Christian Lyra) #48


Thank you! For now I’m just using it to turn the fan on/off since i didn’t built the whole hardware part (but I have a wifi plug). I’m also using it slightly different than you. Zwift-mobile-api is running in a docker container. The developer was very kind and with just one uncommented line the api shows the results in a json which is just perfect to integrate with home-assistant (home-assistant.io) which already control my fan. Now my zwift stats appears as sensors in home-assistant, so I could use automations like this : if the room temp is > x and heartrate > y turn on the fan.  Next level will be building the hardware part or adapting a sonoff ifan.

1 Like