@switchbot/homebridge-switchbot 2.5.3-beta.13 → 2.5.3-beta.14

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.
@@ -136,6 +136,10 @@
136
136
  "title": "Meter Plus (JP)",
137
137
  "enum": ["Meter Plus (JP)"]
138
138
  },
139
+ {
140
+ "title": "Indoor/Outdoor Sensor",
141
+ "enum": ["WoIOSensor"]
142
+ },
139
143
  {
140
144
  "title": "Plug Mini (US)",
141
145
  "enum": ["Plug Mini (US)"]
@@ -308,14 +312,14 @@
308
312
  "title": "Hide Meter's Temperature Sensor",
309
313
  "type": "boolean",
310
314
  "condition": {
311
- "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Meter' || model.options.devices[arrayIndices].configDeviceType === 'MeterPlus') && model.options.devices[arrayIndices].deviceId);"
315
+ "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Meter' || model.options.devices[arrayIndices].configDeviceType === 'MeterPlus' || model.options.devices[arrayIndices].configDeviceType === 'Meter Plus (JP)' || model.options.devices[arrayIndices].configDeviceType === 'WoIOSensor') && model.options.devices[arrayIndices].deviceId);"
312
316
  }
313
317
  },
314
318
  "hide_humidity": {
315
319
  "title": "Hide Meter's Humidity Sensor",
316
320
  "type": "boolean",
317
321
  "condition": {
318
- "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Meter' || model.options.devices[arrayIndices].configDeviceType === 'MeterPlus') && model.options.devices[arrayIndices].deviceId);"
322
+ "functionBody": "return (model.options && model.options.devices && !model.options.devices[arrayIndices].hide_device && (model.options.devices[arrayIndices].configDeviceType === 'Meter' || model.options.devices[arrayIndices].configDeviceType === 'MeterPlus' || model.options.devices[arrayIndices].configDeviceType === 'Meter Plus (JP)' || model.options.devices[arrayIndices].configDeviceType === 'WoIOSensor') && model.options.devices[arrayIndices].deviceId);"
319
323
  }
320
324
  }
321
325
  }
@@ -0,0 +1,93 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Context } from 'vm';
4
+ import { MqttClient } from 'mqtt';
5
+ import { Subject } from 'rxjs';
6
+ import { SwitchBotPlatform } from '../platform';
7
+ import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
8
+ import { device, devicesConfig, serviceData, ad, switchbot, temperature, deviceStatus } from '../settings';
9
+ import { IncomingMessage } from 'http';
10
+ /**
11
+ * Platform Accessory
12
+ * An instance of this class is created for each accessory your platform registers
13
+ * Each accessory may expose multiple services of different service types.
14
+ */
15
+ export declare class IOSensor {
16
+ private readonly platform;
17
+ private accessory;
18
+ device: device & devicesConfig;
19
+ batteryService?: Service;
20
+ temperatureservice?: Service;
21
+ humidityservice?: Service;
22
+ CurrentRelativeHumidity: CharacteristicValue;
23
+ CurrentTemperature?: CharacteristicValue;
24
+ BatteryLevel?: CharacteristicValue;
25
+ ChargingState?: CharacteristicValue;
26
+ StatusLowBattery?: CharacteristicValue;
27
+ Temperature: deviceStatus['temperature'];
28
+ Humidity: deviceStatus['humidity'];
29
+ deviceStatus: any;
30
+ connected?: boolean;
31
+ switchbot: switchbot;
32
+ serviceData: serviceData;
33
+ address: ad['address'];
34
+ temperature: serviceData['temperature'];
35
+ celsius: temperature['c'];
36
+ fahrenheit: temperature['f'];
37
+ battery: serviceData['battery'];
38
+ humidity: serviceData['humidity'];
39
+ mqttClient: MqttClient | null;
40
+ historyService?: any;
41
+ scanDuration: number;
42
+ deviceLogging: string;
43
+ deviceRefreshRate: number;
44
+ ioSensorUpdateInProgress: boolean;
45
+ doIOSensorUpdate: Subject<void>;
46
+ private readonly BLE;
47
+ private readonly OpenAPI;
48
+ constructor(platform: SwitchBotPlatform, accessory: PlatformAccessory, device: device & devicesConfig);
49
+ /**
50
+ * Parse the device status from the SwitchBot api
51
+ */
52
+ parseStatus(): Promise<void>;
53
+ BLEparseStatus(): Promise<void>;
54
+ openAPIparseStatus(): Promise<void>;
55
+ /**
56
+ * Asks the SwitchBot API for the latest device information
57
+ */
58
+ refreshStatus(): Promise<void>;
59
+ BLERefreshStatus(): Promise<void>;
60
+ openAPIRefreshStatus(): Promise<void>;
61
+ /**
62
+ * Updates the status for each of the HomeKit Characteristics
63
+ */
64
+ updateHomeKitCharacteristics(): Promise<void>;
65
+ mqttPublish(message: any): void;
66
+ setupMqtt(device: device & devicesConfig): Promise<void>;
67
+ setupHistoryService(device: device & devicesConfig): Promise<void>;
68
+ stopScanning(switchbot: any): Promise<void>;
69
+ getCustomBLEAddress(switchbot: any): Promise<void>;
70
+ BLERefreshConnection(switchbot: any): Promise<void>;
71
+ scan(device: device & devicesConfig): Promise<void>;
72
+ statusCode({ res }: {
73
+ res: IncomingMessage;
74
+ }): Promise<void>;
75
+ offlineOff(): Promise<void>;
76
+ apiError(e: any): Promise<void>;
77
+ FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue;
78
+ context(): Promise<void>;
79
+ refreshRate(device: device & devicesConfig): Promise<void>;
80
+ config(device: device & devicesConfig): Promise<void>;
81
+ logs(device: device & devicesConfig): Promise<void>;
82
+ /**
83
+ * Logging for Device
84
+ */
85
+ infoLog(...log: any[]): void;
86
+ warnLog(...log: any[]): void;
87
+ debugWarnLog(...log: any[]): void;
88
+ errorLog(...log: any[]): void;
89
+ debugErrorLog(...log: any[]): void;
90
+ debugLog(...log: any[]): void;
91
+ enablingDeviceLogging(): boolean;
92
+ }
93
+ //# sourceMappingURL=iosensor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iosensor.d.ts","sourceRoot":"","sources":["../../src/device/iosensor.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAY,OAAO,EAAE,MA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