How to use homebridge - 10 common examples

To help you get started, we’ve selected a few homebridge examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / pkg / test / test-79-npm / homebridge / homebridge.js View on Github external
'use strict';

process.argv.push('--help');
require('homebridge/lib/cli.js'); // dont run. only load
var Server = require('homebridge/lib/server.js').Server;
var server = new Server();
if (server._api) { // eslint-disable-line no-underscore-dangle
  console.log('ok');
}
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
.on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxHeatingTemp,
                    minValue: this.config.minHeatingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleHeatingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleHeatingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.RotationSpeed)
                .on(CharacteristicEventTypes.GET, this.handleRotationSpeedGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleRotationSpeedSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.SwingMode)
                .on(CharacteristicEventTypes.GET, this.handleSwingModeGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleSwingModeSet.bind(this));
        });
    }
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
this.log('No air coolers found!');
                return;
            }

            if (this.config.dummy) {
                this.controller = new DummyController(this.airCooler, this.config.updateInterval, this.config.debug ? this.log : () => {});
            } else {
                this.controller = new LgAircoController(this.airCooler, this.config.updateInterval, this.storagePath, this.config.debug, this.logDebug);
            }

            this.handleRotationSpeedSetWithDebounce = AsyncUtils.debounce((newFanSpeed: number) => {
                this.controller.setFanSpeed(WideqAdapter.percentageToFanSpeed(newFanSpeed));
            }, 5000);

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.Active)
                .on(CharacteristicEventTypes.GET, this.handleActiveGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleActiveSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState)
                .on(CharacteristicEventTypes.GET, this.handleCurrentHeaterCoolerStateGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState)
                .setProps({
                    format: Formats.UINT8,
                    maxValue: 2,
                    minValue: 0,
                    validValues: [1, 2],
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleTargetHeaterCoolerStateGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleTargetHeaterCoolerStateSet.bind(this));
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
return;
            }

            if (this.config.dummy) {
                this.controller = new DummyController(this.airCooler, this.config.updateInterval, this.config.debug ? this.log : () => {});
            } else {
                this.controller = new LgAircoController(this.airCooler, this.config.updateInterval, this.storagePath, this.config.debug, this.logDebug);
            }

            this.handleRotationSpeedSetWithDebounce = AsyncUtils.debounce((newFanSpeed: number) => {
                this.controller.setFanSpeed(WideqAdapter.percentageToFanSpeed(newFanSpeed));
            }, 5000);

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.Active)
                .on(CharacteristicEventTypes.GET, this.handleActiveGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleActiveSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState)
                .on(CharacteristicEventTypes.GET, this.handleCurrentHeaterCoolerStateGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState)
                .setProps({
                    format: Formats.UINT8,
                    maxValue: 2,
                    minValue: 0,
                    validValues: [1, 2],
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleTargetHeaterCoolerStateGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleTargetHeaterCoolerStateSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentTemperature)
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
.on(CharacteristicEventTypes.GET, this.handleActiveGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleActiveSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentHeaterCoolerState)
                .on(CharacteristicEventTypes.GET, this.handleCurrentHeaterCoolerStateGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.TargetHeaterCoolerState)
                .setProps({
                    format: Formats.UINT8,
                    maxValue: 2,
                    minValue: 0,
                    validValues: [1, 2],
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleTargetHeaterCoolerStateGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleTargetHeaterCoolerStateSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentTemperature)
                .on(CharacteristicEventTypes.GET, this.handleCurrentTemperatureGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxCoolingTemp,
                    minValue: this.config.minCoolingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleCoolingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxCoolingTemp,
                    minValue: this.config.minCoolingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleCoolingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxHeatingTemp,
                    minValue: this.config.minHeatingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleHeatingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleHeatingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.RotationSpeed)
                .on(CharacteristicEventTypes.GET, this.handleRotationSpeedGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleRotationSpeedSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.SwingMode)
                .on(CharacteristicEventTypes.GET, this.handleSwingModeGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleSwingModeSet.bind(this));
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
.setProps({
                    format: Formats.UINT8,
                    maxValue: 2,
                    minValue: 0,
                    validValues: [1, 2],
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleTargetHeaterCoolerStateGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleTargetHeaterCoolerStateSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentTemperature)
                .on(CharacteristicEventTypes.GET, this.handleCurrentTemperatureGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxCoolingTemp,
                    minValue: this.config.minCoolingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleCoolingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxHeatingTemp,
                    minValue: this.config.minHeatingTemp,
                    minStep: 1,
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
format: Formats.UINT8,
                    maxValue: 2,
                    minValue: 0,
                    validValues: [1, 2],
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleTargetHeaterCoolerStateGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleTargetHeaterCoolerStateSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CurrentTemperature)
                .on(CharacteristicEventTypes.GET, this.handleCurrentTemperatureGet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxCoolingTemp,
                    minValue: this.config.minCoolingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleCoolingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxHeatingTemp,
                    minValue: this.config.minHeatingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
github beele / HomebridgeLgSmartThinqAirco / src / lg-airco-accessory.ts View on Github external
this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.CoolingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxCoolingTemp,
                    minValue: this.config.minCoolingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleCoolingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleCoolingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.HeatingThresholdTemperature)
                .setProps({
                    format: Formats.FLOAT,
                    unit: Units.CELSIUS,
                    maxValue: this.config.maxHeatingTemp,
                    minValue: this.config.minHeatingTemp,
                    minStep: 1,
                    perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE, Perms.NOTIFY]
                })
                .on(CharacteristicEventTypes.GET, this.handleHeatingThresholdTemperatureGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleHeatingThresholdTemperatureSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.RotationSpeed)
                .on(CharacteristicEventTypes.GET, this.handleRotationSpeedGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleRotationSpeedSet.bind(this));

            this.heaterCoolerService.getCharacteristic(this.hap.Characteristic.SwingMode)
                .on(CharacteristicEventTypes.GET, this.handleSwingModeGet.bind(this))
                .on(CharacteristicEventTypes.SET, this.handleSwingModeSet.bind(this));
        });
github tommasomarchionni / homebridge-openhab2 / spec / mocks / homebridgeMock.ts View on Github external
constructor(config) {
    const API = require("homebridge").API;
    this._api = new API();
    this._config = config;
  }