homebridge-sony-audio-extended 0.0.1

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.
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.SonyAudioAccessorySettings = void 0;
23
+ const fs = __importStar(require("fs-extra"));
24
+ const path = __importStar(require("path"));
25
+ /**
26
+ * Represent a settings of Sony Accessory.
27
+ */
28
+ class SonyAudioAccessorySettings {
29
+ constructor(uuid, storagePath, logger) {
30
+ this.uuid = uuid;
31
+ this.storagePath = storagePath;
32
+ this.logger = logger;
33
+ this.filePath = path.resolve(this.storagePath, this.persistKey());
34
+ this.inputs = [];
35
+ }
36
+ static async GetInstance(uuid, storagePath, logger) {
37
+ // HOOBS return not existing path. #10
38
+ // So, create it if it doesn't exist
39
+ try {
40
+ await fs.ensureDir(storagePath);
41
+ }
42
+ catch (error) {
43
+ logger.debug(`The path to save the accessory settings doesn't exist and can't be created: ${storagePath}\nError\n${JSON.stringify(error)}`);
44
+ logger.debug('Accessory settings will be reset after bridge restart');
45
+ }
46
+ const settings = new SonyAudioAccessorySettings(uuid, storagePath, logger);
47
+ await settings.loadSettings();
48
+ return settings;
49
+ }
50
+ async saveSettings() {
51
+ // Allocate item for saving
52
+ const item = {
53
+ inputs: this.inputs,
54
+ };
55
+ try {
56
+ await fs.writeJson(this.filePath, item);
57
+ this.logger.debug(`Settings has been saved at path ${this.filePath}`);
58
+ }
59
+ catch (error) {
60
+ this.logger.debug(`An error occurred while saving the settings.\nError\n${JSON.stringify(error)}`);
61
+ this.logger.debug('Accessory settings will be reset after bridge restart');
62
+ }
63
+ }
64
+ async loadSettings() {
65
+ if (!await fs.pathExists(this.filePath)) {
66
+ this.logger.debug(`Settings not found at path ${this.filePath}`);
67
+ return;
68
+ }
69
+ try {
70
+ const settings = await fs.readJson(this.filePath);
71
+ this.logger.debug(`Settings has been loaded from ${this.filePath}`);
72
+ this.inputs = settings.inputs;
73
+ }
74
+ catch (error) {
75
+ this.logger.debug(`An error occurred while loading the settings.\nError\n${JSON.stringify(error)}`);
76
+ }
77
+ }
78
+ getInput(id) {
79
+ return this.inputs.find(input => input.id === id);
80
+ }
81
+ async getInputName(id, defaultName) {
82
+ let input = this.getInput(id);
83
+ if (input === undefined || input.visibilityState === undefined) {
84
+ input = await this.setInputName(id, defaultName);
85
+ }
86
+ return input.name;
87
+ }
88
+ async getInputVisibility(id, defaultVisibilityState) {
89
+ let input = this.getInput(id);
90
+ if (input === undefined || input.visibilityState === undefined) {
91
+ input = await this.setInputVisibility(id, defaultVisibilityState);
92
+ }
93
+ return input.visibilityState;
94
+ }
95
+ async setInputName(id, name) {
96
+ let input = this.getInput(id);
97
+ if (input && input.name === name) {
98
+ return input;
99
+ }
100
+ if (input) {
101
+ input.name = name;
102
+ }
103
+ else {
104
+ input = { id, name };
105
+ this.inputs.push(input);
106
+ }
107
+ await this.saveSettings();
108
+ return input;
109
+ }
110
+ async setInputVisibility(id, visibilityState) {
111
+ let input = this.getInput(id);
112
+ if (input && input.visibilityState === visibilityState) {
113
+ return input;
114
+ }
115
+ if (input) {
116
+ input.visibilityState = visibilityState;
117
+ }
118
+ else {
119
+ input = { id, visibilityState };
120
+ this.inputs.push(input);
121
+ }
122
+ await this.saveSettings();
123
+ return input;
124
+ }
125
+ /**
126
+ * Gets a key for storing this SonyAudioAccessorySettings in the filesystem, like "SonyAudioAccessorySettings.CC223DE3CEF3.json"
127
+ * @returns
128
+ */
129
+ persistKey() {
130
+ return `SonyAudioAccessorySettings.${this.uuid.replace(/-/g, '').toUpperCase()}.json`;
131
+ }
132
+ }
133
+ exports.SonyAudioAccessorySettings = SonyAudioAccessorySettings;
134
+ //# sourceMappingURL=sonyAudioAccessorySettings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonyAudioAccessorySettings.js","sourceRoot":"","sources":["../src/sonyAudioAccessorySettings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAE/B,2CAA6B;AAkB7B;;GAEG;AACH,MAAa,0BAA0B;IAOrC,YACmB,IAAY,EACZ,WAAmB,EACnB,MAAc;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAY,EAAE,WAAmB,EAAE,MAAc;QACxE,sCAAsC;QACtC,oCAAoC;QACpC,IAAI;YACF,MAAM,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SACjC;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,+EAA+E,WAAW,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC5I,MAAM,CAAC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C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACzB;QACD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAU,EAAE,eAAsB;QACzD,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC9B,IAAI,KAAK,IAAI,KAAK,CAAC,eAAe,KAAK,eAAe,EAAE;YACtD,OAAO,KAAK,CAAC;SACd;QACD,IAAI,KAAK,EAAE;YACT,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;SACzC;aAAM;YACL,KAAK,GAAG,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACzB;QACD,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACK,UAAU;QAChB,OAAO,8BAA8B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC;IACxF,CAAC;CAEF;AArHD,gEAqHC"}
@@ -0,0 +1,377 @@
1
+ /// <reference types="node" />
2
+ import { ExternalTerminal, VolumeInformation } from './api';
3
+ import { AxiosRequestConfig, AxiosResponse } from 'axios';
4
+ import { EventEmitter } from 'events';
5
+ import { Logger } from 'homebridge';
6
+ import { URL } from 'url';
7
+ /**
8
+ * A class of the system info of the device.
9
+ * Docs [here](https://developer.sony.com/develop/audio-control-api/api-references/api-overview-2#_getsysteminformation_v1_4)
10
+ */
11
+ export interface SonyDeviceSystemInformation {
12
+ /**
13
+ * The country code for the device, as a ISO 3166-1 alpha-3 three-letter country code, or "" if it is undefined.
14
+ */
15
+ area: string;
16
+ /**
17
+ * The Bluetooth address of the device.
18
+ */
19
+ bdAddr: string;
20
+ /**
21
+ * The Bluetooth Low Energy ID for the device, or "" if it is not available.
22
+ * This is a 32 bit hash value generated from the Bluetooth address.
23
+ */
24
+ bleID: string;
25
+ /**
26
+ * The server device ID for associating system log data to this device, or "" if it is undefined.
27
+ */
28
+ cid: string;
29
+ /**
30
+ * The general device ID for the device, or "" it if is not available.
31
+ */
32
+ deviceID: string;
33
+ /**
34
+ * The support DUID (DHCP Unique Identifier) for the device, or "" it if is not available.
35
+ * A client can use the DUID to get an IP address from a DHCPv6 server.
36
+ */
37
+ duid: string;
38
+ /**
39
+ * Model name (10 joists) and ID (22 joists) for Netflix.
40
+ */
41
+ esn: string;
42
+ /**
43
+ * The generation number of the device, represented as an X.Y.Z value,
44
+ * where X, Y, and Z are strings composed of letter and number characters; or "" if it is undefined.
45
+ */
46
+ generation: string;
47
+ /**
48
+ * The help URL for the device, or "" it if is undefined.
49
+ */
50
+ helpUrl: string;
51
+ /**
52
+ * The icon URL of the service for the device, or "" if it is undefined.
53
+ */
54
+ iconUrl: string;
55
+ /**
56
+ * The initial power-on time for the device, in ISO8601 format, or "" if it is not available.
57
+ */
58
+ initialPowerOnTime: string;
59
+ /**
60
+ * The language code for the device, as a ISO 3166-1 alpha-3 three-letter country code, or "" if it is undefined.
61
+ */
62
+ language: string;
63
+ /**
64
+ * The last power-on time for the device, in ISO8601 format, or "" if it is not available.
65
+ */
66
+ lastPowerOnTime: string;
67
+ /**
68
+ * The Ethernet MAC address of the device, or "" if it is not available.
69
+ */
70
+ macAddr: string;
71
+ /**
72
+ * The unique name of the product model, or "" if it is undefined.
73
+ */
74
+ model: string;
75
+ /**
76
+ * The product name for the device, or "" if it is not available.
77
+ */
78
+ name: string;
79
+ /**
80
+ * The device category, or "" if it is undefined.
81
+ */
82
+ product: string;
83
+ /**
84
+ * The sales region for the device, as a ISO 3166-1 alpha-3 three-letter country code, or "" if it is undefined.
85
+ */
86
+ region: string;
87
+ /**
88
+ * The serial number of the device, or "" if it is not available.
89
+ */
90
+ serial: string;
91
+ /**
92
+ * The network SSID of the access point to which the device is connected, or "" if it is undefined.
93
+ */
94
+ ssid: string;
95
+ /**
96
+ * Version information for the device, or "" it if is not available.
97
+ */
98
+ version: string;
99
+ /**
100
+ * The wireless MAC address for the device, or "" if it is undefined.
101
+ */
102
+ wirelessMacAddr: string;
103
+ }
104
+ /**
105
+ * This API provides supported services and its information.
106
+ * This API is used in the initialization sequence to dynamically fetch the service compatibility of server.
107
+ * Docs [here] (https://developer.sony.com/develop/audio-control-api/api-references/api-overview-2#_getsupportedapiinfo_v1_0)
108
+ */
109
+ export interface SonyDeviceApiInfo {
110
+ /**
111
+ * Supported APIs.
112
+ */
113
+ apis: {
114
+ /**
115
+ * Name of this API.
116
+ */
117
+ name: string;
118
+ /**
119
+ * Detail of supported versions of this API.
120
+ */
121
+ versions: {
122
+ /**
123
+ * Authentication level of this API.
124
+ */
125
+ authLevel: string;
126
+ /**
127
+ * Transport for this API, if there are any exception from that of belonging service.
128
+ */
129
+ protocols: string;
130
+ /**
131
+ * Version of this API.
132
+ */
133
+ version: string;
134
+ }[];
135
+ }[];
136
+ /**
137
+ * Supported Notification APIs.
138
+ */
139
+ notifications: {
140
+ /**
141
+ * Name of this API.
142
+ */
143
+ name: string;
144
+ /**
145
+ * Detail of supported versions of this API.
146
+ */
147
+ versions: {
148
+ /**
149
+ * Authentication level of this API.
150
+ */
151
+ authLevel: string;
152
+ /**
153
+ * Version of this API.
154
+ */
155
+ version: string;
156
+ }[];
157
+ }[];
158
+ /**
159
+ * Supported transports.
160
+ */
161
+ protocols: string[];
162
+ /**
163
+ * Name of this service.
164
+ */
165
+ service: string;
166
+ }
167
+ export declare const enum DEVICE_EVENTS {
168
+ VOLUME = "volume",
169
+ MUTE = "mute",
170
+ POWER = "power",
171
+ SOURCE = "source",
172
+ /** Emit when device has been restored connection */
173
+ RESTORE = "restore"
174
+ }
175
+ declare type apiRequest = {
176
+ version: string;
177
+ method: string;
178
+ };
179
+ export declare class SonyDevice extends EventEmitter {
180
+ private readonly log;
181
+ /** The device is creating. */
182
+ static CREATING: number;
183
+ /** The device is ready to communicate. */
184
+ static READY: number;
185
+ /** The device is in the process of closing. */
186
+ static CLOSING: number;
187
+ /** The current state of the device */
188
+ private readyState;
189
+ /** Flag for emitting of the RESORE event, rised when connection has been lost and after restored */
190
+ private emitRestoreEvent;
191
+ systemInfo: SonyDeviceSystemInformation;
192
+ apisInfo: SonyDeviceApiInfo[];
193
+ private _externalTerminals;
194
+ private _volumeInformation;
195
+ private axiosInstance;
196
+ private axiosInstanceSoap?;
197
+ private wsClients;
198
+ baseUrl: URL;
199
+ upnpUrl?: URL;
200
+ UDN: string;
201
+ manufacturer: string;
202
+ private constructor();
203
+ /**
204
+ * Return device id
205
+ */
206
+ getDeviceID(): string;
207
+ /**
208
+ * Checks the request for API version compliance
209
+ */
210
+ validateRequest(service: string, request: apiRequest): boolean;
211
+ getExternalTerminals(): Promise<ExternalTerminal[] | null>;
212
+ /**
213
+ * Terminal is read-only and cannot be select by the user?
214
+ */
215
+ isReadonlyTerminal(terminal: ExternalTerminal): boolean;
216
+ getVolumeInformation(): Promise<VolumeInformation[] | null>;
217
+ /**
218
+ * Returns the active input (if exist) for current active zone
219
+ */
220
+ getActiveInput(): Promise<ExternalTerminal | null>;
221
+ /**
222
+ * Return external terminals which are inputs
223
+ */
224
+ getInputs(): Promise<ExternalTerminal[]>;
225
+ /**
226
+ * Return external terminals which are zone, aka outputs
227
+ */
228
+ getZones(): Promise<ExternalTerminal[] | null>;
229
+ /**
230
+ * Return active zone.
231
+ * If no active zone, return `null`.
232
+ * It's mean that only one zone exist, i.e. no output terminals
233
+ */
234
+ getActiveZone(): Promise<ExternalTerminal | null>;
235
+ /**
236
+ * Return the list of schemes that device can handle.
237
+ */
238
+ private getSchemes;
239
+ /**
240
+ * Check the API response for returned error
241
+ * Decsription of errors [here](https://developer.sony.com/develop/audio-control-api/api-references/error-codes).
242
+ * @param response
243
+ */
244
+ static responseInterceptor(log: Logger): (response: AxiosResponse) => AxiosResponse<any, any> | Promise<never>;
245
+ /**
246
+ * Logging requests for debug
247
+ * @param request
248
+ */
249
+ static requestInterceptorLogger(log: Logger): (request: AxiosRequestConfig) => AxiosRequestConfig<any>;
250
+ /**
251
+ * Create and initialize the new device.
252
+ * Get info about supported api and system
253
+ */
254
+ static createDevice(baseUrl: URL, upnpUrl: URL | undefined, udn: string, log: Logger): Promise<SonyDevice>;
255
+ /**
256
+ * Initialize notifications for given events
257
+ */
258
+ subscribe(): void;
259
+ /**
260
+ * Disable all notifications subscriptions and close websocket connections
261
+ */
262
+ unsubscribe(): void;
263
+ /**
264
+ * Create a new socket for the given service.
265
+ * If socket already exist, only request current notifications subscriptions
266
+ * @param service
267
+ * @returns
268
+ */
269
+ private createWebSocket;
270
+ /**
271
+ * A switchNotifications Request
272
+ * taken [here](https://developer.sony.com/develop/audio-control-api/get-started/websocket-example#tutorial-step-3)
273
+ * @param id
274
+ * @param disable
275
+ * @param enable
276
+ */
277
+ private switchNotifications;
278
+ /**
279
+ * Returns all availible notifications of the device
280
+ * @param service
281
+ * @returns
282
+ */
283
+ private getAvailibleNotifications;
284
+ /**
285
+ * Parse the notification message recieved from device
286
+ * @param message
287
+ */
288
+ private handleNotificationMessage;
289
+ /**
290
+ * Find a terminal by source name
291
+ * @param source the source name received from notifyPlayingContentInfo event
292
+ */
293
+ getTerminalBySource(source: string): ExternalTerminal | null;
294
+ /**
295
+ * Get current power state.
296
+ * * `true` if power is on
297
+ */
298
+ getPowerState(): Promise<boolean>;
299
+ /**
300
+ * Get current volume state with device volume settings
301
+ * Volume state returns only for active zone. If no active zone then returns null
302
+ */
303
+ getVolumeState(): Promise<VolumeInformation | null>;
304
+ /**
305
+ * Change the audio volume level for the active output zone
306
+ * @param volumeSelector the same as Characteristic.VolumeSelector in homebridge
307
+ * * `0` - increment
308
+ * * `1` - decrement
309
+ */
310
+ setVolume(volumeSelector: 0 | 1): Promise<0 | 1>;
311
+ /**
312
+ * Sets the power status of the device.
313
+ * @param power
314
+ * * `true` - set device in the power-on state
315
+ * * `false` - set device in the power-off state
316
+ */
317
+ setPower(power: boolean): Promise<boolean>;
318
+ /**
319
+ * Sets the audio mute status.
320
+ * @param mute
321
+ * * `true` - muted
322
+ * * `false` - not muted
323
+ */
324
+ setMute(mute: boolean): Promise<boolean>;
325
+ /**
326
+ * Sets the input source
327
+ * @param terminal
328
+ */
329
+ setSource(terminal: ExternalTerminal): Promise<ExternalTerminal>;
330
+ /**
331
+ * Toggles between the play and pause states for the current content.
332
+ */
333
+ setPause(): Promise<void>;
334
+ /**
335
+ * Sends command codes of IR remote commander to device via IP
336
+ * Some info [here](https://pro-bravia.sony.net/develop/integrate/ircc-ip/overview/index.html)
337
+ * @param irCode
338
+ */
339
+ sendIRCC(irCode: string): Promise<void>;
340
+ /**
341
+ * Press Arrow Up to select the menu items
342
+ * @returns
343
+ */
344
+ setUp(): Promise<void>;
345
+ /**
346
+ * Press Arrow Down to select the menu items
347
+ * @returns
348
+ */
349
+ setDown(): Promise<void>;
350
+ /**
351
+ * Press Arrow Right to select the menu items
352
+ * @returns
353
+ */
354
+ setRigth(): Promise<void>;
355
+ /**
356
+ * Press Arrow Left to select the menu items
357
+ * @returns
358
+ */
359
+ setLeft(): Promise<void>;
360
+ /**
361
+ * Press Select to enter the selection
362
+ * @returns
363
+ */
364
+ setSelect(): Promise<void>;
365
+ /**
366
+ * Press Back for returns to the previous menu or exits a menu
367
+ * @returns
368
+ */
369
+ setBack(): Promise<void>;
370
+ /**
371
+ * Press Information for view some info
372
+ * @returns
373
+ */
374
+ setInformation(): Promise<void>;
375
+ }
376
+ export {};
377
+ //# sourceMappingURL=sonyDevice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonyDevice.d.ts","sourceRoot":"","sources":["../src/sonyDevice.ts"],"names":[],"mappings":";AAAA,OAAO,EA2BL,gBAAgB,EAMhB,iBAAiB,EAClB,MAAM,OAAO,CAAC;AACf,OAAc,EAAiB,kBAAkB,EAAE,aAAa,EAAE,MA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