当前位置: 首页 > 软件库 > 其他开源 > 物联网 >

typescript-homebridge-schedule

授权协议 MIT License
开发语言 JavaScript
所属分类 其他开源、 物联网
软件类型 开源软件
地区 不详
投 递 者 印瑾瑜
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Homebridge-Schedule

Automate Homebridge based on interval or cron

CI/CD

This Homebridge plugin allows you to create HomeKit automations for more than just the default "A time of day occurs"

The original thought for this was to create an hourly automation to check my thermostat in the house and send me a notification if it was above or below a certain threshold

Homebridge-Schedule is similar to Homebridge-Dummy, in the sense that it creates some dummy switches in HomeKit that turn on at your desired interval. They will turn off one second later. This is useful for triggering automations, or even shortcuts.

Installation

sudo npm i homebridge-schedule@latest -g

Usage

Interval Based

Add accessories to your config.json similar to below for interval based schedules:

{
  "accessories": [
    {
      "accessory": "Schedule",
      "name": "Hourly",
      "interval": 60
    }
  ]
}
Property Description
Accessory Must be "Schedule"
Name Unique name for the dummy switch
Interval Interval, in minutes

Upon startup of Homebridge, the device will turn on at the specified interval

Notes

The interval starts when Homebridge is started up. If you want something to run hourly on the hour, then you need to make sure Homebridge is started up on the hour

Cron Based

Add accessories to your config.json similar to below for cron based schedules:

{
  "accessories": [
    {
      "accessory": "Schedule",
      "name": "Hourly",
      "cron": "* * * * * *"
    }
  ]
}
Property Description
Accessory Must be "Schedule"
Name Unique name for the dummy switch
Cron Cron string

Cron string details: https://www.npmjs.com/package/cron

Cron string uses seconds, so for an hourly cron string use:

"0 0 * * * *"

"{seconds} {minutes} {hours} {days} {months} {weeks}"

Use Cases

I have created a "room" called Automation in my HomeKit, which then allows me to create an automation "When the Automation Hourly turns on" to check my thermostat temperature, check the current outside temperature at my house, and based on some conditions, set the thermostat.

Steps:

  1. Create new automation based on "An Accessory is Controlled"
  2. Find your newly created dummy switch
  3. Select Turns On and add any desired time or people conditions
  4. You can then choose a scene or another accessory to control, or at the very bottom, you can create a shortcut
  5. Done! You now have one automation for things you want to happen hourly rather than 24

Creating HomeKit Automations

Create new Accessory automation:Step1

Choose the accessory created by homebridge-schedule:Step2

Select when it turns on or turns off and any time or people configurationsStep3

Scroll all the way to the bottom and choose Convert to ShortcutStep4

Create shortcut:

  1. Get the current temperature of a HomeKit thermostat
  2. Convert to Fahrenheit
  3. If the indoor temperature is greater than a threshold
    • Get current weather outside
    • Convert to Fahrenheit
    • If the current weather outside is also above a threshold
      • Turn on fans, set thermostat, etc.

Step5Step5

Development

Clone the latest and run

npm run prep

to install packages and prep the git hooks

 相关资料
  • Homebridge 是一个轻量级 NodeJS 服务器,它模拟 iOS HomeKit API,提供从 HomeKit 到“智能家居”设备制造商提供的各种第三方 API 的基本桥接。通过 Homebridge 的桥接,可以让 Siri 控制完全不支持 HomeKit 的设备。 此外 Homebridge 支持插件。

  • 像函数参数一样,类有时具有可选成员。 同样的语法可以用于class定义: nickName?: string; 在上面的示例中,的实例保证有一个name,并且可以可选地具有nickName。 修饰符 public:类的每个成员默认为,可以自由被访问。 private:类成员被标记为private时就不能在类的外部访问。 继承与多态 封装,继承和多态是面型对象的三大特性。 TypeScript的

  • 类型 接口 形状 装饰 类型 许多人没有意识到这一点,JavaScript中实际上有类型的,但他们只是“鸭子类型”,这大概意味着程序员不必去想它们。TypeScript中也存在JavaScript的类型: boolean (true/false) number整数,浮点数,和NaN []其他类型的数组,如number[]或boolean[] {} 对象字面量 undefined 没有设置 enum

  • homebridge-vsx homebridge-vsx is a plugin made for homebridge,which allows switching on and off your Pioneer AV receiver. All AV receivers (VSX and SC),which work with the iControl AV5 App are support

  • homebridge-sesame Control and monitor your Sesame smart lock with HomeKit integration. Prerequisites Installation of Homebridge iOS 11 or later Sesame lock with enabled cloud integration Sesame Wifi A