npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zipabox

v0.0.37

Published

Module de gestion de la Zipabox

Downloads

17

Readme

Zipabox (http://www.zipato.com)

This is a module to connect, load and use zipabox.

donate to the developer through this >>link<<

NPM

NPM

License

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 0.1, December 2013

 Copyright (C) 2013 Zipabox Interface <[email protected]>

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE FUCK YOU WANT TO.
 This program is free software. It comes without any warranty, to
 the extent permitted by applicable law. You can redistribute it
 and/or modify it under the terms of the Do What The Fuck You Want
 To Public License, See http://www.wtfpl.net/ for more details.

Description

Control the zipabox

zipabox

NodeJS installation

npm install zipabox

Help :

Properties : click here for details

Methods : click here for details

Events : click here for details

For Developers

Simple Usage of module:

var zipabox = require("zipabox");

zipabox.username = "[ZIPABOX LOGIN]";
zipabox.password = "[ZIPABOX PASSWORD]";

zipabox.showlog = false;
zipabox.checkforupdate_auto = true;

zipabox.events.OnAfterConnect = function(){
	// Do something when connected
    zipabox.LoadDevices();
}

zipabox.events.OnAfterLoadDevices = function(){
	console.log("OnAfterLoadDevices");	
	zipabox.SaveDevicesToFile('./devices.json');
	zipabox.Disconnect();
}

zipabox.events.OnAfterLoadDevice = function(device){
	console.log("OnAfterLoadDevice");	
	// Do something for each device loaded
        // use device.json to access to the device (see zipabox API https://my.zipato.com/zipato-web/api/)
        console.log("" + device);
}

zipabox.Connect();

Events Use: click here for details

var zipabox = require("zipabox");

zipabox.username = "[ZIPABOX LOGIN]";
zipabox.password = "[ZIPABOX PASSWORD]";

zipabox.events.OnBeforeConnect = function(){
	console.log("OnBeforeConnect");
}

zipabox.events.OnAfterConnect = function(){
	console.log("OnAfterConnect");
	zipabox.LoadDevices();	
}

zipabox.events.OnBeforeLoadDevices = function(){
	console.log("OnBeforeLoadDevices");
}

zipabox.events.OnAfterLoadDevices = function(){
	console.log("OnAfterLoadDevices");
	zipabox.Disconnect();	
}

zipabox.events.OnBeforeLoadDevice = function(device){
	console.log("Loading : " + device.name);
}

zipabox.events.OnAfterLoadDevice = function(device){
	console.log(device.name + " Loaded");
	console.log(JSON.stringify(device.json,null,4));
}

zipabox.events.OnBeforeDisconnect = function(){
	console.log("OnBeforeDisconnect");
}

zipabox.events.OnAfterDisconnect = function(){
	console.log("OnAfterDisconnect");
}

zipabox.events.OnInitUserProgress = function(msg){
	console.log(JSON.stringify(msg));
}

zipabox.events.OnLoginUserProgress = function(msg){
	console.log(JSON.stringify(msg));
}

zipabox.events.OnLogoutUserProgress = function(msg){
	console.log(JSON.stringify(msg));
}

zipabox.Connect();

Disable Logging :

zipabox.showlog = false;

Adding Date/Time prefix to log (if zipabox.showlog is true):

zipabox.show_datetime_in_log = true;

Detailed Documentation :

Creating Object :

The Object is JSON type object

var zipabox = require("[PATH TO zipabox.js]/zipabox");

Object's usual properties :

Show Logs

zipabox.showlog=true;

Define Username and Password

zipabox.username="[email protected]";
zipabox.password="blabliblu";

Access Zipabox through its local IP

zipabox.setLocalIP("[ZIPABOX LOCAL IP]");

Knowing if Zipabox connection is open

zipabox.connected=false;

Set Device Value

Methods :

zipabox.SetDeviceValue([uuid],[attribute],[value],[optionnal]ON_SUCCESS,[optionnal]ON_ERROR,[optionnal]ON_AFTERSETDEVICEVALUE);
Example :
		
zipabox.SetDeviceValue("12324654",11,true,
    function(msg){ //ON_SUCCESS
    	console.log("Yes! ;-)");	
    },function(err){ //ON_ERROR
    	console.log("Oh no! It's a bad day! :'-(");		
    },function(){ //ON_AFTERSETDEVICEVALUE
    	zipabox.Disconnect();		
    });
Example2 :
	
zipabox.events.OnBeforeSetDeviceValue = function(){
	console.log("OnBeforeSetDeviceValue");
}

zipabox.events.OnAfterSetDeviceValue = function(){
	console.log("OnAfterSetDeviceValue");
	zipabox.Disconnect();
}
		
zipabox.SetDeviceValue("12324654",11,true,
    function(msg){ //ON_SUCCESS
    	console.log("Yes! ;-)");	
    },function(err){ //ON_ERROR
    	console.log("Oh no! It's a bad day! :'-(");		
    });

Set Device Value on Unloaded Device

Methods :

 zipabox.SetUnLoadedDeviceValue([uuid],[attribute],[value],[optionnal]ON_SUCCESS,[optionnal]ON_ERROR,[optionnal]ON_AFTERSETDEVICEVALUE);

Run Scene on Unloaded Device

Methods :

zipabox.RunUnLoadedScene([uuid])

Advanced Example

var zipabox = require("zipabox");
var argv = require("optimist").argv;

zipabox.username = "[ZIPABOX LOGIN]";
zipabox.password = "[ZIPABOX PASSWORD]";

zipabox.showlog = (argv.l) ? argv.l : false;
zipabox.show_datetime_in_log = true;

zipabox.checkforupdate_auto = false;

zipabox.events.OnBeforeConnect = function(){
	console.log("OnBeforeConnect");
}

zipabox.events.OnAfterConnect = function(){
	console.log("OnAfterConnect");	
	zipabox.LoadDevicesFromFile('./devices.json');
}

zipabox.events.OnBeforeDisconnect = function(){
	console.log("OnBeforeDisconnect");
}

zipabox.events.OnAfterDisconnect = function(){
	console.log("OnAfterDisconnect");
}

zipabox.events.OnBeforeLoadDevices = function(){
	console.log("OnBeforeLoadDevices");
}

zipabox.events.OnAfterLoadDevices = function(){
	console.log("OnAfterLoadDevices");
	zipabox.SaveDevicesToFile('./devices.json');
}

var ModuleToHTML = function(theuuid,themodule){
	var retval = "<div id='" + theuuid + "' class='" + themodule.uiType + "'>\n";
	retval += "<div class='name'>" + themodule.name + "</div>\n";
	retval += "<div class='attributes'>\n";
	for(var attributeid in themodule.attributes){
		var attribute = themodule.attributes[attributeid];
		var attrname = (attribute.definition) ? attribute.definition.name : attribute.name;
		
		retval += "<div class='attribute'>\n";
		retval += "<div class='id'>" + attributeid + "</div>\n";
		retval += "<div class='attributename'>" + attrname + "</div>\n";
		retval += "<div class='value'>" + attribute.value + "</div>\n";
		retval += "</div>\n";
	}
	retval += "</div>\n";	
			
	return retval + "</div>\n";	
};

zipabox.events.OnAfterLoadDevicesFromFile = function(result){
	console.log("zipabox.events.OnAfterLoadDevicesFromFile");	
	
	if (!(result)){
	
		console.log("<div id='meters' class='device'>\n");
		console.log("<div id='device' class='title'>meters</div>\n");
		zipabox.ForEachModuleInDevice("meters",function(module_uuid,module){
			
			module.toString = function(){ return ModuleToHTML(module_uuid,module); };
			
			console.log(""+module);
		});		
		console.log("</div>\n");
		
		console.log("<div id='lights' class='device'>\n");
		console.log("<div id='device' class='title'>lights</div>\n");
		zipabox.ForEachModuleInDevice("lights",function(module_uuid,module){
			
			module.toString = function(){ return ModuleToHTML(module_uuid,module); };
			
			console.log(""+module);
		});
		console.log("</div>\n");
		zipabox.Disconnect();	
	}		
	else
		zipabox.LoadDevices();
}

zipabox.Connect();

Bitdeli Badge