資料介紹
軟件簡介
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应用程序自定义工具0次下载
- 创建自定义的基于闪存的引导加载程序(BSL)0次下载
- labview超快自定义控件制作和普通自定义控件制作13次下载
- 创建自定义Kria KV260加速ML应用程序0次下载
- labview自定义控件18次下载
- 应用程序在崩溃时能启动自定义活动的OHOS库0次下载
- 自定义视图组件教程案例14次下载
- Labview自定义右键快捷菜单功能实用小技巧27次下载
- 串口屏LUA教程10-自定义串口指令16次下载
- 远程网络处理器应用程序和与自定义应用程序的详细资料免费下载3次下载
- 远程网络处理器应用程序的详细资料免费下载7次下载
- 自定义鼠标光标2次下载
- 1602自定义字符1次下载
- 自定义函数测试学习工程5次下载
- matlab自定义函数调用的方法88次下载
- 如何添加自定义单板361次阅读
- 如何快速创建用户自定义Board和App工程287次阅读
- AWTK 开源串口屏开发(18) - 用 C 语言自定义命令575次阅读
- TSMaster 自定义 LIN 调度表编程指导911次阅读
- IAR下手动拷贝自定义程序段到RAM中执行的方法分享2456次阅读
- 添加自定义属性控制fridaserver启动和停止2011次阅读
- 什么是自定义序列1353次阅读
- 自定义特性能做什么?950次阅读
- FreeRTOS|自定义裁剪1675次阅读
- 如何自定义函数或局部脚本1606次阅读
- 如何在Vivado中更改自定义的Interface3200次阅读
- 三种自定义弹窗UI组件封装的实现3368次阅读
- 如何给EOS账号设置自定义权限1595次阅读
- Qt自定义窗口部件的创建2509次阅读
- RIO技术之快速设计自定义硬件4816次阅读
下載排行
本周
- 1山景DSP芯片AP8248A2數據手冊
- 1.06 MB | 532次下載 | 免費
- 2RK3399完整板原理圖(支持平板,盒子VR)
- 3.28 MB | 339次下載 | 免費
- 3TC358743XBG評估板參考手冊
- 1.36 MB | 330次下載 | 免費
- 4DFM軟件使用教程
- 0.84 MB | 295次下載 | 免費
- 5元宇宙深度解析—未來的未來-風口還是泡沫
- 6.40 MB | 227次下載 | 免費
- 6迪文DGUS開發指南
- 31.67 MB | 194次下載 | 免費
- 7元宇宙底層硬件系列報告
- 13.42 MB | 182次下載 | 免費
- 8FP5207XR-G1中文應用手冊
- 1.09 MB | 178次下載 | 免費
本月
- 1OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費
- 2555集成電路應用800例(新編版)
- 0.00 MB | 33566次下載 | 免費
- 3接口電路圖大全
- 未知 | 30323次下載 | 免費
- 4開關電源設計實例指南
- 未知 | 21549次下載 | 免費
- 5電氣工程師手冊免費下載(新編第二版pdf電子書)
- 0.00 MB | 15349次下載 | 免費
- 6數字電路基礎pdf(下載)
- 未知 | 13750次下載 | 免費
- 7電子制作實例集錦 下載
- 未知 | 8113次下載 | 免費
- 8《LED驅動電路設計》 溫德爾著
- 0.00 MB | 6656次下載 | 免費
總榜
- 1matlab軟件下載入口
- 未知 | 935054次下載 | 免費
- 2protel99se軟件下載(可英文版轉中文版)
- 78.1 MB | 537798次下載 | 免費
- 3MATLAB 7.1 下載 (含軟件介紹)
- 未知 | 420027次下載 | 免費
- 4OrCAD10.5下載OrCAD10.5中文版軟件
- 0.00 MB | 234315次下載 | 免費
- 5Altium DXP2002下載入口
- 未知 | 233046次下載 | 免費
- 6電路仿真軟件multisim 10.0免費下載
- 340992 | 191187次下載 | 免費
- 7十天學會AVR單片機與C語言視頻教程 下載
- 158M | 183279次下載 | 免費
- 8proe5.0野火版下載(中文版免費下載)
- 未知 | 138040次下載 | 免費
評論