项目介绍

Wuty-zju/ha_ninebot 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,目前获得 24 个 Star、4 次 Fork。

仓库全名
Wuty-zju/ha_ninebot
Star 数
24
Fork 数
4
未关闭 Issue
1

README 摘要

Ninebot Integration for Home Assistant English | 简体中文 A custom integration to connect Ninebot cloud devices into Home Assistant. Maintainer: Wuty-zju HACS Listing Status This repository is available via HACS Custom Repository. It is not listed in HACS Default yet. Integration Description This integration provides vehicle-focused entities for Ninebot cloud devices, including: Main battery level and remaining range…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ha_ninebot 用什么语言开发?

主要使用 Python 编写,目前有 24 个 Star。

如何获取 ha_ninebot 的源码?

可以直接克隆仓库:git clone https://github.com/Wuty-zju/ha_ninebot.git,默认分支为 main;安装与运行步骤见仓库 README。

ha_ninebot 最近还在维护吗?

仓库最近一次更新为 2 周前,当前有 1 个未关闭 Issue;Star 数为 24,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

Home Assistan integration for Ninebot vehicles.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
33
价值分
15
活跃状态
活跃

语言占比

Python

Release

贡献者

README

Ninebot Integration for Home Assistant

Ninebot Logo

version releases stars issues HACS

English | 简体中文

A custom integration to connect Ninebot cloud devices into Home Assistant.

Maintainer: Wuty-zju

HACS Listing Status

This repository is available via HACS Custom Repository.

It is not listed in HACS Default yet.

Integration Description

This integration provides vehicle-focused entities for Ninebot cloud devices, including:

  • Main battery level and remaining range
  • Vehicle lock state (read-only lock + binary lock state)
  • Charging status and main power status
  • GSM signal metrics (CSQ and converted RSSI)
  • Vehicle location, report timestamp/time, SN, name, and vehicle image

Requirements

  • Home Assistant Core >= 2024.4.0

Installation

One-click install:

Open your Home Assistant instance and open this repository in HACS.

Or add manually in HACS:

  1. Open Home Assistant -> HACS -> Integrations
  2. Open menu (three dots) -> Custom repositories
  3. Repository URL: https://github.com/Wuty-zju/ha_ninebot
  4. Category: Integration
  5. Search Ninebot and click Download
  6. Restart Home Assistant
  7. Go to Settings -> Devices & Services -> Add Integration -> Ninebot

Method 2: Manual copy

  1. Copy custom_components/ninebot into your Home Assistant config/custom_components directory
  2. Restart Home Assistant
  3. Add integration from UI

Quick Start

  1. Add integration: Settings -> Devices & Services -> Add Integration -> Ninebot
  2. Enter account and password
  3. Choose language and polling options
  4. Save and wait for first sync

Multiple accounts are supported. Each account creates one config entry and one coordinator instance.

Configuration Options

All options are available in initial setup and in options flow later.

  • default_scan_interval (seconds, default 60): normal polling interval per vehicle
  • unlocked_scan_interval (seconds, default 3): polling interval when one vehicle is unlocked
  • charging_scan_interval (seconds, default 30): polling interval when one vehicle is charging
  • token_refresh_interval_hours (hours, default 24): forced token check/refresh cycle
  • device_list_refresh_interval_hours (hours, default 24): device list refresh cycle
  • max_device_info_concurrency (default 3): max concurrent device dynamic info requests
  • device_info_failure_tolerance (default 3): allowed consecutive failures before marking one vehicle unavailable
  • debug (default off): enables extra diagnostics in memory only

Canonical Entity Contract

Recommended entity identifier format:

<domain>.ninebot_<vehicle_sn_lower>_<english_entity_name>

Example:

  • sensor.ninebot_2pde42522j0242_battery
  • binary_sensor.ninebot_2pde42522j0242_vehicle_lock

Status semantic rules:

  • Raw status=0 means locked, status=1 means unlocked
  • In binary locked sensor, use inverted boolean for locked semantics
  • Read-only lock entity mirrors status and must not send lock/unlock commands

Architecture

Implementation mapping:

  • custom_components/ninebot/api.py: auth cache, device list cache, async multi-device fetch
  • custom_components/ninebot/coordinator.py: per-vehicle scheduler, boost policy, failure fallback orchestration
  • custom_components/ninebot/storage.py: persistent account/runtime data and migration-safe Store layer
  • custom_components/ninebot/config_flow.py: setup/options for polling, cache, concurrency, tolerance
  • custom_components/ninebot/const.py: option keys/defaults and polling constants

Key mechanisms:

  • Token cache with periodic refresh and re-login fallback
  • Device list cache with periodic refresh and error-triggered force refresh
  • Persistent Store for account/runtime data, while debug payload stays memory-only
  • Async concurrent per-vehicle requests with semaphore limit
  • Per-vehicle scheduler with unlocked/charging/default interval priority
  • Failure tolerance with cache fallback before availability degradation

Release and Update

Current release target: v1.0.1.

Recommended flow:

  1. Bump version in custom_components/ninebot/manifest.json
  2. Commit and push to main
  3. Create and push matching tag, for example:
git tag v1.0.1
git push origin v1.0.1
  1. Create GitHub Release notes for that tag

HACS detects updates from tags/releases.

Repository Layout

  • Integration code: custom_components/ninebot
  • HACS metadata: hacs.json

评论

暂无评论