资料介绍
软件简介
homebridge-script2
Execute custom scripts via homekit apps.
Core of the code written by @xxcombat. Great plugin that has served me well. Original plugin homebridge-script.
Because it appears that the original homebridge-script plugin has stopped being maintained and supported and PR's are also not being accepted. I've updated it to allow for executing a state script or work by checking for the existance of a file. Thanks to @ybizeul for the code snipet that allows for state.sh to execute. This plugin also works with the latest file-exists that broke the original plugin. While this fork depends on file-exists there is no need to install it seperately for this fork, as i've included it as a dependency.
Installation
(Requires node >=6.0.0)
-
Install homebridge using:
npm install -g homebridge -
Install this plugin using:
npm install -g homebridge-script2 - Update your configuration file. See examples below that show the plugin working by using filestate for current state check as well as an example using state.sh script for current state check.
- Make sure scripts have been made executable (chmod +x scriptname.sh) and also accessible by the homebridge user.
For autostart homebridge with OSX copy com.homebridge.startup.plist to /Library/LaunchDaemons
Homebridge-script configuration parameters
| Name | Value | Required | Notes |
|---|---|---|---|
accessory |
"Script2" | yes | Must be set to "Script2" and is required |
name |
(custom) | yes | Name of accessory that will appear in homekit app and is required |
on |
(custom) | yes | Location of script to execute the on action and is required |
off |
(custom) | yes | Location of script to execute the off action and is required |
fileState |
(custom) | fileState or state is required (see note) | Location of file that flags on or off current state. If this is configured the plugin will use the existence of this file to determine the current on or off state. If file exists, accessory is determined to be on. If file does not exist, accessory is determined to be off. This is not required. But if set, it will override using the state script. fileState or state must be configured. Use full path when setting this it's value. Do not use "~/". |
state |
(custom) | fileState or state is required (see note) | Location of script to execute the current state check. It must output to stdout the current state. It is not required if fileState is being used instead. fileState or state must be configured. |
on_value |
(custom) | no* (see note, default set to "true") | Used in conjunction with the state script. If using the state script this is the value that will be used to match against the state script output. If this value matches the output, then the accessory will be determined to be on. Required if using state script. |
unique_serial |
(custom) | no (default set to "Script2 Serial number") | If you have more than one "accessory" configured, please set unique values for each accessory. Unique values per accessory required for the Eve app. |
Configuration
Configuration example 1, using filestate for current state check:
"accessories": [
{
"accessory": "Script2",
"name": "RPC3 Socket 1",
"on": "/var/homebridge/rpc3control/on.sh 1",
"off": "/var/homebridge/rpc3control/off.sh 1",
"state": "/var/homebridge/rpc3control/state.sh 1",
"fileState": "/var/homebridge/rpc3control/script1.flag",
"on_value" : "true",
"unique_serial" : "1234567"
}
]
Notes
Using the above configuration as an example:
- The on.sh script executes when you turn on the accessory via a homekit app. (In this case we are the using existence of a file to determine on or off current state, so you must insure the on.sh script creates the configured fileState file.
- The off.sh script executes when you turn off the accessory via a homekit app. ( In this case we are using existence of a file to determine on or off current state, insure the off.sh script deletes the configured fileState file.)
- The state.sh script in this case would not execute as fileState parameter overrides its use.
- The configured fileState file is used as a flag. When the homekit app checks for current state it checks for the existence of this file. If it exists, current state is on. If it does not exist, current state is off.
- The on_value in this case is not being used as it is only used when the state script is used to check for current state.
Configuration example 2, executing state.sh script for current state check:
"accessories": [
{
"accessory": "Script2",
"name": "Alarm of bike",
"on": "~/on.sh",
"off": "~/off.sh",
"state": "~/state.sh",
"on_value" : "true",
"unique_serial" : "1234567"
}
]
Notes
Using the above configuration as an example:
- The on.sh script executes when you turn on the accessory via a homekit app. (In this case we are executing a state script to determine on or off current state.)
- The off.sh script executes when you turn off the accessory via a homekit app. ( In this case we are executing a state script to determine on or off current state.)
- The state.sh script in this case would be executed to check current state. Insure that this script outputs to stdout the matching on value as configured by the on_value config parameter. If the on_value matches the on value output of this script then the accessory will be determined to be on.
- The configured fileState file is not used in this example. Because it was not configured, the state script is being used.
- The on_value in this case is used to match against the state script output. If the value matches the output of the state script, the accessory is determined to be on.
- TPS659xx应用程序自定义工具
- 创建自定义的基于闪存的引导加载程序(BSL)
- labview超快自定义控件制作和普通自定义控件制作 13次下载
- 创建自定义Kria KV260加速ML应用程序
- labview自定义控件 18次下载
- 应用程序在崩溃时能启动自定义活动的OHOS库 0次下载
- 自定义视图组件教程案例 14次下载
- Labview自定义右键快捷菜单功能实用小技巧 26次下载
- 串口屏LUA教程10-自定义串口指令
- 远程网络处理器应用程序和与自定义应用程序的详细资料免费下载 3次下载
- 远程网络处理器应用程序的详细资料免费下载 7次下载
- 自定义鼠标光标 2次下载
- 1602自定义字符 1次下载
- 自定义函数测试学习工程
- matlab自定义函数调用的方法
- 469次阅读
- 714次阅读
- 2163次阅读
- 1784次阅读
- 1216次阅读
- 846次阅读
- 1484次阅读
- 1481次阅读
- 2947次阅读
- 3191次阅读
- 如何给EOS账号设置自定义权限 1496次阅读
- Qt自定义窗口部件的创建 2435次阅读
- 4667次阅读
- erlang如何自定义_ERLANG环境搭建 1527次阅读
- LCD1602自定义点阵字符详解 1.3w次阅读
下载排行
本周
- 1NB-IoT芯片厂商的资料说明
- 0.31 MB | 22次下载 | 1 积分
- 2智慧监狱建设的核心终端—智慧监仓屏
- 0.25 MB | 2次下载 | 免费
- 3PC318C016M/D 200V半桥栅极驱动器技术手册
- 0.77 MB | 2次下载 | 免费
- 45.0SMDJ200A单向TVS瞬态抑制二极管规格书
- 0.88 MB | 1次下载 | 免费
- 5PC318C041EQ 200V半桥栅极驱动器技术手册
- 0.50 MB | 次下载 | 免费
- 6PC318C042NM 200V半桥栅极驱动器技术手册
- 0.55 MB | 次下载 | 免费
- 7技嘉H110主板IT8628E_BX IO电路图资料
- 2.61 MB | 次下载 | 1 积分
- 8H110主板CPU PWM芯片ISL95858HRZ-T核心供电电路图资料
- 0.63 MB | 次下载 | 1 积分
本月
- 1元宇宙深度解析—未来的未来-风口还是泡沫
- 6.40 MB | 241次下载 | 免费
- 2元宇宙底层硬件系列报告
- 13.42 MB | 184次下载 | 免费
- 32022 年展望報告 – 半導體產業
- 1.43 MB | 136次下载 | 免费
- 4晶振与滤波器应用电路《电子工程师必备:元器件应用宝典》
- 1.57 MB | 90次下载 | 免费
- 5汽车电子行业深度解析:智能化与电动化方兴未艾
- 6.47 MB | 71次下载 | 免费
- 6中国DPU行业白皮书
- 23.80 MB | 37次下载 | 免费
- 7晶科鑫代理线-微盟电子2021年度产品目录选型手册
- 14.75 MB | 27次下载 | 免费
- 8NB-IoT芯片厂商的资料说明
- 0.31 MB | 22次下载 | 1 积分
总榜
- 1matlab软件下载入口
- 未知 | 935137次下载 | 10 积分
- 2开源硬件-PMP21529.1-4 开关降压/升压双向直流/直流转换器 PCB layout 设计
- 1.48MB | 420064次下载 | 10 积分
- 3Altium DXP2002下载入口
- 未知 | 233089次下载 | 10 积分
- 4电路仿真软件multisim 10.0免费下载
- 340992 | 191425次下载 | 10 积分
- 5十天学会AVR单片机与C语言视频教程 下载
- 158M | 183352次下载 | 10 积分
- 6labview8.5下载
- 未知 | 81602次下载 | 10 积分
- 7Keil工具MDK-Arm免费下载
- 0.02 MB | 73822次下载 | 10 积分
- 8LabVIEW 8.6下载
- 未知 | 65991次下载 | 10 积分
电子发烧友App






创作
发帖
提问
发资料
发视频
上传资料赚积分
评论