homebridge-freeathome-local-api 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brightnessSensorAccessory.d.ts +19 -19
- package/dist/brightnessSensorAccessory.js +43 -43
- package/dist/contactSensorAccessory.d.ts +18 -18
- package/dist/contactSensorAccessory.js +41 -41
- package/dist/dimmerAccessory.d.ts +21 -21
- package/dist/dimmerAccessory.js +81 -81
- package/dist/doorOpenerAccessory.d.ts +19 -19
- package/dist/doorOpenerAccessory.js +71 -71
- package/dist/freeAtHomeAccessory.d.ts +23 -23
- package/dist/freeAtHomeAccessory.js +28 -28
- package/dist/freeAtHomeContext.d.ts +16 -16
- package/dist/freeAtHomeContext.js +21 -21
- package/dist/functionId.d.ts +54 -54
- package/dist/functionId.js +70 -70
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -11
- package/dist/motionSensorAccessory.d.ts +20 -20
- package/dist/motionSensorAccessory.js +53 -53
- package/dist/platform.d.ts +46 -46
- package/dist/platform.js +333 -333
- package/dist/roomTemperatureControllerAccessory.d.ts +33 -33
- package/dist/roomTemperatureControllerAccessory.js +152 -152
- package/dist/sceneAccessory.d.ts +19 -19
- package/dist/sceneAccessory.js +59 -59
- package/dist/sceneSensorAccessory.d.ts +18 -18
- package/dist/sceneSensorAccessory.js +43 -43
- package/dist/settings.d.ts +8 -8
- package/dist/settings.js +11 -11
- package/dist/shutterActuatorAccessory.d.ts +29 -29
- package/dist/shutterActuatorAccessory.js +114 -114
- package/dist/smokeDetectorAccessory.d.ts +18 -18
- package/dist/smokeDetectorAccessory.js +41 -41
- package/dist/staircaseLightSensor.d.ts +18 -18
- package/dist/staircaseLightSensor.js +43 -43
- package/dist/switchActuatorAccessory.d.ts +28 -28
- package/dist/switchActuatorAccessory.js +66 -66
- package/dist/switchSensorAccessory.d.ts +17 -17
- package/dist/switchSensorAccessory.js +39 -39
- package/dist/temperatureSensorAccessory.d.ts +19 -19
- package/dist/temperatureSensorAccessory.js +43 -43
- package/dist/triggerSensorAccessory.d.ts +18 -18
- package/dist/triggerSensorAccessory.js +43 -43
- package/dist/typeMappings.d.ts +11 -11
- package/dist/typeMappings.js +11 -11
- package/dist/util.d.ts +14 -14
- package/dist/util.js +24 -24
- package/package.json +16 -16
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { PlatformAccessory } from "homebridge";
|
|
2
|
-
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
-
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
-
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
-
/** A brightness sensor integrated in the free@home weather station. */
|
|
6
|
-
export declare class WeatherStationBrightnessSensorAccessory extends FreeAtHomeAccessory {
|
|
7
|
-
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
-
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
-
private readonly service;
|
|
10
|
-
private currentLightLevel;
|
|
11
|
-
private readonly pdCurrentLightLevel;
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a new brightness sensor accessory instance.
|
|
14
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
15
|
-
* @param accessory The platform accessory.
|
|
16
|
-
*/
|
|
17
|
-
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
18
|
-
updateDatapoint(datapoint: string, value: string): void;
|
|
19
|
-
}
|
|
1
|
+
import { PlatformAccessory } from "homebridge";
|
|
2
|
+
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
+
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
+
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
+
/** A brightness sensor integrated in the free@home weather station. */
|
|
6
|
+
export declare class WeatherStationBrightnessSensorAccessory extends FreeAtHomeAccessory {
|
|
7
|
+
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
+
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
+
private readonly service;
|
|
10
|
+
private currentLightLevel;
|
|
11
|
+
private readonly pdCurrentLightLevel;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new brightness sensor accessory instance.
|
|
14
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
15
|
+
* @param accessory The platform accessory.
|
|
16
|
+
*/
|
|
17
|
+
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
18
|
+
updateDatapoint(datapoint: string, value: string): void;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=brightnessSensorAccessory.d.ts.map
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WeatherStationBrightnessSensorAccessory = void 0;
|
|
4
|
-
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
-
const util_1 = require("./util");
|
|
6
|
-
const pidCurrentLightLevel = 1027;
|
|
7
|
-
/** A brightness sensor integrated in the free@home weather station. */
|
|
8
|
-
class WeatherStationBrightnessSensorAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
9
|
-
/**
|
|
10
|
-
* Constructs a new brightness sensor accessory instance.
|
|
11
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
12
|
-
* @param accessory The platform accessory.
|
|
13
|
-
*/
|
|
14
|
-
constructor(platform, accessory) {
|
|
15
|
-
var _a;
|
|
16
|
-
super(platform, accessory);
|
|
17
|
-
this.platform = platform;
|
|
18
|
-
this.accessory = accessory;
|
|
19
|
-
// Resolve data points
|
|
20
|
-
if (!this.accessory.context.channel.outputs)
|
|
21
|
-
throw new Error("Channel lacks expected input or output data points.");
|
|
22
|
-
this.pdCurrentLightLevel = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidCurrentLightLevel);
|
|
23
|
-
// set initial state
|
|
24
|
-
this.currentLightLevel = parseFloat((_a = this.accessory.context.channel.outputs[this.pdCurrentLightLevel].value) !== null && _a !== void 0 ? _a : "0.0");
|
|
25
|
-
// get the LightSensor service if it exists, otherwise create a new service instance
|
|
26
|
-
this.service =
|
|
27
|
-
this.accessory.getService(this.platform.Service.LightSensor) ||
|
|
28
|
-
this.accessory.addService(this.platform.Service.LightSensor);
|
|
29
|
-
// register handlers for the Current Ambient Light Level characteristic
|
|
30
|
-
this.service
|
|
31
|
-
.getCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel)
|
|
32
|
-
.onGet(() => this.currentLightLevel);
|
|
33
|
-
}
|
|
34
|
-
updateDatapoint(datapoint, value) {
|
|
35
|
-
// ignore unknown data points
|
|
36
|
-
if (datapoint !== this.pdCurrentLightLevel)
|
|
37
|
-
return;
|
|
38
|
-
// do the update
|
|
39
|
-
this.currentLightLevel = parseFloat(value);
|
|
40
|
-
this.doUpdateDatapoint("Brightness Sensor", this.service, this.platform.Characteristic.CurrentAmbientLightLevel, this.currentLightLevel);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.WeatherStationBrightnessSensorAccessory = WeatherStationBrightnessSensorAccessory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WeatherStationBrightnessSensorAccessory = void 0;
|
|
4
|
+
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
const pidCurrentLightLevel = 1027;
|
|
7
|
+
/** A brightness sensor integrated in the free@home weather station. */
|
|
8
|
+
class WeatherStationBrightnessSensorAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new brightness sensor accessory instance.
|
|
11
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
12
|
+
* @param accessory The platform accessory.
|
|
13
|
+
*/
|
|
14
|
+
constructor(platform, accessory) {
|
|
15
|
+
var _a;
|
|
16
|
+
super(platform, accessory);
|
|
17
|
+
this.platform = platform;
|
|
18
|
+
this.accessory = accessory;
|
|
19
|
+
// Resolve data points
|
|
20
|
+
if (!this.accessory.context.channel.outputs)
|
|
21
|
+
throw new Error("Channel lacks expected input or output data points.");
|
|
22
|
+
this.pdCurrentLightLevel = (0, util_1.getDataPointByPairingID)(this.accessory.context.channel.outputs, pidCurrentLightLevel);
|
|
23
|
+
// set initial state
|
|
24
|
+
this.currentLightLevel = parseFloat((_a = this.accessory.context.channel.outputs[this.pdCurrentLightLevel].value) !== null && _a !== void 0 ? _a : "0.0");
|
|
25
|
+
// get the LightSensor service if it exists, otherwise create a new service instance
|
|
26
|
+
this.service =
|
|
27
|
+
this.accessory.getService(this.platform.Service.LightSensor) ||
|
|
28
|
+
this.accessory.addService(this.platform.Service.LightSensor);
|
|
29
|
+
// register handlers for the Current Ambient Light Level characteristic
|
|
30
|
+
this.service
|
|
31
|
+
.getCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel)
|
|
32
|
+
.onGet(() => this.currentLightLevel);
|
|
33
|
+
}
|
|
34
|
+
updateDatapoint(datapoint, value) {
|
|
35
|
+
// ignore unknown data points
|
|
36
|
+
if (datapoint !== this.pdCurrentLightLevel)
|
|
37
|
+
return;
|
|
38
|
+
// do the update
|
|
39
|
+
this.currentLightLevel = parseFloat(value);
|
|
40
|
+
this.doUpdateDatapoint("Brightness Sensor", this.service, this.platform.Characteristic.CurrentAmbientLightLevel, this.currentLightLevel);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.WeatherStationBrightnessSensorAccessory = WeatherStationBrightnessSensorAccessory;
|
|
44
44
|
//# sourceMappingURL=brightnessSensorAccessory.js.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { PlatformAccessory } from "homebridge";
|
|
2
|
-
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
-
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
-
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
-
/** A contact sensor accessory. */
|
|
6
|
-
export declare class ContactSensorAccessory extends FreeAtHomeAccessory {
|
|
7
|
-
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
-
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
-
private readonly service;
|
|
10
|
-
private contactOpen;
|
|
11
|
-
/**
|
|
12
|
-
* Constructs a new contact sensor accessory instance.
|
|
13
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
14
|
-
* @param accessory The platform accessory.
|
|
15
|
-
*/
|
|
16
|
-
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
17
|
-
updateDatapoint(datapoint: string, value: string): void;
|
|
18
|
-
}
|
|
1
|
+
import { PlatformAccessory } from "homebridge";
|
|
2
|
+
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
+
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
+
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
+
/** A contact sensor accessory. */
|
|
6
|
+
export declare class ContactSensorAccessory extends FreeAtHomeAccessory {
|
|
7
|
+
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
+
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
+
private readonly service;
|
|
10
|
+
private contactOpen;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new contact sensor accessory instance.
|
|
13
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
14
|
+
* @param accessory The platform accessory.
|
|
15
|
+
*/
|
|
16
|
+
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
17
|
+
updateDatapoint(datapoint: string, value: string): void;
|
|
18
|
+
}
|
|
19
19
|
//# sourceMappingURL=contactSensorAccessory.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContactSensorAccessory = void 0;
|
|
4
|
-
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
-
/** A contact sensor accessory. */
|
|
6
|
-
class ContactSensorAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new contact sensor accessory instance.
|
|
9
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
10
|
-
* @param accessory The platform accessory.
|
|
11
|
-
*/
|
|
12
|
-
constructor(platform, accessory) {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
super(platform, accessory);
|
|
15
|
-
this.platform = platform;
|
|
16
|
-
this.accessory = accessory;
|
|
17
|
-
// set initial state
|
|
18
|
-
this.contactOpen = !!parseInt((_b = (_a = this.accessory.context.channel.outputs) === null || _a === void 0 ? void 0 : _a.odp0000.value) !== null && _b !== void 0 ? _b : "0");
|
|
19
|
-
// get the ContactSensor service if it exists, otherwise create a new service instance
|
|
20
|
-
this.service =
|
|
21
|
-
this.accessory.getService(this.platform.Service.ContactSensor) ||
|
|
22
|
-
this.accessory.addService(this.platform.Service.ContactSensor);
|
|
23
|
-
// register handlers for the contact sensor state characteristic
|
|
24
|
-
this.service
|
|
25
|
-
.getCharacteristic(this.platform.Characteristic.ContactSensorState)
|
|
26
|
-
.onGet(() => this.contactOpen
|
|
27
|
-
? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
28
|
-
: this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED);
|
|
29
|
-
}
|
|
30
|
-
updateDatapoint(datapoint, value) {
|
|
31
|
-
// ignore unknown data points
|
|
32
|
-
if (datapoint !== "odp0000")
|
|
33
|
-
return;
|
|
34
|
-
// do the update
|
|
35
|
-
this.contactOpen = !!parseInt(value);
|
|
36
|
-
this.doUpdateDatapoint("Contact Sensor", this.service, this.platform.Characteristic.ContactSensorState, this.contactOpen
|
|
37
|
-
? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
38
|
-
: this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.ContactSensorAccessory = ContactSensorAccessory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContactSensorAccessory = void 0;
|
|
4
|
+
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
+
/** A contact sensor accessory. */
|
|
6
|
+
class ContactSensorAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new contact sensor accessory instance.
|
|
9
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
10
|
+
* @param accessory The platform accessory.
|
|
11
|
+
*/
|
|
12
|
+
constructor(platform, accessory) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
super(platform, accessory);
|
|
15
|
+
this.platform = platform;
|
|
16
|
+
this.accessory = accessory;
|
|
17
|
+
// set initial state
|
|
18
|
+
this.contactOpen = !!parseInt((_b = (_a = this.accessory.context.channel.outputs) === null || _a === void 0 ? void 0 : _a.odp0000.value) !== null && _b !== void 0 ? _b : "0");
|
|
19
|
+
// get the ContactSensor service if it exists, otherwise create a new service instance
|
|
20
|
+
this.service =
|
|
21
|
+
this.accessory.getService(this.platform.Service.ContactSensor) ||
|
|
22
|
+
this.accessory.addService(this.platform.Service.ContactSensor);
|
|
23
|
+
// register handlers for the contact sensor state characteristic
|
|
24
|
+
this.service
|
|
25
|
+
.getCharacteristic(this.platform.Characteristic.ContactSensorState)
|
|
26
|
+
.onGet(() => this.contactOpen
|
|
27
|
+
? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
28
|
+
: this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED);
|
|
29
|
+
}
|
|
30
|
+
updateDatapoint(datapoint, value) {
|
|
31
|
+
// ignore unknown data points
|
|
32
|
+
if (datapoint !== "odp0000")
|
|
33
|
+
return;
|
|
34
|
+
// do the update
|
|
35
|
+
this.contactOpen = !!parseInt(value);
|
|
36
|
+
this.doUpdateDatapoint("Contact Sensor", this.service, this.platform.Characteristic.ContactSensorState, this.contactOpen
|
|
37
|
+
? this.platform.Characteristic.ContactSensorState.CONTACT_NOT_DETECTED
|
|
38
|
+
: this.platform.Characteristic.ContactSensorState.CONTACT_DETECTED);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ContactSensorAccessory = ContactSensorAccessory;
|
|
42
42
|
//# sourceMappingURL=contactSensorAccessory.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { PlatformAccessory } from "homebridge";
|
|
2
|
-
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
-
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
-
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
-
/** A dimming actuator accessory.*/
|
|
6
|
-
export declare class DimmerAccessory extends FreeAtHomeAccessory {
|
|
7
|
-
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
-
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
-
private readonly service;
|
|
10
|
-
private stateOn;
|
|
11
|
-
private stateBrightness;
|
|
12
|
-
/**
|
|
13
|
-
* Constructs a new dimming actuator accessory instance.
|
|
14
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
15
|
-
* @param accessory The platform accessory.
|
|
16
|
-
*/
|
|
17
|
-
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
18
|
-
private setOn;
|
|
19
|
-
private setBrightness;
|
|
20
|
-
updateDatapoint(datapoint: string, value: string): void;
|
|
21
|
-
}
|
|
1
|
+
import { PlatformAccessory } from "homebridge";
|
|
2
|
+
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
+
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
+
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
+
/** A dimming actuator accessory.*/
|
|
6
|
+
export declare class DimmerAccessory extends FreeAtHomeAccessory {
|
|
7
|
+
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
+
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
+
private readonly service;
|
|
10
|
+
private stateOn;
|
|
11
|
+
private stateBrightness;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new dimming actuator accessory instance.
|
|
14
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
15
|
+
* @param accessory The platform accessory.
|
|
16
|
+
*/
|
|
17
|
+
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
18
|
+
private setOn;
|
|
19
|
+
private setBrightness;
|
|
20
|
+
updateDatapoint(datapoint: string, value: string): void;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=dimmerAccessory.d.ts.map
|
package/dist/dimmerAccessory.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DimmerAccessory = void 0;
|
|
4
|
-
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
-
const util_1 = require("./util");
|
|
6
|
-
/** A dimming actuator accessory.*/
|
|
7
|
-
class DimmerAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
8
|
-
/**
|
|
9
|
-
* Constructs a new dimming actuator accessory instance.
|
|
10
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
11
|
-
* @param accessory The platform accessory.
|
|
12
|
-
*/
|
|
13
|
-
constructor(platform, accessory) {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f;
|
|
15
|
-
super(platform, accessory);
|
|
16
|
-
this.platform = platform;
|
|
17
|
-
this.accessory = accessory;
|
|
18
|
-
// set initial state
|
|
19
|
-
this.stateOn = !!parseInt((_b = (_a = this.accessory.context.channel.outputs) === null || _a === void 0 ? void 0 : _a.odp0000.value) !== null && _b !== void 0 ? _b : "0");
|
|
20
|
-
this.stateBrightness = parseInt((_f = (_d = (_c = this.accessory.context.channel.outputs) === null || _c === void 0 ? void 0 : _c.odp0001.value) !== null && _d !== void 0 ? _d : (_e = this.accessory.context.channel.inputs) === null || _e === void 0 ? void 0 : _e.idp0002.value) !== null && _f !== void 0 ? _f : "0");
|
|
21
|
-
// get the Lightbulb service if it exists, otherwise create a new service instance
|
|
22
|
-
this.service =
|
|
23
|
-
this.accessory.getService(this.platform.Service.Lightbulb) ||
|
|
24
|
-
this.accessory.addService(this.platform.Service.Lightbulb);
|
|
25
|
-
// register handlers for the On/Off Characteristic
|
|
26
|
-
this.service
|
|
27
|
-
.getCharacteristic(this.platform.Characteristic.On)
|
|
28
|
-
.onSet(this.setOn.bind(this))
|
|
29
|
-
.onGet(() => this.stateOn);
|
|
30
|
-
// register handlers for the Brightness Characteristic
|
|
31
|
-
this.service
|
|
32
|
-
.getCharacteristic(this.platform.Characteristic.Brightness)
|
|
33
|
-
.onSet(this.setBrightness.bind(this))
|
|
34
|
-
.onGet(() => this.stateBrightness);
|
|
35
|
-
}
|
|
36
|
-
async setOn(value) {
|
|
37
|
-
// avoid unncessary updates or update cache
|
|
38
|
-
if (value === this.stateOn)
|
|
39
|
-
return;
|
|
40
|
-
else
|
|
41
|
-
this.stateOn = value;
|
|
42
|
-
// log event
|
|
43
|
-
this.platform.log.info(`${this.accessory.displayName} (Dimmer Accessory ${this.serialNumber}) set characteristic On -> ${value.toString()}`);
|
|
44
|
-
// set data point at SysAP
|
|
45
|
-
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, "idp0000", value ? "1" : "0");
|
|
46
|
-
// restore previous brightness
|
|
47
|
-
if (value && this.stateBrightness)
|
|
48
|
-
await this.setBrightness(this.stateBrightness);
|
|
49
|
-
}
|
|
50
|
-
async setBrightness(value) {
|
|
51
|
-
// avoid unncessary updates or update cache
|
|
52
|
-
if (value === this.stateBrightness)
|
|
53
|
-
return;
|
|
54
|
-
else
|
|
55
|
-
this.stateBrightness = value;
|
|
56
|
-
// log event
|
|
57
|
-
this.platform.log.info(`${this.accessory.displayName} (Dimmer Accessory ${this.serialNumber}) set characteristic Brightness -> ${value.toString()}`);
|
|
58
|
-
// set data point at SysAP
|
|
59
|
-
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, "idp0002", value.toString());
|
|
60
|
-
}
|
|
61
|
-
updateDatapoint(datapoint, value) {
|
|
62
|
-
// ignore unknown data points
|
|
63
|
-
switch (datapoint) {
|
|
64
|
-
case "odp0000":
|
|
65
|
-
this.stateOn = !!parseInt(value);
|
|
66
|
-
// do the update
|
|
67
|
-
this.doUpdateDatapoint("Dimmer Accessory", this.service, this.platform.Characteristic.On, this.stateOn);
|
|
68
|
-
return;
|
|
69
|
-
case "odp0001":
|
|
70
|
-
// Do NOT set brightness to 0, otherwise when turning the dimmer back on, brightness will be 100%.
|
|
71
|
-
if (value === "0")
|
|
72
|
-
return;
|
|
73
|
-
this.stateBrightness = parseInt(value);
|
|
74
|
-
this.doUpdateDatapoint("Dimmer Accessory", this.service, this.platform.Characteristic.Brightness, this.stateBrightness);
|
|
75
|
-
return;
|
|
76
|
-
default:
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.DimmerAccessory = DimmerAccessory;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DimmerAccessory = void 0;
|
|
4
|
+
const freeAtHomeAccessory_1 = require("./freeAtHomeAccessory");
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
/** A dimming actuator accessory.*/
|
|
7
|
+
class DimmerAccessory extends freeAtHomeAccessory_1.FreeAtHomeAccessory {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new dimming actuator accessory instance.
|
|
10
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
11
|
+
* @param accessory The platform accessory.
|
|
12
|
+
*/
|
|
13
|
+
constructor(platform, accessory) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
|
+
super(platform, accessory);
|
|
16
|
+
this.platform = platform;
|
|
17
|
+
this.accessory = accessory;
|
|
18
|
+
// set initial state
|
|
19
|
+
this.stateOn = !!parseInt((_b = (_a = this.accessory.context.channel.outputs) === null || _a === void 0 ? void 0 : _a.odp0000.value) !== null && _b !== void 0 ? _b : "0");
|
|
20
|
+
this.stateBrightness = parseInt((_f = (_d = (_c = this.accessory.context.channel.outputs) === null || _c === void 0 ? void 0 : _c.odp0001.value) !== null && _d !== void 0 ? _d : (_e = this.accessory.context.channel.inputs) === null || _e === void 0 ? void 0 : _e.idp0002.value) !== null && _f !== void 0 ? _f : "0");
|
|
21
|
+
// get the Lightbulb service if it exists, otherwise create a new service instance
|
|
22
|
+
this.service =
|
|
23
|
+
this.accessory.getService(this.platform.Service.Lightbulb) ||
|
|
24
|
+
this.accessory.addService(this.platform.Service.Lightbulb);
|
|
25
|
+
// register handlers for the On/Off Characteristic
|
|
26
|
+
this.service
|
|
27
|
+
.getCharacteristic(this.platform.Characteristic.On)
|
|
28
|
+
.onSet(this.setOn.bind(this))
|
|
29
|
+
.onGet(() => this.stateOn);
|
|
30
|
+
// register handlers for the Brightness Characteristic
|
|
31
|
+
this.service
|
|
32
|
+
.getCharacteristic(this.platform.Characteristic.Brightness)
|
|
33
|
+
.onSet(this.setBrightness.bind(this))
|
|
34
|
+
.onGet(() => this.stateBrightness);
|
|
35
|
+
}
|
|
36
|
+
async setOn(value) {
|
|
37
|
+
// avoid unncessary updates or update cache
|
|
38
|
+
if (value === this.stateOn)
|
|
39
|
+
return;
|
|
40
|
+
else
|
|
41
|
+
this.stateOn = value;
|
|
42
|
+
// log event
|
|
43
|
+
this.platform.log.info(`${this.accessory.displayName} (Dimmer Accessory ${this.serialNumber}) set characteristic On -> ${value.toString()}`);
|
|
44
|
+
// set data point at SysAP
|
|
45
|
+
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, "idp0000", value ? "1" : "0");
|
|
46
|
+
// restore previous brightness
|
|
47
|
+
if (value && this.stateBrightness)
|
|
48
|
+
await this.setBrightness(this.stateBrightness);
|
|
49
|
+
}
|
|
50
|
+
async setBrightness(value) {
|
|
51
|
+
// avoid unncessary updates or update cache
|
|
52
|
+
if (value === this.stateBrightness)
|
|
53
|
+
return;
|
|
54
|
+
else
|
|
55
|
+
this.stateBrightness = value;
|
|
56
|
+
// log event
|
|
57
|
+
this.platform.log.info(`${this.accessory.displayName} (Dimmer Accessory ${this.serialNumber}) set characteristic Brightness -> ${value.toString()}`);
|
|
58
|
+
// set data point at SysAP
|
|
59
|
+
await this.platform.sysap.setDatapoint(util_1.EmptyGuid, this.accessory.context.deviceSerial, this.accessory.context.channelId, "idp0002", value.toString());
|
|
60
|
+
}
|
|
61
|
+
updateDatapoint(datapoint, value) {
|
|
62
|
+
// ignore unknown data points
|
|
63
|
+
switch (datapoint) {
|
|
64
|
+
case "odp0000":
|
|
65
|
+
this.stateOn = !!parseInt(value);
|
|
66
|
+
// do the update
|
|
67
|
+
this.doUpdateDatapoint("Dimmer Accessory", this.service, this.platform.Characteristic.On, this.stateOn);
|
|
68
|
+
return;
|
|
69
|
+
case "odp0001":
|
|
70
|
+
// Do NOT set brightness to 0, otherwise when turning the dimmer back on, brightness will be 100%.
|
|
71
|
+
if (value === "0")
|
|
72
|
+
return;
|
|
73
|
+
this.stateBrightness = parseInt(value);
|
|
74
|
+
this.doUpdateDatapoint("Dimmer Accessory", this.service, this.platform.Characteristic.Brightness, this.stateBrightness);
|
|
75
|
+
return;
|
|
76
|
+
default:
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.DimmerAccessory = DimmerAccessory;
|
|
82
82
|
//# sourceMappingURL=dimmerAccessory.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { PlatformAccessory } from "homebridge";
|
|
2
|
-
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
-
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
-
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
-
/** A door opener accessory.*/
|
|
6
|
-
export declare class DoorOpenerAccessory extends FreeAtHomeAccessory {
|
|
7
|
-
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
-
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
-
private readonly service;
|
|
10
|
-
private stateActive;
|
|
11
|
-
/**
|
|
12
|
-
* Constructs a new door opener accessory instance.
|
|
13
|
-
* @param platform The free@home Homebridge platform controlling the accessory
|
|
14
|
-
* @param accessory The platform accessory.
|
|
15
|
-
*/
|
|
16
|
-
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
17
|
-
private setLockTargetState;
|
|
18
|
-
updateDatapoint(datapoint: string, value: string): void;
|
|
19
|
-
}
|
|
1
|
+
import { PlatformAccessory } from "homebridge";
|
|
2
|
+
import { FreeAtHomeAccessory } from "./freeAtHomeAccessory";
|
|
3
|
+
import { FreeAtHomeContext } from "./freeAtHomeContext";
|
|
4
|
+
import { FreeAtHomeHomebridgePlatform } from "./platform";
|
|
5
|
+
/** A door opener accessory.*/
|
|
6
|
+
export declare class DoorOpenerAccessory extends FreeAtHomeAccessory {
|
|
7
|
+
readonly platform: FreeAtHomeHomebridgePlatform;
|
|
8
|
+
readonly accessory: PlatformAccessory<FreeAtHomeContext>;
|
|
9
|
+
private readonly service;
|
|
10
|
+
private stateActive;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new door opener accessory instance.
|
|
13
|
+
* @param platform The free@home Homebridge platform controlling the accessory
|
|
14
|
+
* @param accessory The platform accessory.
|
|
15
|
+
*/
|
|
16
|
+
constructor(platform: FreeAtHomeHomebridgePlatform, accessory: PlatformAccessory<FreeAtHomeContext>);
|
|
17
|
+
private setLockTargetState;
|
|
18
|
+
updateDatapoint(datapoint: string, value: string): void;
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=doorOpenerAccessory.d.ts.map
|