Closed uswong closed 1 year ago
Testing has passed with flying colours on both HOOBS and Homebridge! I really like the added touch of providing the next two commands for the CheckConfig
at the end of the ConfigCreator
. One small note I have is that you actually do not have to reboot Homebridge/HOOBS to see the new config and for the CheckConfig
to use it. Should we still tell the user to reboot Homebridge/HOOBS at this stage, I think we could get away with not having to do it? They really only need to reboot if they are not going to run CheckConfig
(to apply the new config and be done) or after they have run the CheckConfig
. Curious on your thoughts :)
Nice!
They really only need to reboot if they are not going to run CheckConfig (to apply the new config and be done) or after they have run the CheckConfig. Curious on your thoughts :)
You are spot on there! What do you think an appropriate text should be following a successful ConfigCreator
run to bring that message across to users?
One suggestion (thinking out loud here):
DONE! Restart Homebridge or HOOBS for the created config to take effect or run CheckConfig prior (recommended).
I think that or something similar will suffice :) I’ll edit it myself today and looks like we will be good for the next publish!
name: Check Configuration from Command Line about: Add an improvement to homebridge-cmd4-AdvantageAir. title: "Check Configuration from Command Line" labels: Improvement assignees: mitch7391
Following the success of running
ConfigCreator
from Command-Line for HOOBS users, Mitch has an idea of makingCheck Configuration
Command-Line friendly as well for HOOBS users and for those users who have no access to Homebridge-ui.I told Mitch that I would explore the
CHECK CONFIGURATION
JavaScript to see whether I can implement that to run from Terminal.Is your pull request related to a problem or a new feature? Please describe:
An improvement.
Describe the solution you'd have implemented:
1. CheckConfig creation:
CHECK CONFIGURATION
button will invokeserver.js
JavaScript as a child process via html to do the "checking" ofconfig.json
. Once I have understood the internal working of theserver.js
, I extracted the main “checking” engine from it and modified some codes around it and in it so that it can be run as a main process from a Terminal using “node.js” rather than a child process called from html. I called this modified JavaScriptCheckConfig.js
.The inputs required to this
CheckConfig.js
are the paths toAdvAir.sh
andconfig.json
and the routines looking for those paths have already been coded withinConfigCreator.sh
. So I extracted those routines fromConfigCreator.sh
and created a new bash script calledCheckConfig.sh
.So To check the
config.json
using Command-Line, all we need to do is to run the bash scriptCheckConfig.sh
which will find the paths and feed those paths into the JavaScriptCheckConfig.js
to do the exact same checking as theCHECK CONFIGURATION
button in Homebridge-ui. The messages are exactly the same too but the messages are delivered to the terminal rather than to the Homebridge-ui.2. ConfigCreator minor modification
I have also added a prompt to
ConfigCreator
. The prompt will encourage users to run theCheckConfig
following a successfulConfigCreator
run. The path to runCheckConfig
is provided as well:Do your changes pass local testing:
Additional context:
To run the CheckConfig independently, do the following:
Set the Terminal to home drive, so that there is no permission issue:
For Homebridge users:
or
For HOOBS users:
Check the content of check1
if the response from step 3 is a single file path, then do the following to run the script and ignore the rest of the steps:
There is little chance that you will find two file paths in step 3, but if you do, do the following to extract the first path or a path of your choice. To extract the second path, replace 1p in the following command with 2p, and so on:
Check the content of check2
if the response from above is a single file path, then do the following to run the script:
The following is a screen shot of running CheckConfig:
if a requirement is not meet, the CheckConfig will throw an error in red color as follow:
Correct the error and run
CheckConfig
again. Some errors like the example above can be corrected by editingconfig.json
directly. If there is an error on "displayName is defined twice" especially for lights or garage door, you have to change the name of one of them in your AdvantageAir system and re-runConfigCreator
before runningCheckConfig
again.A prompt was added to prompt users to run the CheckConfig following a successful run of ConfigCreator: