npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zwack

v0.1.8

Published

Simulate an indoor bicycle trainer with BLE (Bluetooth Low Energy)

Downloads

22

Readme

Zwack BLE

Simulate/Implement a Bluetooth Low Energy sensor that can send:

  • Cycling Power and Cadence (CSP Bluetooth profile)
  • Running Speed and Cadence (RSC Bluetooth profile)

Zwack has many possible uses, here are some examples:

  • Simulate an indoor bike trainer (turbo) generating cyclist power and cadence data to test bike computers fitness, or virtual indoor bike apps.
  • Simulate a runner's speed and pace test bike computers fitness, or virtual indoor bike apps.
  • Integrate a common treadmill with Zwift, sending data from the treadmill to the Zwift game via bluetooth

Supports

At this time Zwack runs succesfuly on Mac OSX and Raspberry PI. Should run on Windows but it hasn't been tested. If it works let me know.

Installation

Install from npm

npm i zwack

or clone this repo and run

npm install

You may need to install Xcode on Mac to compile the bleno Bluetooth module.

Debug Flags

You can see a lot of debug information if you run the simulator or your app with the DEBUG environment variable set to

  • csp - Cycling Power and Cadence messages
  • rsc - Running Speed and Cadence messages
  • ble - Bluetooth low energy messages

Example:

DEBUG=rsc npm run simulator

You'll see something similar to this

rsc [Zwack notifyRSC] {"speed":4.4703888888888885,"cadence":180} +0ms
rsc Running Speed: 4.4703888888888885 +2ms
rsc Running Cadence: 180 +0ms
rsc [Zwack notifyRSC] {"speed":4.4703888888888885,"cadence":180} +1s
rsc Running Speed: 4.4703888888888885 +0ms

Using the simulator

Start the simulator by executing:

npm run simulator

On a different machine start your fitness app, bike computer or indoor virtual bike simulation software, like Zwift, and pair up the Zwack BLE sensor. The sensor name should be Zwack, it may have some numbers added to the name or you may see the host name of the computer running zwack. It all depends on the operating system you're uing to run Zwack.

If your indoor biking software does not detect the BLE sensor, disable, then enable, the Bluetooth on the machine where Zwack is running and retry to discover and connect to the sensor again.

The ZwackBLE sensor may show up as Zwack or has the host name of the machine running Zwack. This is normal.

Updating simulation parameters

List of Available Keys
  c/C - Decrease/Increase cadence
  p/P - Decrease/Increase power
  s/S - Decrease/Increase running speed
  d/D - Decrease/Increase running cadence  

  r/R - Decrease/Increase parameter variability
  i/I - Decrease/Increase parameter increment
  x/q - Exit

Pressing c on your keyboard will decrease the cadence, conversly pressing C (upper case) will increase simulated cadence. Same thing for power by pressing p or P.

The variability parameter will introduce some random variability to the cadence and power values, so they don't remain constant all the time. If you lower the variability to 0 the cadence and power values will remain constant.

Press x or q to exit Zwack.

Requirements

Requires NodeJS, and should run in all Bleno (the base BLE module) supported platforms, which are Mac, Windows or Raspberry Pi.

Zwack cannot run on the same computer as the fitness or virtual indoor bike app, you'll need to run them on different systems.

Credits

Initial prototype based on ble-cycling-power code from olympum.