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

homebridge-syntex-magichome

Package Overview
Dependencies
Maintainers
1
Versions
423
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-syntex-magichome - npm Package Compare versions

Comparing version 1.0.0-b24 to 1.0.0-b25

2

package.json
{
"name": "homebridge-syntex-magichome",
"version": "1.0.0-b24",
"version": "1.0.0-b25",
"description": "Homebridge Plugin for MagicHome LED Strips with preset scenes",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,70 +0,79 @@

//
// base.js
// Sahil Chaddha
//
// Created by Sahil Chaddha on 13/08/2018.
// Copyright © 2018 sahilchaddha.com. All rights reserved.
//
const cp = require('child_process');
const path = require('path');
const lightAgent = require('../lib/lightAgent');
const cp = require('child_process')
const path = require('path')
const lightAgent = require('../lib/lightAgent')
const Accessory = class
{
constructor(config, log, homebridge)
{
this.homebridge = homebridge;
this.log = log;
this.config = config;
this.name = config.name;
this.services = this.getAccessoryServices();
const Accessory = class {
constructor(config, log, homebridge) {
this.homebridge = homebridge
this.log = log
this.config = config
this.name = config.name
this.services = this.getAccessoryServices()
this.services.push(this.getInformationService())
}
this.services.push(this.getInformationService());
}
identify(callback) {
callback()
}
identify(callback)
{
callback();
}
getInformationService() {
var informationService = new this.homebridge.Service.AccessoryInformation()
informationService
.setCharacteristic(this.homebridge.Characteristic.Manufacturer, 'SynTex MagicHome')
.setCharacteristic(this.homebridge.Characteristic.Model, this.getModelName())
.setCharacteristic(this.homebridge.Characteristic.SerialNumber, this.getSerialNumber())
return informationService
}
getInformationService()
{
var informationService = new this.homebridge.Service.AccessoryInformation();
executeCommand(address, command, callback) {
const exec = cp.exec
const self = this
const cmd = path.join(__dirname, '../flux_led.py ' + lightAgent.getAddress(address) + command)
if (self.homebridge.debug) {
self.log(cmd)
}
exec(cmd, (err, stdOut) => {
if (self.homebridge.debug) {
self.log(stdOut)
}
if (callback) {
callback(err, stdOut)
}
})
}
informationService.setCharacteristic(this.homebridge.Characteristic.Manufacturer, 'MagicHome')
.setCharacteristic(this.homebridge.Characteristic.Model, this.getModelName())
.setCharacteristic(this.homebridge.Characteristic.SerialNumber, this.getSerialNumber());
getAccessoryServices() {
throw new Error('The getSystemServices method must be overridden.')
}
return informationService;
}
getModelName() {
throw new Error('The getModelName method must be overridden.')
}
executeCommand(address, command, callback)
{
const exec = cp.exec;
const self = this;
const cmd = path.join(__dirname, '../flux_led.py ' + lightAgent.getAddress(address) + command);
getSerialNumber() {
throw new Error('The getSerialNumber method must be overridden.')
}
if(self.homebridge.debug)
{
self.log(cmd);
}
getServices() {
return this.services
}
exec(cmd, (err, stdOut) => {
if(self.homebridge.debug)
{
self.log(stdOut);
}
if(callback)
{
callback(err, stdOut);
}
});
}
getAccessoryServices()
{
throw new Error('The getSystemServices method must be overridden.');
}
getModelName()
{
throw new Error('The getModelName method must be overridden.');
}
getSerialNumber()
{
throw new Error('The getSerialNumber method must be overridden.');
}
getServices()
{
return this.services;
}
}
module.exports = Accessory
module.exports = Accessory;

@@ -1,5 +0,7 @@

const EventEmitter = require('events')
const EventEmitter = require('events');
class MyEmitter extends EventEmitter { }
const emitter = new MyEmitter()
module.exports = emitter
class MyEmitter extends EventEmitter {}
const emitter = new MyEmitter();
module.exports = emitter;
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