Ninebot Scooter integration

Hello guys,

i reverse engeering the ninebot by Segway app for integration in HA.
They use certifikate pinning and only trust system certifikates.
I used charles proxy and decrypted the login and data from the ninebot servers.

The caputred files can be found here: Github

At this time I can get access and refresh tokens from ninebot’s app servers.
But can not get data from ninebot servers, maybe somone can help me.

1 Like

It looks like the ninebot app builds a one time token for fetching data. The used token isn’t usable anymore.
I don’t now how build this one time token.

You still around on this topic?

Hi, has anyone already tested this:
ownbee/ninebot-integration: Ninebot Scooter integration for Home Assistant (github.com)
A Cloud integration would also be usefull but I found nothing until now.

Got any luck integrating ninebot into HA?

Hi everyone, wanted to share my progress which isn’t perfect but good enough for what I need.

Ownbee’s integration was foked by JoeyGE0 GitHub - JoeyGE0/ninebot-integration: Ninebot Scooter integration for Home Assistant and it works. Unfortunately it doesn’t update the values, but if you disable the integration and re-enable it, it will update the values 1 time. Spook integration from HACS allows for these actions.

Played with this for a bit and came up with the following integration. The premise is this - my scooter is hooked up to a smart plug with power monitoring capability. When the plug turns on (at a specific time in a separate automation), every 20 minutes (not the most efficient code) that the voltage is higher than a specific amount my automation gets triggered. The automation disabled the integration, re-enables it and checks the battery %. If its over 85% it turns off the smart plug. The thing that seems to make this work is when the charger turns on by the smart plug, the scooter connects automatically to BLE, I don’t need to manually turn on the scooter for the integration to connect.

alias: scooter integration charge
description: ""
triggers:
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 20
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 40
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 60
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 80
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 100
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 120
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 140
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 160
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 180
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 200
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 0
      minutes: 220
      seconds: 0
    above: 39.4
    trigger: numeric_state
  - entity_id:
      - sensor.hive_2_power
    for:
      hours: 4
      minutes: 0
      seconds: 0
    above: 39.4
    trigger: numeric_state
conditions: []
actions:
  - action: homeassistant.disable_config_entry
    target: {}
    data:
      config_entry_id: 01JVQV2CB2NHM7S9G4MNW4HYH0
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: homeassistant.enable_config_entry
    target: {}
    data:
      config_entry_id: 01JVQV2CB2NHM7S9G4MNW4HYH0
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - choose:
      - conditions:
          - type: is_battery_level
            condition: device
            device_id: 07b5cf786e5672f078b804bf8a90c872
            entity_id: 57f527b8399e253ad7fd73706344503d
            domain: sensor
            above: 85
        sequence:
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.hive_2
      - conditions:
          - type: is_battery_level
            condition: device
            device_id: 07b5cf786e5672f078b804bf8a90c872
            entity_id: 57f527b8399e253ad7fd73706344503d
            domain: sensor
            below: 85
        sequence: []
mode: single