Skip to content

Class to facilitate monitoring line crossings in Zwift basedon PlayerState messages (see zwift-mobile-api).

Notifications You must be signed in to change notification settings

wiedmann/zwift-line-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zwift-line-monitor

A class that monitors Zwift player updates and emits events whenever riders pass preconfigured lines.

This library is intended to work with the wrapped status messages from zwift-mobile-api.

The source of the rider status messages could be modules such as zwift-second-screen or zwift-packet-monitor.

Note that lines may be added using either a fractional roadTime or an integer value from 5000-1005000. The fractional values are adjusted internally to the integer values by multiplying by 1000000 and adding 5000. It is assumed the roadTime values in the rider statuses use this format of roadTimes.

Usage

$>  npm install --save zwift-line-monitor
const ZwiftLineMonitor = require('zwift-line-monitor');
const monitor = new ZwiftLineMonitor()

// add line: id, name, world id, road id, roadtime
monitor.addLine(5, 'Watopia Arch', 1, 0, 0.9829)

monitor.on('crossing', (crossing) => {
  console.log(crossing)
})

monitor.updateRiderStatus(state1)
monitor.updateRiderStatus(state2)

About

Class to facilitate monitoring line crossings in Zwift basedon PlayerState messages (see zwift-mobile-api).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published