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

vanbike-lib

v1.0.0

Published

Access VanMoof Bikes without App

Downloads

2

Readme

VanBike-Library

Latest Release GitHub stars Downloads Open Issues Closed Issues

Allows direct access to VanMoof Bikes Bluetooth-API in Javascript using the Web-Bluetooth-API.

Features

  • Retrieve Parameters (Battery, Distance, Settings, ...)
  • Retrieve Firmware/Hardware/Software/Model/Serial Number
  • Start Bike-Module
  • Unlock Bike
  • Set Region Settings
  • Set Lightning Settings
  • Set Power Level
  • Set Units
  • Show Firmware
  • Reset Distance
  • Pair Remote
  • Error Logging
  • Set Offroad Mode
  • Update Firmware (not implemented)
  • ...

Compatibility

Bikes

  • Electrified S/X 1 (2016/2017) - tested
  • Smart S/X 1 (2018) - unsupported (profile missing)
  • Electrified S/X 2 - untested (some parameters/functions missing)
  • Electrified S/X 3 - untested (some parameters/functions missing)

Browsers

See full list.

Desktop
  • Chrome
    • Mac: >56
    • Linux: >56
    • Windows: >70
  • Edge: >79
  • Firefox: unsupported
  • Internet Explorer: unsupported
  • Opera
    • Mac: >43
    • Linux: >43
    • Windows: >57
  • Safari: unsupported
Mobile
  • Android webview: unsupported
  • Chrome for Android: >56
  • Firefox for Android: unsupported
  • Internet Explorer: unsupported
  • Opera for Android: >43
  • Safari on iOS: unsupported
  • Samsung Internet: >6.0

Usage

Install

Download pre build file from GitHub-Releases or add via NPM.

# Yarn
yarn add poket-jony/vanbike-lib

# NPM
npm i poket-jony/vanbike-lib

Build

# Development
yarn dev

# Production
yarn prod

ES6

import { VanBikeService, ElectrifiedSX1Profile, ModuleStateEntity, LockStateEntity } from 'vanbike-lib';
const bikeProfile = new ElectrifiedSX1Profile();
const vanBikeService = new VanBikeService(bikeProfile, 'ENCRYPTION-KEY');

Browser

<script type="text/javascript" src="/dist/vanbike-lib.js"></script>
const bikeProfile = new VanBikeLib.ElectrifiedSX1Profile();
const vanBikeService = new VanBikeLib.VanBikeService(bikeProfile, 'ENCRYPTION-KEY');
const ModuleStateEntity = VanBikeLib.ModuleStateEntity;
const LockStateEntity = VanBikeLib.LockStateEntity;

Example

For more examples see example folder.

// Event listener
vanBikeService.subscribe((parameters) => {
    console.log(parameters);
});

// Connect
await vanBikeService.connect();

// Authenticate
await vanBikeService.authenticate();

// Turn on
const moduleState = new ModuleStateEntity();
moduleState.setState(moduleState.STATE_ON);
await vanBikeService.setModuleState(moduleState);

// Unlock
const lockState = new LockStateEntity();
lockState.setState(lockState.STATE_UNLOCKED);
await vanBikeService.setLockState(lockState);

// Disconnect
vanBikeService.disconnect();

Documentation

VanBikeService

  • constructor(encryptionKey : string) : void
  • getBluetoothService() : BluetoothService
  • connect() : Promise
  • disconnect() : void
  • isConnected() : bool
  • subscribe(callback : function) : Number
  • unsubscribe(handleIndex) : void
  • authenticate() : Promise
  • setModuleState(ModuleStateEntity moduleState) : Promise
  • setLockState(LockStateEntity lockState) : Promise
  • setLightningState(LightningStateEntity lightningState) : Promise
  • setPowerLevelState(PowerStateEntity powerState, RegionStateEntity regionState) : Promise
  • setUnitState(UnitStateEntity unitState) : Promise
  • showFirmware() : Promise
  • resetDistance() : Promise
  • pairRemote() : Promise
  • enableErrors() : Promise
  • disableErrors() : Promise
  • setOffroadMode() : Promise

Todo:

  • startFirmwareUpdate(FirmwareEntity firmware) : Promise
  • stopFirmwareUpdate() : Promise

Notice

This project is not related to VanMoof. The guarantee expires with use.

CORS Policy

The WebService calls the VanMoof API directly. This is probably not possible in Browsers because of CORS-Policy. Use a workaround with the Chrome-Plugin: Allow CORS: Access-Control-Allow-Origin. Or use this service from NodeJS.

License

MIT