Skip to content

Commit

Permalink
do not start pluging if not initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
ruizmarc committed Dec 27, 2023
1 parent 0b2a3e5 commit acba462
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"version": "1.0.0",
"description": "A homebridge plugin for IntelliClima App from Fantini Cosmi.",
"license": "Apache-2.0",
"author": "ruizmarc",
"repository": {
"type": "git",
"url": "https://github.com/ruizmarc/homebridge-intelliclima.git"
Expand Down
7 changes: 7 additions & 0 deletions src/platform/IntelliClimaPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig,

import { IntelliClimaAPIConsumer } from '../intelliclima/intelliclima-api-consumer';
import { ThermostatAccesory } from '../accessories/ThermostatAccessory';
import { PLUGIN_NAME } from '../settings';

/**
* HomebridgePlatform
Expand All @@ -23,6 +24,12 @@ export class IntelliClimaPlatform implements DynamicPlatformPlugin {
) {
this.log.debug('Finished initializing platform:', this.config.name);

// only load if configured
if (!this.config.username || !this.config.password) {
log.warn(`No configuration found for ${PLUGIN_NAME}`);
return;
}

// When this event is fired it means Homebridge has restored all cached accessories from disk.
// Dynamic Platform plugins should only register new accessories after this event was fired,
// in order to ensure they weren't added to homebridge already. This event can also be used
Expand Down

0 comments on commit acba462

Please sign in to comment.