Socket
Socket
Sign inDemoInstall

homebridge-syntex-dynamic-platform

Package Overview
Dependencies
Maintainers
1
Versions
345
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-syntex-dynamic-platform - npm Package Compare versions

Comparing version 1.0.8-b4 to 1.0.8-b40

43

main.js

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

const axios = require('axios'), fs = require('fs'), path = require('path');
const fs = require('fs'), path = require('path');

@@ -25,3 +25,3 @@ const ContextManager = require('./src/context');

let logger = require('syntex-logger'), AutomationSystem = require('syntex-automation'), FileSystem = require('syntex-filesystem'), WebServer = require('syntex-webserver'), EventManager = require('./src/event-manager'), TypeManager = require('./src/type-manager');
let logger = require('syntex-logger'), AutomationSystem = require('syntex-automation'), Basic = require('syntex-basic'), FileManager = require('syntex-filesystem'), WebServer = require('syntex-webserver'), TypeManager = require('./src/type-manager');

@@ -41,4 +41,2 @@ let DynamicPlatform = class SynTexDynamicPlatform

this.options = {};
this.api = api;

@@ -53,12 +51,7 @@ this.config = config;

if(config['options'] != null)
{
this.options = config['options'];
}
this.options = config['options'] || {};
this.port = this.options['port'];
this.debug = this.options['debug'] || false;
this.language = this.options['language'] || 'en';
this.logger = new logger(this);
this.logger = new logger(this, { language : this.options['language'] || 'en', levels : this.config['log'] });

@@ -80,7 +73,10 @@ if(config['baseDirectory'] != null)

}
else
{
this.logger.log('error', 'bridge', 'Bridge', '%no_base_path%!');
}
this.files = new FileSystem(this, { initDirectories : ['activity', 'automation', 'log'] });
this.files = new FileManager(this, { initDirectories : ['activity', 'automation', 'log'] });
this.TypeManager = new TypeManager(this.logger);
this.EventManager = new EventManager(this);
this.ContextManager = new ContextManager(this);

@@ -95,2 +91,7 @@

this.Basic = new Basic({ ...this, loggerSpecial : this.logger });
this.EventManager = this.Basic.getEventManager();
this.RequestManager = this.Basic.getRequestManager();
this.AutomationSystem = new AutomationSystem(this);

@@ -472,3 +473,3 @@

{
var url = 'http://syntex.sytes.net:8800/init-bridge?id=' + bridgeID + '&plugin=' + this.pluginName + '&version=' + this.pluginVersion + '&name=' + this.bridgeName;
var url = 'http://syntex-cloud.com:8888/init-bridge?id=' + bridgeID + '&plugin=' + this.pluginName + '&version=' + this.pluginVersion + '&name=' + this.bridgeName;

@@ -480,9 +481,9 @@ if(initBridge)

axios.get(url).then((data) => {
this.RequestManager.fetch(url).then((response) => {
if(data != null && data.data != null)
if(response.data != null)
{
if(data.data != bridgeID)
if(response.data != bridgeID)
{
setTimeout(() => this.setBridgeID(data.data), 10000);
setTimeout(() => this.setBridgeID(response.data), 10000);
}

@@ -494,8 +495,2 @@ }

}
}).catch((e) => {
this.logger.err(e);
setTimeout(() => this.connectBridge(bridgeID, initBridge), 30000);
});

@@ -502,0 +497,0 @@ }

{
"name": "homebridge-syntex-dynamic-platform",
"version": "1.0.8-b4",
"version": "1.0.8-b40",
"description": "A Dynamic Platform Accessory",

@@ -12,7 +12,7 @@ "main": "main.js",

"dependencies": {
"axios": "^0.21.1",
"syntex-automation": "1.2.0",
"syntex-filesystem": "1.0.2",
"syntex-logger": "1.0.8",
"syntex-webserver": "1.1.0"
"syntex-automation": "1.2.1-b14",
"syntex-basic": "1.0.0-b18",
"syntex-filesystem": "1.0.3-b9",
"syntex-logger": "1.0.9-b2",
"syntex-webserver": "1.1.1-b14"
},

@@ -43,4 +43,5 @@ "keywords": [

"devDependencies": {
"eslint": "^8.7.0"
"eslint": "^8.7.0",
"eslint-plugin-react": "^7.31.11"
}
}

@@ -16,2 +16,11 @@ const DimmedBulbService = require('./dimmedBulb');

this.saturation = super.getValue('saturation');
this.tempState = {
value : this.value,
hue : this.hue,
saturation : this.saturation,
brightness : this.brightness
};
this.running = false;

@@ -77,2 +86,72 @@ homebridgeAccessory.getServiceById(this.Service.Lightbulb, serviceConfig.subtype).getCharacteristic(this.Characteristic.Hue).on('get', this.getHue.bind(this)).on('set', this.setHue.bind(this));

}
setToCurrentColor(state, powerCallback, colorCallback, unchangedCallback)
{
if(state.value != null && (!super.hasState('value') || this.tempState.value != state.value))
{
this.tempState.value = state.value;
this.changedPower = true;
}
if(state.hue != null && (!super.hasState('hue') || this.tempState.hue != state.hue))
{
this.tempState.hue = state.hue;
this.changedColor = true;
}
if(state.saturation != null && (!super.hasState('saturation') || this.tempState.saturation != state.saturation))
{
this.tempState.saturation = state.saturation;
this.changedColor = true;
}
if(state.brightness != null && (!super.hasState('brightness') || this.tempState.brightness != state.brightness))
{
this.tempState.brightness = state.brightness;
this.changedColor = true;
}
if(!this.running)
{
this.running = true;
setTimeout(() => {
if(this.changedPower)
{
powerCallback(() => {
this.changedPower = false;
this.running = false;
});
}
else if(this.changedColor)
{
colorCallback(() => {
this.changedColor = false;
this.running = false;
});
}
else
{
unchangedCallback(() => {
this.running = false;
});
}
}, 10);
}
else
{
unchangedCallback(() => {});
}
}
}

