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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kesi

v1.0.3

Published

AIRIOT 安装程序 - 自动下载、配置和运行

Downloads

307

Readme

kesi

AIRIOT 通用驱动/服务安装程序 - 自动下载、配置和运行 AIRIOT 驱动和服务

快速开始

使用 npx(推荐)

# 安装并运行指定驱动或服务
npx kesi <名称>

# 示例:安装 Modbus 驱动
npx kesi modbus

# 示例:安装 AIRIOT 服务
npx kesi airiot

# 示例:安装 OPC-UA 驱动
npx kesi opcua

# 传递数据配置(仅驱动)
npx kesi modbus -d '{"id":"设备ID","name":"modbus","groupId":"分组ID","driverType":"modbus","runMode":"one","device":{"settings":{"interval":60,"ip":"设备IP","port":502,"unit":1}},"autoReload":{"disable":true},"autoUpdateConfig":true,"tables":[{"id":"modbus2","device":{"settings":{"autoAddr":true,"interval":5,"ip":"设备IP"},"tags":[{"area":3,"dataType":"Int32BE","id":"p1","name":"p1","offset":1,"policy":"save"}],"commands":[{"name":"cmd1","ops":[{"area":"coil","dataType":"Boolean","offset":1,"param":"cmd1"}]}]},"devices":[{"id":"modbus21","name":"modbus21","settings":{"unit":7}}]}]}'

# 强制更新到最新版本
npx kesi modbus --update

全局安装

# 全局安装
npm install -g kesi

# 运行驱动或服务
kesi <名称>

命令参数

| 参数 | 简写 | 说明 | |------|------|------| | <名称> | - | 要安装的驱动或服务名称(必需) | | --data <json> | -d | 传递 data.json 配置数据(仅驱动) | | --update | -u | 强制重新下载并更新 |

支持的类型

kesi 支持安装两种类型:

驱动 (driver)

  • 数据采集驱动程序
  • 需要配置 config.yaml
  • 支持 -d 参数传递数据配置

服务 (server)

  • AIRIOT 平台服务
  • 使用安装包自带的 service.yaml
  • 不支持 -d 参数

常用项目

驱动:

  • modbus - Modbus TCP 驱动
  • opcua - OPC UA 驱动
  • mqtt - MQTT 驱动

服务:

  • airiot - AIRIOT 核心服务
  • 更多服务请查看 API

运行方式

驱动和服务会根据平台自动选择运行方式:

  • macOS/Windows: 使用 PM2 运行二进制文件
  • Linux: 使用 Docker 运行容器

自动启动

macOS/Windows (PM2):

  • PM2 启动后会自动保存进程列表
  • 如需开机自启动,请在首次安装后运行:
    npx pm2 startup
    然后按照提示执行生成的命令

Linux (Docker):

  • Docker 容器默认配置为 --restart unless-stopped
  • 容器会在系统重启后自动启动
  • 确保 Docker 服务已启用开机自启动:
    sudo systemctl enable docker

配置文件

驱动配置

驱动启动时会自动生成 etc/config.yaml 配置文件:

http:
  host: 0.0.0.0
  port: 8080

driverGrpc:

mq:
  type: local
  local:
    logPublish: true
    logConsume: true
    showPayload: false

driver:
  id: <项目名称>
  name: <驱动显示名称>
  timeout: 10
  idle: 30

服务配置

服务使用安装包自带的 service.yaml 配置文件,包含完整的服务配置(数据库、缓存、MQ、认证等)。

目录结构

airiot/lib/<group_name>/<名称>/
├── .version          # 当前安装版本
├── archive/          # 下载缓存
└── extracted/        # 程序文件
    ├── etc/
    │   └── config.yaml 或 service.yaml
    └── <程序文件>    # 二进制文件

其中 <group_name> 是项目的分组名称(driverserver),根据 API 返回的 group_name 字段自动确定。

运行方式

驱动会根据平台自动选择运行方式:

  • macOS/Windows: 使用 PM2 运行二进制文件
  • Linux: 使用 Docker 运行容器

自动启动

macOS/Windows (PM2):

  • PM2 启动驱动后会自动保存进程列表
  • 如需开机自启动,请在首次安装后运行:
    npx pm2 startup
    然后按照提示执行生成的命令

Linux (Docker):

  • Docker 容器默认配置为 --restart unless-stopped
  • 容器会在系统重启后自动启动
  • 确保 Docker 服务已启用开机自启动:
    sudo systemctl enable docker

前置要求

macOS/Windows:

npm install -g pm2

Linux:

# 安装 Docker
curl -fsSL https://get.docker.com | sh

配置文件

驱动启动时会自动生成 etc/config.yaml 配置文件:

http:
  host: 0.0.0.0
  port: 8080

driverGrpc:

mq:
  type: local
  local:
    logPublish: true
    logConsume: true
    showPayload: false

driver:
  id: <项目名称>
  name: <驱动显示名称>
  timeout: 10
  idle: 30

目录结构

airiot/lib/<group_name>/<项目名称>/
├── .version          # 当前安装版本
├── archive/          # 下载缓存
└── extracted/        # 驱动文件
    ├── etc/
    │   └── config.yaml
    └── <项目文件>    # 二进制文件

其中 <group_name> 是驱动的分组名称(如 driver),根据 API 返回的 group_name 字段自动确定。

故障排除

端口被占用

如果 8080 端口被占用,驱动会自动使用下一个可用端口(8081、8082...)。

驱动不存在

如果指定的项目名称不存在,会显示错误信息:

错误: 未找到驱动: xxx

请检查项目名称是否正确,或使用 --list 参数查看所有可用项目。

PM2 相关问题

# 查看 PM2 运行状态
pm2 list

# 查看 PM2 日志
pm2 logs <项目名称>-driver

# 停止驱动
pm2 stop <项目名称>-driver

# 重启驱动
pm2 restart <项目名称>-driver

# 删除驱动
pm2 delete <项目名称>-driver

# 配置开机自启动(仅首次需要)
npx pm2 startup

# 保存当前进程列表
pm2 save

Docker 相关问题

# 查看运行中的容器
docker ps

# 查看容器日志
docker logs <项目名称>-driver

# 停止容器
docker stop <项目名称>-driver

# 删除容器
docker rm <项目名称>-driver

版本管理

驱动会自动从 API 获取最新版本信息:

  • 首次运行:自动下载对应平台版本
  • 版本相同:使用已缓存的文件
  • 使用 --update 参数:强制重新下载最新版本

许可证

MIT

支持