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

homebridge-plugin-govee

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-plugin-govee - npm Package Compare versions

Comparing version 1.0.8 to 1.0.12

2

dist/index.d.ts

@@ -1,2 +0,2 @@

import { API } from 'homebridge';
import { API } from "homebridge";
declare const _default: (api: API) => void;

@@ -3,0 +3,0 @@ /**

@@ -1,2 +0,2 @@

import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from 'homebridge';
import { API, DynamicPlatformPlugin, Logger, PlatformAccessory, PlatformConfig, Service, Characteristic } from "homebridge";
/**

@@ -3,0 +3,0 @@ * HomebridgePlatform

@@ -18,6 +18,7 @@ "use strict";

this.Service = this.api.hap.Service;
this.Characteristic = this.api.hap.Characteristic;
this.Characteristic = this.api.hap
.Characteristic;
// this is used to track restored cached accessories
this.accessories = [];
this.log.info('Finished initializing platform:', this.config.name);
this.log.info("Finished initializing platform:", this.config.name);
// When this event is fired it means Homebridge has restored all cached accessories from disk.

@@ -27,4 +28,4 @@ // Dynamic Platform plugins should only register new accessories after this event was fired,

// to start discovery of new accessories.
this.api.on('didFinishLaunching', () => {
log.debug('Executed didFinishLaunching callback');
this.api.on("didFinishLaunching", () => {
log.debug("Executed didFinishLaunching callback");
// run the method to discover / register your devices as accessories

@@ -39,3 +40,3 @@ this.discoverDevices();

configureAccessory(accessory) {
this.log.info('Loading accessory from cache:', accessory.displayName);
this.log.info("Loading accessory from cache:", accessory.displayName);
// add the restored accessory to the accessories cache so we can track if it has already been registered

@@ -50,3 +51,3 @@ this.accessories.push(accessory);

discoverDevices() {
this.log.debug('Start discovery');
this.log.debug("Start discovery");
if (this.config.debug) {

@@ -57,7 +58,11 @@ govee_bt_client_1.debug(true);

govee_bt_client_1.startDiscovery((reading) => {
this.log.debug('Govee reading', reading);
this.log.debug("Govee reading", reading);
let deviceUniqueId = reading.uuid;
if (reading.model !== '') {
if (reading.model) {
deviceUniqueId = reading.model;
}
if (!deviceUniqueId) {
this.log.error("device missing unique identifier. Govee reading: ", reading);
return;
}
// discovered devices and register each one if it has not already been registered

@@ -70,3 +75,3 @@ // generate a unique id for the accessory this should be generated from

// the cached devices we stored in the `configureAccessory` method above
const existingAccessory = this.accessories.find(accessory => accessory.UUID === uuid);
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
if (discoveryCache.has(uuid)) {

@@ -79,3 +84,3 @@ const cachedInstance = discoveryCache.get(uuid);

// the accessory already exists
this.log.info('Restoring existing accessory from cache:', existingAccessory.displayName);
this.log.info("Restoring existing accessory from cache:", existingAccessory.displayName);
// if you need to update the accessory.context then you should run `api.updatePlatformAccessories`. eg.:

@@ -93,3 +98,3 @@ existingAccessory.context.batteryThreshold = this.config.batteryThreshold;

// the accessory does not yet exist, so we need to create it
this.log.info('Adding new accessory:', displayName);
this.log.info("Adding new accessory:", displayName);
// create a new accessory

@@ -111,3 +116,5 @@ const accessory = new this.api.platformAccessory(displayName, uuid);

// link the accessory to your platform
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [
accessory,
]);
discoveryCache.set(uuid, newInstance);

@@ -120,3 +127,3 @@ }

sanitize(s) {
return s.trim().replace('_', '');
return s.trim().replace("_", "");
}

@@ -123,0 +130,0 @@ }

@@ -1,4 +0,4 @@

import { PlatformAccessory, CharacteristicGetCallback } from 'homebridge';
import { GoveeHomebridgePlatform } from './platform';
import { GoveeReading } from 'govee-bt-client';
import { PlatformAccessory, CharacteristicGetCallback } from "homebridge";
import { GoveeHomebridgePlatform } from "./platform";
import { GoveeReading } from "govee-bt-client";
/**

@@ -5,0 +5,0 @@ * Platform Accessory

@@ -18,3 +18,3 @@ "use strict";

if (!accessory.context.device) {
throw new Error('Missing device context');
throw new Error("Missing device context");
}

@@ -30,4 +30,4 @@ const deviceContext = accessory.context.device;

const accessoryInformationService = this.accessory.getService(this.platform.Service.AccessoryInformation);
accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(this.platform.Characteristic.Manufacturer, 'Govee').setCharacteristic(this.platform.Characteristic.Model, deviceContext.model);
if (deviceContext.address && deviceContext.address !== '') {
accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(this.platform.Characteristic.Manufacturer, "Govee").setCharacteristic(this.platform.Characteristic.Model, deviceContext.model);
if (deviceContext.address && deviceContext.address !== "") {
accessoryInformationService === null || accessoryInformationService === void 0 ? void 0 : accessoryInformationService.setCharacteristic(this.platform.Characteristic.SerialNumber, deviceContext.address);

@@ -37,21 +37,27 @@ }

// you can create multiple services for each accessory
this.humiditySensor = this.accessory.getService(this.platform.Service.HumiditySensor)
|| this.accessory.addService(this.platform.Service.HumiditySensor);
this.humiditySensor =
this.accessory.getService(this.platform.Service.HumiditySensor) ||
this.accessory.addService(this.platform.Service.HumiditySensor);
this.humiditySensor.setCharacteristic(this.platform.Characteristic.Name, deviceContext.model);
// each service must implement at-minimum the "required characteristics" for the given service type
// see https://developers.homebridge.io/#/service/Lightbulb
this.humiditySensor.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
.on('get', this.getCurrentRelativeHumidity.bind(this));
this.humiditySensor.getCharacteristic(this.platform.Characteristic.StatusLowBattery)
.on('get', this.getStatusLowBattery.bind(this));
this.temperatureSensor = this.accessory.getService(this.platform.Service.TemperatureSensor)
|| this.accessory.addService(this.platform.Service.TemperatureSensor);
this.temperatureSensor.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
.on('get', this.getCurrentTemperature.bind(this));
this.temperatureSensor.getCharacteristic(this.platform.Characteristic.StatusLowBattery)
.on('get', this.getStatusLowBattery.bind(this));
this.humiditySensor
.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
.on("get", this.getCurrentRelativeHumidity.bind(this));
this.humiditySensor
.getCharacteristic(this.platform.Characteristic.StatusLowBattery)
.on("get", this.getStatusLowBattery.bind(this));
this.temperatureSensor =
this.accessory.getService(this.platform.Service.TemperatureSensor) ||
this.accessory.addService(this.platform.Service.TemperatureSensor);
this.temperatureSensor
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
.on("get", this.getCurrentTemperature.bind(this));
this.temperatureSensor
.getCharacteristic(this.platform.Characteristic.StatusLowBattery)
.on("get", this.getStatusLowBattery.bind(this));
}
getCurrentRelativeHumidity(callback) {
var _a, _b;
this.platform.log.debug('getCurrentRelativeHumidity', (_a = this.lastReading) === null || _a === void 0 ? void 0 : _a.humidity, "offset", this.HUMIDITY_OFFSET);
this.platform.log.debug("getCurrentRelativeHumidity", (_a = this.lastReading) === null || _a === void 0 ? void 0 : _a.humidity, "offset", this.HUMIDITY_OFFSET);
callback(null, ((_b = this.lastReading) === null || _b === void 0 ? void 0 : _b.humidity) + this.HUMIDITY_OFFSET);

@@ -61,3 +67,3 @@ }

var _a;
this.platform.log.debug('getStatusLowBattery');
this.platform.log.debug("getStatusLowBattery");
callback(null, ((_a = this.lastReading) === null || _a === void 0 ? void 0 : _a.battery) <= this.LOW_BATTERY_THRESHOLD);

@@ -67,3 +73,3 @@ }

var _a, _b;
this.platform.log.debug('getCurrentTemperature', (_a = this.lastReading) === null || _a === void 0 ? void 0 : _a.tempInC);
this.platform.log.debug("getCurrentTemperature", (_a = this.lastReading) === null || _a === void 0 ? void 0 : _a.tempInC);
callback(null, (_b = this.lastReading) === null || _b === void 0 ? void 0 : _b.tempInC);

@@ -70,0 +76,0 @@ }

@@ -7,7 +7,7 @@ "use strict";

*/
exports.PLATFORM_NAME = 'GoveeHomebridgePlugin';
exports.PLATFORM_NAME = "GoveeHomebridgePlugin";
/**
* This must match the name of your plugin as defined the package.json
*/
exports.PLUGIN_NAME = 'homebridge-plugin-govee';
exports.PLUGIN_NAME = "homebridge-plugin-govee";
//# sourceMappingURL=settings.js.map
{
"displayName": "Govee Thermometer Hygrometer Homebridge Plugin",
"name": "homebridge-plugin-govee",
"version": "1.0.8",
"version": "1.0.12",
"description": "Homebridge plugin for Govee H5xxx Bluetooth Thermometer Hygrometer.",

@@ -32,6 +32,8 @@ "license": "Apache-2.0",

"H5101",
"H5102"
"H5102",
"H5179"
],
"dependencies": {
"govee-bt-client": "^1.0.7"
"@abandonware/noble": "1.9.2-11",
"govee-bt-client": "1.0.11"
},

@@ -38,0 +40,0 @@ "devDependencies": {

@@ -23,3 +23,3 @@

* Govee H5102
* Govee H5179
## Prerequisites

@@ -26,0 +26,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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