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

homebridge-command-bulb

v0.0.2

Published

Shell plugin for Homebridge (API 2.0): https://github.com/nfarina/homebridge

Downloads

1

Readme

homebridge-command-bulb

npm version

在 HomeKit 中创建虚拟设备(灯),映射灯的亮度值到自定义的脚本上

Need I Say More?

Yeah:搭配「场景」使用,可以自定义语音指令,可参阅 歪用 HomeKit 让 Siri 更「听话」

配置

Homebridge 配置如下:

{
    "platforms": [
        {
            "platform": "CommandPlatform",
            "directory": "~/.homebridge/commands",
            "tg_token": "",
            "tg_chat_id": "",
            "proxy": "http://localhost:8888"
        }
    ]
}
  • 需要自己创建 Shell 脚本目录,默认为~/.homebridge/commands
  • Telegram token 需要通过 @BotFather 申请;chat id 可以通过 @get_id_bot 获取
  • 插件连接 Telegram 通常需要 proxy,请科学解决。如果是 socks proxy 的话可以用 privoxy 转换为 http proxy

重启 Homebridge 后会添加两个灯,「Command Bulb」和「Probe Bulb」,前者用于执行命令,后者用于排除模糊指令干扰(没有其它用处,请无视它的存在)

脚本规则

脚本应具有可执行权限,约定先于配置,脚本前缀、后缀采用如下规则:

  • 前缀(前两位,01 - 99)用于映射亮度,比如「01」对应亮度为 1,此外,所有前缀为「01」的脚本都会被执行,可以一次执行多个独立脚本。预留了亮度为 0 和 100 两个值用于标识「成功 / 失败」,所以不要用「00」作为前缀
  • 后缀用于辅助功能,目前是用于 Telegram 推送消息(在配置了相关参数的情况下)
    • 「.ok」表示执行成功时推送「Command: xxx OK!」。注意,默认情况下,执行过程中存在 stderr 不会被认为是失败
    • 「.out」表示推送 stdout
    • 「.err」表示推送 stderr,并且执行过程中存在 stderr 会被认为是失败
    • 如果失败,总是会推送「Command: xxx Failed!」消息,无需后缀
    • 多个后缀可组合,如「.ok.out」,会推送成功和标准输出两条消息
    • 其它未定义的及「.sh」可有可无,会忽略