homebridge-saphi-tv
Version:
This plugin allows you to control your SaphiOS PhilipsTV with support for Apps, Sources and Channels as well as Ambilight, Ambilight+Hue and a CC Remote.
65 lines • 2.94 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Configuration = void 0;
class Configuration {
constructor(config) {
var _a;
this.config = config;
// required properties
this.ip_address = config.ip_adress;
this.wol_url = config.wol_adress;
this.inputs = config.inputs;
this.name = config.name;
if (!((_a = this.wol_url) === null || _a === void 0 ? void 0 : _a.startsWith('wol://'))) {
this.wol_url = 'wol://' + this.wol_url;
}
// timings
this.polling_interval = config.polling_interval * 1000 || 30000;
this.startup_time = config.startup_time * 1000 || 15000;
this.timeout = config.timeout * 1000 || 5000;
this.channel_setup_popup_time = config.channel_setup_popup_time || 2250;
this.input_delay = config.input_delay || 650;
// api settings
this.protocol = config.protocol || 'http';
this.port_no = config.api_port_no || 1925;
this.api_version = config.api_version || 6;
// capabilities
this.has_ambihue = config.has_ambihue;
this.has_ambilight = config.has_ambilight;
this.ambi_poweron = config.ambi_poweron || false;
this.ambi_poweroff = config.ambi_poweroff || false;
this.vertical_inputs = config.vertical_inputs || false;
this.multirow_apps = config.multirow_apps || false;
// tv settings
this.has_tv_channels = !config.has_tv_channels || true;
// urls
this.base_url = this.protocol + '://' + this.ip_address + ':' + this.port_no + '/' + this.api_version;
this.power_url = this.base_url + '/powerstate';
this.ambihue_url = this.base_url + '/HueLamp/power';
this.ambilight_url = this.base_url + '/ambilight/power';
this.input_url = this.base_url + '/input/key';
this.audio_url = this.base_url + '/audio/volume';
if (this.has_ambilight === false) {
this.has_ambihue = false;
}
if (this.has_ambihue === false) {
this.ambi_poweron = false;
this.ambi_poweroff = false;
}
// keep timings in range
if (this.startup_time < 5 * 1000 || typeof this.startup_time !== 'number' || isNaN(this.startup_time)) {
this.startup_time = 10 * 1000;
}
if (this.polling_interval < 15 * 1000 || typeof this.polling_interval !== 'number' || isNaN(this.polling_interval)) {
this.polling_interval = 30 * 1000;
}
if (this.input_delay < 150 || typeof this.input_delay !== 'number' || isNaN(this.input_delay)) {
this.input_delay = 600;
}
if (this.timeout < 2 * 1000 || typeof this.timeout !== 'number' || isNaN(this.timeout)) {
this.timeout = 5 * 1000;
}
}
}
exports.Configuration = Configuration;
//# sourceMappingURL=configuration.js.map