Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for persistent accessories inside child bridge #135

Merged
merged 9 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Configuration sample:
| `switchEco` | yes | `true`, `false` | creates a switch for eco settings |
| `switchHeatingOff` | yes | `true`, `false` | creates a switch to tur off the heating |
| `switchCustom` | yes | `true`, `false` | creates a switch for your custom mode |
| `childBridge` | yes | `true`, `false` | allows you to have persistent accessories, if plugin is run inside a child bridge |
| `temperatureAboveAsOff` | yes | `true`, `false` | allows you to displays thermostats as off, if room temperature is above target temperature |


Expand Down Expand Up @@ -93,7 +94,7 @@ rm -r homebridge-evohome
# recreate the folder
mkdir homebridge-evohome
# clone repo to folder
git clone --branch main https://github.com/luc-ass/homebridge-evohome.git ./homebridge-evohome
git clone --single-branch --branch main https://github.com/luc-ass/homebridge-evohome.git ./homebridge-evohome
# cd into folder
cd homebridge-evohome
# install plugin
Expand Down
10 changes: 9 additions & 1 deletion config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"pluginAlias": "Evohome",
"pluginType": "platform",
"singular": false,
"headerDisplay": "This Plugin integrates your Honeywell Evohome into Homebridge. Please use your credentials from https://getconnected.honeywellhome.com",
"headerDisplay": "This Plugin integrates your Honeywell Evohome into Homebridge. Please use your credentials from https://getconnected.honeywellhome.com. You should consider running this plugin as a child bridge, as it allows for persistent accessories, thus prevent breaking your automations!",
"footerDisplay": "It is important, that your Homebridge time zone is set correct. Please double check this! If you encounter any problems don't hesitate to have a look at https://github.com/luc-ass/homebridge-evohome.",
"schema": {
"type": "object",
Expand Down Expand Up @@ -74,6 +74,13 @@
"default": true,
"required": false
},
"childBridge": {
"title": "This accessory runs in a child bridge (recommended)",
"description": "This switch should be turned on, if the platform is run as a child bridge. This ensures, that accessories are not lost on error.",
"type": "boolean",
"default": false,
"required": false
},
"temperatureAboveAsOff": {
"title": "Represent room temperature above set temperature as off",
"type": "boolean",
Expand Down Expand Up @@ -108,6 +115,7 @@
"switchEco",
"switchHeatingOff",
"switchCustom",
"childBridge",
"temperatureAboveAsOff"
]
}
Expand Down
18 changes: 14 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ function EvohomePlatform(log, config) {
this.switchCustom = config["switchCustom"];
this.temperatureAboveAsOff = config["temperatureAboveAsOff"];

this.childBridge = config["childBridge"] || false;

this.cache_timeout = 300; // seconds
this.interval_setTemperature = 5; // seconds

Expand Down Expand Up @@ -312,26 +314,34 @@ EvohomePlatform.prototype = {
)
.fail(function (err) {
that.log.error("Error getting system mode status:\n", err);
callback([]);
if (!childBridge){
callback([]);
}
});
}.bind(this)
)
.fail(function (err) {
that.log.error("Error getting thermostats:\n", err);
callback([]);
if (!childBridge){
callback([]);
}
});
}.bind(this)
)
.fail(function (err) {
that.log.error("Error getting locations:\n", err);
callback([]);
if (!childBridge){
callback([]);
}
});
}.bind(this)
)
.fail(function (err) {
// tell me if login did not work!
that.log.error("Error during login:\n", err);
callback([]);
if (!childBridge){
callback([]);
}
});
},
};
Expand Down