資料介紹
軟件簡(jiǎn)介
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應(yīng)用程序自定義工具
- 創(chuàng)建自定義的基于閃存的引導(dǎo)加載程序(BSL)
- labview超快自定義控件制作和普通自定義控件制作 14次下載
- 創(chuàng)建自定義Kria KV260加速M(fèi)L應(yīng)用程序
- labview自定義控件 22次下載
- 應(yīng)用程序在崩潰時(shí)能啟動(dòng)自定義活動(dòng)的OHOS庫(kù) 0次下載
- 自定義視圖組件教程案例 15次下載
- Labview自定義右鍵快捷菜單功能實(shí)用小技巧 27次下載
- 串口屏LUA教程10-自定義串口指令
- STM32二級(jí)菜單通過(guò)按鍵切換自定義任務(wù)OLED顯示的程序和工程文件 48次下載
- 遠(yuǎn)程網(wǎng)絡(luò)處理器應(yīng)用程序和與自定義應(yīng)用程序的詳細(xì)資料免費(fèi)下載 3次下載
- 自定義鼠標(biāo)光標(biāo) 2次下載
- 1602自定義字符 1次下載
- 自定義函數(shù)測(cè)試學(xué)習(xí)工程
- matlab自定義函數(shù)調(diào)用的方法
- HarmonyOS應(yīng)用自定義鍵盤解決方案 2.1k次閱讀
- 如何添加自定義單板 1.2k次閱讀
- 如何快速創(chuàng)建用戶自定義Board和App工程 1.1k次閱讀
- AWTK 開(kāi)源串口屏開(kāi)發(fā)(18) - 用 C 語(yǔ)言自定義命令 1k次閱讀
- TSMaster 自定義 LIN 調(diào)度表編程指導(dǎo) 2k次閱讀
- IAR下手動(dòng)拷貝自定義程序段到RAM中執(zhí)行的方法分享 3.3k次閱讀
- 添加自定義屬性控制fridaserver啟動(dòng)和停止 2.8k次閱讀
- 什么是自定義序列 2k次閱讀
- 自定義特性能做什么? 1.5k次閱讀
- FreeRTOS|自定義裁剪 2.4k次閱讀
- 如何自定義函數(shù)或局部腳本 2.3k次閱讀
- 如何在Vivado中更改自定義的Interface 3.9k次閱讀
- 三種自定義彈窗UI組件封裝的實(shí)現(xiàn) 4.4k次閱讀
- 如何給EOS賬號(hào)設(shè)置自定義權(quán)限 1.9k次閱讀
- RIO技術(shù)之快速設(shè)計(jì)自定義硬件 5.3k次閱讀
下載排行
本周
- 1耗盡型MOS FET產(chǎn)品目錄選型表
- 0.14 MB | 2次下載 | 免費(fèi)
- 2TI系列-米爾TI AM62L核心板開(kāi)發(fā)板-高能效低功耗嵌入式平臺(tái)
- 1.51 MB | 次下載 | 免費(fèi)
- 3WILLSEMI韋爾20年半年度報(bào)告由代理分銷經(jīng)銷一級(jí)代理分銷經(jīng)銷
- 3.30 MB | 次下載 | 免費(fèi)
- 4LRC 樂(lè)山無(wú)線電InTWSApplications家電由原廠代理分銷經(jīng)銷一級(jí)代理分銷經(jīng)銷供應(yīng)
- 85.84 KB | 次下載 | 免費(fèi)
- 5LAT1596 一文說(shuō)明白 STM32G4 雙 Bank 啟動(dòng)與升級(jí)
- 0.64 MB | 次下載 | 5 積分
- 6LAT1594_基于事件喚醒低功耗之介紹
- 0.37 MB | 次下載 | 5 積分
- 7PT8P2309 觸控 A/D 型 8-Bit MCU規(guī)格書(shū)
- 4.05 MB | 次下載 | 免費(fèi)
- 8PT8P2308 觸控 A/D 型 8-Bit MCU規(guī)格書(shū)
- 4.13 MB | 次下載 | 免費(fèi)
本月
- 1美的電磁爐電路原理圖資料
- 4.39 MB | 19次下載 | 10 積分
- 2反激式開(kāi)關(guān)電源設(shè)計(jì)解析
- 0.89 MB | 11次下載 | 5 積分
- 3耗盡型MOS FET產(chǎn)品目錄選型表
- 0.14 MB | 2次下載 | 免費(fèi)
- 4簡(jiǎn)易光伏控制器原理圖資料
- 0.07 MB | 1次下載 | 5 積分
- 52EDL05x06xx系列 600V半橋門驅(qū)動(dòng)器帶集成自舉二極管(BSD)手冊(cè)
- 0.69 MB | 1次下載 | 免費(fèi)
- 6國(guó)產(chǎn)千兆網(wǎng)口芯片PT153S中文資料
- 1.35 MB | 次下載 | 免費(fèi)
- 7斯丹電子 | 用于芯片測(cè)試系統(tǒng)的射頻干簧繼電器
- 5.11 MB | 次下載 | 免費(fèi)
- 8SFI立昌ESD/TVS管原廠代理分銷經(jīng)銷一級(jí)代理分銷經(jīng)銷
- 294.76 KB | 次下載 | 免費(fèi)
總榜
- 1matlab軟件下載入口
- 未知 | 935137次下載 | 10 積分
- 2開(kāi)源硬件-PMP21529.1-4 開(kāi)關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設(shè)計(jì)
- 1.48MB | 420064次下載 | 10 積分
- 3Altium DXP2002下載入口
- 未知 | 233095次下載 | 10 積分
- 4電路仿真軟件multisim 10.0免費(fèi)下載
- 340992 | 191448次下載 | 10 積分
- 5十天學(xué)會(huì)AVR單片機(jī)與C語(yǔ)言視頻教程 下載
- 158M | 183360次下載 | 10 積分
- 6labview8.5下載
- 未知 | 81605次下載 | 10 積分
- 7Keil工具M(jìn)DK-Arm免費(fèi)下載
- 0.02 MB | 73829次下載 | 10 積分
- 8LabVIEW 8.6下載
- 未知 | 65991次下載 | 10 積分
電子發(fā)燒友App





創(chuàng)作
發(fā)文章
發(fā)帖
提問(wèn)
發(fā)資料
發(fā)視頻
上傳資料賺積分
評(píng)論