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

node-red-contrib-deconz

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-deconz - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

static/js/.DS_Store

2

package.json

@@ -34,3 +34,3 @@ {

},
"version": "0.1.6"
"version": "0.2.0"
}

@@ -168,3 +168,2 @@ function deconz_getDeviceMeta(uniqueid) {

if (controller) {

@@ -246,2 +245,65 @@ $.getJSON('/deconz/statelist', {

});
}
}
function deconz_initSettings(callback) {
$.get("https://dresden-light.appspot.com/discover", function( data ) {}).done(function(data) {
var settings = {
name:data[0].name,
ip:data[0].internalipaddress,
port:data[0].internalport,
apikey:'',
ws_port:''
};
$.ajax({
type: "POST",
dataType: 'json',
url: 'http://'+settings.ip+':'+settings.port+'/api',
data: JSON.stringify({"devicetype":"Node-red"}),
success: function(response){
var resp = response[0];
if ('success' in resp) {
settings.apikey = resp.success.username;
$.ajax({
type: "GET",
dataType: 'json',
url: 'http://'+settings.ip+':'+settings.port+'/api/'+settings.apikey+'/config',
success: function(response){
if ('websocketport' in response) {
settings.ws_port = response.websocketport;
}
},
error: function (err) {
var response = (JSON.parse(err.responseText));
var resp = response[0];
if ('error' in resp) {
alert(resp.error.description);
}
},
complete: function() {
callback(settings);
return settings;
}
});
}
},
error: function (err) {
var response = (JSON.parse(err.responseText));
var resp = response[0];
if ('error' in resp) {
alert(resp.error.description);
}
callback(settings);
return settings;
},
complete: function() {
}
});
}).fail(function() {
alert( "Remote server did not answer. Internet problems?" );
});
}

@@ -27,3 +27,19 @@ RED.nodes.registerType('deconz-server', {

return this.name ||  this.ip+':'+this.port;
}
},
oneditprepare: function () {
var node = this;
var $refreshBtn = $('#force-refresh');
$refreshBtn.on('click', function(){
deconz_initSettings(function(settings){
$('#node-config-input-name').val(settings.name);
$('#node-config-input-ip').val(settings.ip);
$('#node-config-input-port').val(settings.port);
$('#node-config-input-apikey').val(settings.apikey);
$('#node-config-input-ws_port').val(settings.ws_port);
});
});
},
});

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