@@ -16,2 +16,9 @@ const LightBulbService = require('./lightBulb');

this.tempState = {
value : this.value,
brightness : this.brightness
};
this.running = false;
homebridgeAccessory.getServiceById(this.Service.Lightbulb, serviceConfig.subtype).getCharacteristic(this.Characteristic.Brightness).on('get', this.getBrightness.bind(this)).on('set', this.setBrightness.bind(this));

@@ -60,2 +67,58 @@

}
setToCurrentBrightness(state, powerCallback, brightnessCallback, unchangedCallback)
{
if(state.value != null && (!super.hasState('value') || this.tempState.value != state.value))
{
this.tempState.value = state.value;
this.changedPower = true;
}
if(state.brightness != null && (!super.hasState('brightness') || this.tempState.brightness != state.brightness))
{
this.tempState.brightness = state.brightness;
this.changedBrightness = true;
}
if(!this.running)
{
this.running = true;
setTimeout(() => {
if(this.changedPower)
{
powerCallback(() => {
this.changedPower = false;
this.running = false;
});
}
else if(this.changedBrightness)
{
brightnessCallback(() => {
this.changedBrightness = false;
this.running = false;
});
}
else
{
unchangedCallback(() => {
this.running = false;
});
}
}, 10);
}
else
{
unchangedCallback(() => {});
}
}
}

@@ -40,6 +40,6 @@ const fs = require('fs'), path = require('path');

{
this.context[entry.id][entry.letters] = { time : entry.time * 60000, state : entry.state };
this.context[entry.id][entry.letters] = { time : entry.time * 60000, state : { ...entry.state } };
}
this.cache[entry.id][entry.letters].history.push({ time : entry.time * 60000, state : entry.state });
this.cache[entry.id][entry.letters].history.push({ time : entry.time * 60000, state : { ...entry.state } });
}

@@ -131,4 +131,2 @@ else if(entry.automation != null)

{
state = { ...state };
this._prepareStructure(id, letters);

@@ -153,3 +151,3 @@

{
this.cache[id][letters].cycle.push(this.context[id][letters].state);
this.cache[id][letters].cycle.push({ ...this.context[id][letters].state });
}

@@ -291,3 +289,3 @@ }

if(new Date().getTime() - time < 86400000)
if(new Date().getTime() - time < 86400000 * 2)
{

@@ -294,0 +292,0 @@ newData += JSON.stringify(entry) + '\n';

@@ -139,7 +139,7 @@ module.exports = class TypeManager

letterToType(letter)
letterToType(letters)
{
if(typeof letter == 'string' && this.data[letter.toUpperCase()] != null)
if(typeof letters == 'string' && this.data[letters[0].toUpperCase()] != null)
{
return this.data[letter.toUpperCase()].type;
return this.data[letters[0].toUpperCase()].type;
}

@@ -146,0 +146,0 @@

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