Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

homebridge-xiaomi-yeelight

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-xiaomi-yeelight - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

6

dist/platformAccessory.d.ts

@@ -19,2 +19,4 @@ import { PlatformAccessory, CharacteristicValue } from 'homebridge';

constructor(platform: XiaomiYeelightPlatform, accessory: PlatformAccessory);
convertColorTempFromKelvinToMired(value: number): number;
convertColorTempFromMiredToKelvin(value: number): number;
/**

@@ -39,3 +41,7 @@ * Handle "SET" requests from HomeKit

getOn(): Promise<CharacteristicValue>;
setBrightness(value: CharacteristicValue): Promise<void>;
getBrightness(): Promise<CharacteristicValue>;
setColorTemperature(value: CharacteristicValue): Promise<void>;
getColorTemperature(): Promise<CharacteristicValue>;
}
//# sourceMappingURL=platformAccessory.d.ts.map

72

dist/platformAccessory.js

@@ -49,8 +49,16 @@ "use strict";

// // register handlers for the Brightness Characteristic
// this.service.getCharacteristic(this.platform.Characteristic.Brightness)
// .onSet(this.setBrightness.bind(this)); // SET - bind to the 'setBrightness` method below
this.service.getCharacteristic(this.platform.Characteristic.Brightness)
.onSet(this.setBrightness.bind(this)) // SET - bind to the 'setBrightness` method below
.onGet(this.getBrightness.bind(this)); // SET - bind to the 'setBrightness` method below
// // register handlers for the ColorTemperature Characteristic
// this.service.getCharacteristic(this.platform.Characteristic.ColorTemperature)
// .onSet(this.setColorTemperature.bind(this)); // SET - bind to the 'setColorTemperature` method below
this.service.getCharacteristic(this.platform.Characteristic.ColorTemperature)
.onSet(this.setColorTemperature.bind(this)) // SET - bind to the 'setColorTemperature` method below
.onGet(this.getColorTemperature.bind(this)); // SET - bind to the 'setColorTemperature` method below
}
convertColorTempFromKelvinToMired(value) {
return 1000000 / value;
}
convertColorTempFromMiredToKelvin(value) {
return 1000000 / value;
}
/**

@@ -94,4 +102,60 @@ * Handle "SET" requests from HomeKit

}
// /**
// * Handle "SET" requests from HomeKit
// * These are sent when the user changes the state of an accessory, for example, changing the Brightness
// */
async setBrightness(value) {
// implement your own code to set the brightness
this.state.Brightness = value;
this.platform.log.info('setting brightness to', value);
try {
await this.connection.setBrightness(value);
this.platform.log.info('brightness set successfully');
}
catch (e) {
this.platform.log.error(e);
}
}
// /**
// * Handle "SET" requests from HomeKit
// * These are sent when the user changes the state of an accessory, for example, changing the Brightness
// */
async getBrightness() {
try {
this.platform.log.info('requesting brightness');
const brightness = await this.connection.brightness();
return brightness;
}
catch (e) {
this.platform.log.error(e);
throw new this.platform.api.hap.HapStatusError(-70402 /* SERVICE_COMMUNICATION_FAILURE */);
}
}
async setColorTemperature(value) {
// implement your own code to set the brightness
this.state.ColorTemperature = value;
this.platform.log.info('setting color temp to', value, 'in kelvin:', this.convertColorTempFromMiredToKelvin(value));
try {
await this.connection.colorthis.convertColorTempFromMiredToKelvin(value);
this.platform.log.info('color temp set successfully');
}
catch (e) {
this.platform.log.error(e);
}
}
async getColorTemperature() {
try {
this.platform.log.info('requesting color temperature');
let colorTemp = await this.connection.color();
colorTemp = this.convertColorTempFromKelvinToMired(colorTemp.values[0]);
this.platform.log.info(colorTemp);
return colorTemp;
}
catch (e) {
this.platform.log.error(e);
throw new this.platform.api.hap.HapStatusError(-70402 /* SERVICE_COMMUNICATION_FAILURE */);
}
}
}
exports.Light = Light;
//# sourceMappingURL=platformAccessory.js.map

2

package.json
{
"displayName": "Xiaomi Yeelight Support",
"name": "homebridge-xiaomi-yeelight",
"version": "1.0.4",
"version": "1.0.5",
"description": "A short description about what your plugin does.",

@@ -6,0 +6,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc