Jump to content

CAO Tags - kumoapps for ISY Rest injection


larryllix

Recommended Posts

See later posts in this thread for improvements and additions.

Here is my latest version of the kumoapp I am using, including Temperature, Humidity, OutOfRange, Battery Voltage with decimals for v5++ usage, and XYZ position crunched into one variable..

Most of the credit goes to MWaremen for conceiving the core of this. I rearranged for my clarity and understanding.

Your ISY STATE variables will need to be defined before usage and matched inside the code.

ISY security will be prompted when first run.

var tags = <#tags_[13|21|23|25]_N#>;
var isy_ip=<%ISY IP Address%>;
var isy_user = <%ISY username%>;
var isy_password=<%ISY password%>;
var isy_RESTcall = "http://"+isy_user+":"+isy_password+"@"+isy_ip+"/rest/vars/set/2/"

tags.forEach(
function (tag) {
    tag.updated = function () {
		var cur_name = tag.name
		var valid_device = true
		switch(cur_name) {
			case "Main Floor":
				var isy_variable_temp = 42
				var isy_variable_humi = 43
				var isy_variable_moved = 44
				var isy_variable_battV = 45
				var isy_variable_outOfRange = 46
				break;
			case "Rav4":
				var isy_variable_temp = 47
				var isy_variable_humi = 48
				var isy_variable_moved = 49
				var isy_variable_battV = 50
				var isy_variable_outOfRange = 51
				break;
			case "Cold Cellar":
				var isy_variable_temp = 52
				var isy_variable_humi = 53
				var isy_variable_moved = 54
				var isy_variable_battV = 55
				var isy_variable_outOfRange = 56
				break;
			case "Outside":
				var isy_variable_temp = 57
				var isy_variable_humi = 58
				var isy_variable_moved = 59
				var isy_variable_battV = 60
				var isy_variable_outOfRange = 61
				break;
			default:
				var valid_device = false
		}
		if(valid_device==true){
			var tag_temp = Math.round(tag.temperature * 10)/10;
			KumoApp.Log("Temp for "+cur_name+" ("+isy_variable_temp+") updated to "+tag_temp);
			KumoApp.httpCall(isy_RESTcall+isy_variable_temp+"/"+tag_temp, "GET");
			
			var tag_moisture = Math.round(tag.moisture);
			KumoApp.Log("Humidity for "+cur_name+" ("+isy_variable_humi+") updated to "+tag_moisture);
			KumoApp.httpCall(isy_RESTcall+isy_variable_humi+"/"+tag_moisture, "GET");
			
			var tag_moved = Math.round(tag.hasMoved);
			var tag_XYZ = (Math.round(tag.angleX/100)+50)*1000000 + (Math.round(tag.angleY/100)+50)*1000 + Math.round(tag.angleZ/100)+50
            KumoApp.Log("Moved for "+cur_name+" ("+isy_variable_moved+") updated to "+tag_XYZ);
		    KumoApp.httpCall(isy_RESTcall+isy_variable_moved+"/"+tag_XYZ, "GET");

			var tag_battV = Math.round(tag.batteryVolt * 1000)/1000;
			KumoApp.Log("BatteryV for "+cur_name+" ("+isy_variable_battV+") updated to "+tag_battV);
			KumoApp.httpCall(isy_RESTcall+isy_variable_battV+"/"+tag_battV, "GET");
			
			var tag_outOfRange = Math.round(tag.outOfRange);
		    KumoApp.Log("OutOfRange for "+cur_name+" ("+isy_variable_outOfRange+") updated to "+tag_outOfRange);
		    KumoApp.httpCall(isy_RESTcall+isy_variable_outOfRange+"/"+tag_outOfRange, "GET");

		} else {
			KumoApp.Log("Data from non-configured device: "+cur_name);
		}
    };
}
);

Here are my variables  used in ISY. Note the decimal position parameters.

 

post-4697-0-50841500-1472560201_thumb.jpg

 

Link to comment
Share on other sites

Thanks for sharing larryllix. I'm bummed about the decimal thing as I have ISY firmware 4.5.4. I guess I need to mull over whether I want to upgrade to alpha / beta versions of the firmware to get decimal support...

Link to comment
Share on other sites

Thanks for sharing larryllix. I'm bummed about the decimal thing as I have ISY firmware 4.5.4. I guess I need to mull over whether I want to upgrade to alpha / beta versions of the firmware to get decimal support...

Just remove all the "/1000" and "/10" code out of the kumoapp lines and use larger comparision values in your ISY. Then it's easy to put back in when you do get decimals in ISY.

 

If

....Tabx.BattV < 2700 (=2.700)

Then

....

Link to comment
Share on other sites

Thanks larryllix,

 

I am using IFTTT right now successfully but I wanted to try the Kumoapps approach.  I had a question about 1 line in your code, see screen shot.  You don't seem to be using this variable.  

 

I'm having trouble getting this to work for my setup.  I have an accelerometer tag that can only sense vibration not X-Y-Z motion.  I can't find a CAO Property listed for the accelerometer, the eventState and hasMoved don't reliably provide an indication of motion(vibration).  Yet the IFTTT continues to work.  Have you tried to work with the Events vs the Properties that CAO lists?  

post-7039-0-08626700-1490887751_thumb.png

Link to comment
Share on other sites

Thanks larryllix,

 

I am using IFTTT right now successfully but I wanted to try the Kumoapps approach.  I had a question about 1 line in your code, see screen shot.  You don't seem to be using this variable.  

 

I'm having trouble getting this to work for my setup.  I have an accelerometer tag that can only sense vibration not X-Y-Z motion.  I can't find a CAO Property listed for the accelerometer, the eventState and hasMoved don't reliably provide an indication of motion(vibration).  Yet the IFTTT continues to work.  Have you tried to work with the Events vs the Properties that CAO lists?

 

IIRC the events notifications only ever worked when the value would cross the boundaries set and not update to keep a value current. I discontinued usage of that technique, as they are not suitable for ISY program usage, with their digital and no analogue value reporting. I didn;t spend much time with them so this may not be quite right.

 

With the kumoapp programs, your particular Tag style must be included in the prerequisite list in the first line of the program or they are not supposed to be included in processing.

 

var tags = <#tags_[13|21|23|25]_N#>;

Link to comment
Share on other sites

Thanks, I think you're right about the Events, they do trigger subject to the tag settings, a digital response.  That would be ok for my mailbox but not as useful as the Property values.

 

The tag is a variant of type 21 so the kumoapp does respond to the tag.  I get X-Y-Z data from the tag but it barely changes as it's mounted on the bottom of my mailbox.  The notifications on the web app and phone come through with an analog "g" value so I'll bet there is a property type, it's just not published.  It seems like the eventState should work but what I found was that sometimes the eventState does not change to 2(moved) even though the tag was moved as confirmed by the IFTTT notification.

Link to comment
Share on other sites

Thanks, I think you're right about the Events, they do trigger subject to the tag settings, a digital response.  That would be ok for my mailbox but not as useful as the Property values.

 

The tag is a variant of type 21 so the kumoapp does respond to the tag.  I get X-Y-Z data from the tag but it barely changes as it's mounted on the bottom of my mailbox.  The notifications on the web app and phone come through with an analog "g" value so I'll bet there is a property type, it's just not published.  It seems like the eventState should work but what I found was that sometimes the eventState does not change to 2(moved) even though the tag was moved as confirmed by the IFTTT notification.

I created a compound variable to explore the output of these parameters.

 

Although I haven't played with them much I have found them mostly useless, and outputting erratic nonsense, so far.

 

Other than that I have four and want another dozen units. The luminence should be handy to remotely analyse what I am getting out of my PV panels. Snow cover is the unknown factor there.

Link to comment
Share on other sites

Thanks for the kumoapp Larry (and Mike)

 

With that in hand and just a few quick mods to include lux it works great.  I ditched the whole breaking down of the restcall and just hardcoded my restcall to http://user:password@myisyip:myisyport/rest/vars/set/2/.  I'm not sure why it wasn't working when put in in parts but there you go.  Sometimes it's best not to wonder about things too long - just work around them and keep moving.

 

I never did get the custom calling url thing to work - I'm not sure why.  For some reason the replacement variables they claim work do not work as advertised.

 

Anyways - the kumoapp method seems to work very well.  I hope this isn't the server that goes down all the time :)  Tomorrow I'll figure out wtf to do with all this new info.  That and try to get my geofencing working.

 

mark

Link to comment
Share on other sites

  • 1 year later...

More upgrades to this. I recently bought some newer Tags with light levels sensors and added this to the kumoapp code.

Note: an additional Variable position for each Tag and more tags have been added along with the new type in the first line of the code. The units not supporting Lux will always display 0 in their values.

This new forum makes a mess of code formatting! YUK

var tags = <#tags_[13|21|23|25|26]_N#>;
var isy_ip = <%ISY IP Address%>;
var isy_user = <%ISY username%>;
var isy_password = <%ISY password%>;
var isy_RESTcall = "http://"+isy_user+":"+isy_password+"@"+isy_ip+"/rest/vars/set/2/";

tags.forEach(
    function (tag) {
        tag.updated = function () {
    		var cur_name = tag.name;
    		var valid_device = true;
 		
    		switch(cur_name) {
    			case "Main Floor":
    				var isy_variable_temp = 102;
    				var isy_variable_humi = 103;
    				var isy_variable_moved = 104;
    				var isy_variable_battV = 105;
    				var isy_variable_outOfRange = 106;
    				var isy_variable_lux = 107;
    				break;
    			case "Rav4":
    				var isy_variable_temp = 108;
    				var isy_variable_humi = 109;
    				var isy_variable_moved = 110;
    				var isy_variable_battV = 111;
    				var isy_variable_outOfRange = 112;
    				var isy_variable_lux = 113;
    				break;
    			case "Cold Cellar":
    				var isy_variable_temp = 114;
    				var isy_variable_humi = 115;
    				var isy_variable_moved = 116;
    				var isy_variable_battV = 117;
    				var isy_variable_outOfRange = 118;
    				var isy_variable_lux = 119;
    				break;
    			case "Tag3":
    				var isy_variable_temp = 120;
    				var isy_variable_humi = 121;
    				var isy_variable_moved = 122;
    				var isy_variable_battV = 123;
    				var isy_variable_outOfRange = 124;
    				var isy_variable_lux = 125;
    				break;
    			case "Fridge":
    				var isy_variable_temp = 126;
    				var isy_variable_humi = 127;
    				var isy_variable_moved = 128;
    				var isy_variable_battV = 129;
    				var isy_variable_outOfRange = 130;
    				var isy_variable_lux = 131;
    				break;
    			case "Tag5":
    				var isy_variable_temp = 132;
    				var isy_variable_humi = 133;
    				var isy_variable_moved = 134;
    				var isy_variable_battV = 135;
    				var isy_variable_outOfRange = 136;
    				var isy_variable_lux = 137;
    				break;
    			case "Outside":
    				var isy_variable_temp = 138;
    				var isy_variable_humi = 139;
    				var isy_variable_moved = 140;
    				var isy_variable_battV = 141;
    				var isy_variable_outOfRange = 142;
    				var isy_variable_lux = 143;
    				break;
    			default:
    				var valid_device = false;
    		}
    		if(valid_device==true){
    			var tag_temp = Math.round(tag.temperature * 10)/10;
    			KumoApp.Log("Temp for "+cur_name+" ("+isy_variable_temp+") updated to "+tag_temp);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_temp+"/"+tag_temp, "GET");
    			
    			var tag_moisture = Math.round(tag.moisture);
    			KumoApp.Log("Humidity for "+cur_name+" ("+isy_variable_humi+") updated to "+tag_moisture);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_humi+"/"+tag_moisture, "GET");
    			
    			var tag_moved = Math.round(tag.hasMoved);
    			var tag_XYZ = (Math.round(tag.angleX/100)+50)*1000000 + (Math.round(tag.angleY/100)+50)*1000 + Math.round(tag.angleZ/100)+50;
                KumoApp.Log("Moved for "+cur_name+" ("+isy_variable_moved+") updated to "+tag_XYZ);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_moved+"/"+tag_XYZ, "GET");
    
    			var tag_battV = Math.round(tag.batteryVolt * 1000)/1000;
    			KumoApp.Log("BatteryV for "+cur_name+" ("+isy_variable_battV+") updated to "+tag_battV);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_battV+"/"+tag_battV, "GET");
    			
    			var tag_outOfRange = Math.round(tag.outOfRange);
    		    KumoApp.Log("OutOfRange for "+cur_name+" ("+isy_variable_outOfRange+") updated to "+tag_outOfRange);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_outOfRange+"/"+tag_outOfRange, "GET");
    
    			var tag_lux = Math.round(tag.lux);
    		    KumoApp.Log("Lux for "+cur_name+" ("+isy_variable_lux+") updated to "+tag_lux);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_lux+"/"+tag_lux, "GET");
    
    		} else {
    			KumoApp.Log("Data from non-configured device: "+cur_name);
            }
        }
    }
)

 

Link to comment
Share on other sites

  • 4 months later...

I have obliterated the code below due to a complaint from CAO of too much memoryusage  and the technique did not effect more than 5% saving in data transport.

The plot thickens.

I have added more features to this, in order to cut down on data traffic into the ISY Rest i/f, even more than the already economical previous  KumoApps posted. I have found some Polygot data storms that overflow and lockup my ISY data queue, upon rebooting ISY,  while looking for some other boot up anomalies.

 - kumoApp only send data only when a change of value occurs. Triggers that do not significantly change the value (after the rounding truncation) will be shown in the log.

- kumoApp enables sending of all data every user prompted X minutes. (recommend 5 to 15 minutes).
No data storms are created because the new data speed is dependant on triggers from the Tag individually and comes fairly orderly.

 

Of course this code will require the user to install their own State variable mapping locations, into the code, as well as changing the names of the tags to match the user's own Tag names.  Hopefully those edits will be self-explanatory. Mismatching will be shown in the log to identify them.

Questions?  Just ask.

var tags = <#tags_[13|21|23|25|26]_N#>;
var isy_ip = <%ISY IP Address%>;
var isy_user = <%ISY username%>;
var isy_password = <%ISY password%>;
var cycle_time = <%Minutes between full data sends%> * 60 * 1000;
var isy_RESTcall = "http://" + isy_user+":"+isy_password + "@" + isy_ip + "/rest/vars/set/2/";
var $last_sent = [-1,-1];

// Last updated September 3, 2018 by larryllix 

KumoApp.setInterval(function resetLast() {
    var len = $last_sent.length;
    KumoApp.Log("**Resetting cycle send timer** for " + len + " vars");
    var i = 0;
    for (i=0; i<len; i++) {
        $last_sent[i] = -999999999;
    }
}, cycle_time);

tags.forEach(
    function (tag) {
        tag.updated = function () {
    		var cur_name = tag.name;
    		var valid_device = true;
 		
    		switch(cur_name) {
    			case "Main Floor":
    				var isy_variable_temp = 102;
    				var isy_variable_humi = 103;
    				var isy_variable_moved = 104;
    				var isy_variable_battV = 105;
    				var isy_variable_outOfRange = 106;
    				var isy_variable_lux = 107;
    				break;
    			case "Vehicle":
<removed repetitive code>

 

Link to comment
Share on other sites

The plot thickens.
I have added more features to this, in order to cut down on data traffic into the ISY Rest i/f, even more than the already economical previous  KumoApps posted. I have found some Polygot data storms that overflow and lockup my ISY data queue, upon rebooting ISY,  while looking for some other boot up anomalies.
 - kumoApp only send data only when a change of value occurs. Triggers that do not significantly change the value (after the rounding truncation) will be shown in the log.
- kumoApp enables sending of all data every user prompted X minutes. (recommend 5 to 15 minutes).
No data storms are created because the new data speed is dependant on triggers from the Tag individually and comes fairly orderly.
 
Of course this code will require the user to install their own State variable mapping locations, into the code, as well as changing the names of the tags to match the user's own Tag names.  Hopefully those edits will be self-explanatory. Mismatching will be shown in the log to identify them.
Questions?  Just ask.
var tags = ;var isy_ip = ISY IP Address%>;var isy_user = ISY username%>;var isy_password = ISY password%>;var cycle_time = Minutes between full data sends%> * 60 * 1000;var isy_RESTcall = "http://" + isy_user+":"+isy_password + "@" + isy_ip + "/rest/vars/set/2/";var $last_sent = [-1,-1];// Last updated September 3, 2018 by larryllix KumoApp.setInterval(function resetLast() {   var len = $last_sent.length;   KumoApp.Log("**Resetting cycle send timer** for " + len + " vars");   var i = 0;   for (i=0; i        $last_sent[i] = -999999999;   }}, cycle_time);tags.forEach(   function (tag) {       tag.updated = function () {   		var cur_name = tag.name;   		var valid_device = true;   		switch(cur_name) {   			case "Main Floor":   				var isy_variable_temp = 102;   				var isy_variable_humi = 103;   				var isy_variable_moved = 104;   				var isy_variable_battV = 105;   				var isy_variable_outOfRange = 106;   				var isy_variable_lux = 107;   				break;   			case "Vehicle":   				var isy_variable_temp = 108;   				var isy_variable_humi = 109;   				var isy_variable_moved = 110;   				var isy_variable_battV = 111;   				var isy_variable_outOfRange = 112;   				var isy_variable_lux = 113;   				break;   			case "Cold Cellar":   				var isy_variable_temp = 114;   				var isy_variable_humi = 115;   				var isy_variable_moved = 116;   				var isy_variable_battV = 117;   				var isy_variable_outOfRange = 118;   				var isy_variable_lux = 119;   				break;   			case "Tag3":   				var isy_variable_temp = 120;   				var isy_variable_humi = 121;   				var isy_variable_moved = 122;   				var isy_variable_battV = 123;   				var isy_variable_outOfRange = 124;   				var isy_variable_lux = 125;   				break;   			case "Fridge":   				var isy_variable_temp = 126;   				var isy_variable_humi = 127;   				var isy_variable_moved = 128;   				var isy_variable_battV = 129;   				var isy_variable_outOfRange = 130;   				var isy_variable_lux = 131;   				break;   			case "Tag5":   				var isy_variable_temp = 132;   				var isy_variable_humi = 133;   				var isy_variable_moved = 134;   				var isy_variable_battV = 135;   				var isy_variable_outOfRange = 136;   				var isy_variable_lux = 137;   				break;   			case "Outside":   				var isy_variable_temp = 138;   				var isy_variable_humi = 139;   				var isy_variable_moved = 140;   				var isy_variable_battV = 141;   				var isy_variable_outOfRange = 142;   				var isy_variable_lux = 143;   				break;   			default:   				var valid_device = false;   		}   		if(valid_device==true) {   			var tag_temp = Math.round(tag.temperature * 10)/10;   			if (tag_temp != $last_sent[isy_variable_temp]) {       		    KumoApp.Log(cur_name+" Temperature for ISY(" + isy_variable_temp + ") updated to " + tag_temp);   			    KumoApp.httpCall(isy_RESTcall+isy_variable_temp+"/"+tag_temp, "GET");   			    $last_sent[isy_variable_temp] = tag_temp;               } else {       		    KumoApp.Log(cur_name+" Temperature for ISY(" + isy_variable_temp + ") no change");   			}   			var tag_moisture = Math.round(tag.moisture);   			if (tag_moisture != $last_sent[isy_variable_humi]) {       			KumoApp.Log(cur_name + " Humidity for ISY(" + isy_variable_humi + ") updated to " + tag_moisture);       			KumoApp.httpCall(isy_RESTcall+isy_variable_humi+"/"+tag_moisture, "GET");   			    $last_sent[isy_variable_humi] = tag_moisture;               } else {       		    KumoApp.Log(cur_name + " Humidity for ISY(" + isy_variable_humi + ") no change");   			}   			var tag_moved = Math.round(tag.hasMoved);   			var tag_XYZ = (Math.round(tag.angleX/100)+50)*1000000 + (Math.round(tag.angleY/100)+50)*1000 + Math.round(tag.angleZ/100)+50;   			if (tag_XYZ != $last_sent[isy_variable_moved]) {                   KumoApp.Log(cur_name + " XYZ for ISY(" + isy_variable_moved + ") updated to " + tag_XYZ);       		    KumoApp.httpCall(isy_RESTcall+isy_variable_moved+"/"+tag_XYZ, "GET");   			    $last_sent[isy_variable_moved] = tag_XYZ;               } else {       		    KumoApp.Log(cur_name + " XYZ for ISY(" + isy_variable_moved + ") no change");   			}   			var tag_battV = Math.round(tag.batteryVolt * 1000)/1000;   			if (tag_battV != $last_sent[isy_variable_battV]) {       			KumoApp.Log(cur_name + " Battery Volts for ISY(" + isy_variable_battV + ") updated to " + tag_battV);       			KumoApp.httpCall(isy_RESTcall+isy_variable_battV+"/"+tag_battV, "GET");   			    $last_sent[isy_variable_battV] = tag_battV;               } else {       		    KumoApp.Log(cur_name + " Battery Volts for ISY(" + isy_variable_battV + ") no change");   			}   			var tag_outOfRange = Math.round(tag.outOfRange);   			if (tag_outOfRange != $last_sent[isy_variable_outOfRange]) {       		    KumoApp.Log(cur_name + " OutOfRange for ISY(" + isy_variable_outOfRange + ") updated to " + tag_outOfRange);       		    KumoApp.httpCall(isy_RESTcall+isy_variable_outOfRange+"/"+tag_outOfRange, "GET");   			    $last_sent[isy_variable_outOfRange] = tag_outOfRange;               } else {       		    KumoApp.Log(cur_name + " OutofRange for ISY(" + isy_variable_outOfRange + ") no change");   			}   			var tag_lux = Math.round(tag.lux);   			if (tag_lux != $last_sent[isy_variable_lux]) {       		    KumoApp.Log(cur_name + " Lux for ISY(" + isy_variable_lux + ") updated to " + tag_lux);       		    KumoApp.httpCall(isy_RESTcall+isy_variable_lux+"/"+tag_lux, "GET");   			    $last_sent[isy_variable_lux] = tag_lux;   			} else {       		    KumoApp.Log(cur_name + " Lux for ISY(" + isy_variable_lux + ") no change");   			}   		} else {   			KumoApp.Log("Data from non-configured device: "+cur_name);           }       }   })

 



Nice! I hadn’t thought that variables set would persist between calls... pretty slick!
Link to comment
Share on other sites

7 hours ago, Jimbo said:

The wireless tags poly only sends data as it changes, but if query on reboot is enabled then all data is updated on reboot which is necessary to get current data to show up in the ISY, otherwise the values will be blank.

Sent from my Pixel 2 XL using Tapatalk
 

Yes. The "seconds since last update" parameter changes ever 30 seconds for every Tag and gets sent. After some other problems it seems my Polyglot install was flooding the ISY UDQ before ISY was ready. Since I wasn't needing Polyglot yet, I turned it off again.  Looks like there may be still some boot-up sequence problems for ISY v5.0.13c yet.

Yes there will be some blanks for a while but the Tags update quite frequently. I haven't found  way to force them to update yet without some major coding changes yet. KumoApp script is not my preferred language (really bad error reporting) and is not a full implemenation of js, no matter what they say. :(

 

Link to comment
Share on other sites

1 hour ago, MWareman said:

 

 


Nice! I hadn’t thought that variables set would persist between calls... pretty slick!

 

Oooops! Looks like CAO didn't like me using 150 array element locations.

    "Halting this app because one or more app installed under your account is using too much memory."

I don't see where I am recursively redefining the array. I wonder if it too many "hits" on the storage location or the size?

Link to comment
Share on other sites

4 hours ago, larryllix said:

Yes. The "seconds since last update" parameter changes ever 30 seconds for every Tag and gets sent. After some other problems it seems my Polyglot install was flooding the ISY UDQ before ISY was ready. Since I wasn't needing Polyglot yet, I turned it off again.  Looks like there may be still some boot-up sequence problems for ISY v5.0.13c yet.

Yes there will be some blanks for a while but the Tags update quite frequently. I haven't found  way to force them to update yet without some major coding changes yet. KumoApp script is not my preferred language (really bad error reporting) and is not a full implemenation of js, no matter what they say. :(

 

The 'seconds since last update' is updated every shortPoll time, so if you want it slower, then change that.  I've thought it should probably use longPoll, but haven't changed it yet.  I've been on 5.0.13C and D since release I've got Harmony with 2 hubs, WeatherFlow, Wireless Tags, and Camera poly's all running

I disliked the Kumo way since it relies on their windows machines to run the apps, and others on their forum have been reporting problems for a few days now with Kumo apps dieing or being halted.  Pushing values with REST is much more reliable. :-)

Link to comment
Share on other sites

45 minutes ago, Jimbo said:

The 'seconds since last update' is updated every shortPoll time, so if you want it slower, then change that.  I've thought it should probably use longPoll, but haven't changed it yet.  I've been on 5.0.13C and D since release I've got Harmony with 2 hubs, WeatherFlow, Wireless Tags, and Camera poly's all running

I disliked the Kumo way since it relies on their windows machines to run the apps, and others on their forum have been reporting problems for a few days now with Kumo apps dieing or being halted.  Pushing values with REST is much more reliable. :-)

I had the Tag Node installed to test it (and forgot I had it running).  I really didn't get a chance to test it out. but found it much slower with the delay times adding. In the meantime I had some problems with Alexa via ISY Portal just "going away" on me one day, first time and support Michel had me go through some testing into log files. I found some nasty things like programs being accessed that haven't existed for maybe years? and a few other nasties on ISY boot up. One was my UDQ flooding and tossing out information. It was coming from PolyGlot, so I turn it off for now. Looking back I see a long term existing problem with ISY not booting up in a well-mannered order. It seems to get blasted by PolyGlot before it is ready to handle it..

Anyway, I am abandoning the idea of KumoApps only sending changes in data, and returning to my older version.  After some running I found only about 5% of the updates repeat data and the KumoApps seem fairly efficient already. Then CAO stopped my app stating too much memory was being used?????. I haven't figured that one out yet but watching the monitor I see spikes up to 5737kB, for that one KumoApp program? wow! :)
On the same abandonment trail... I realised that the Tags are set to economise the best speed of update, individually by the user, and it would be best to just echo that through to ISY as soon as it happens. Power up is always a problem with a triggered only technique but I think you may have already mostly jumped that hurdle. I know you have been a busy bee there.

Q. Windows machines?. Are you saying CAO runs the whole service on Windows machines?

Q. Don't understand that comment. KumoApps do use the ISY Rest interface. At least my KumoApp does. The URL notifications may not but I have never made them work to my satisfaction yet.

Link to comment
Share on other sites

@larryllix

Q. Windows machines?. Are you saying CAO runs the whole service on Windows machines?

Yes, from what I've read on their forum that seems to be the case:  https://groups.google.com/forum/#!forum/wireless-sensor-tags

Q. Don't understand that comment. KumoApps do use the ISY Rest interface. At least my KumoApp does. The URL notifications may not but I have never made them work to my satisfaction yet.

Sorry, I meant the Tag Manager URL notification.  That's what the Polyglot uses and it seems to work great for me, and I've not heard any complaints :)

 

Link to comment
Share on other sites

1 hour ago, Jimbo said:

@larryllix

Q. Windows machines?. Are you saying CAO runs the whole service on Windows machines?

Yes, from what I've read on their forum that seems to be the case:  https://groups.google.com/forum/#!forum/wireless-sensor-tags

Q. Don't understand that comment. KumoApps do use the ISY Rest interface. At least my KumoApp does. The URL notifications may not but I have never made them work to my satisfaction yet.

Sorry, I meant the Tag Manager URL notification.  That's what the Polyglot uses and it seems to work great for me, and I've not heard any complaints :)

 

I have never had the Tag service do anything negative except once about 3-4 months ago. It went down for many hours, maybe days (forget). I wasn't happy with that one, but I think their whole service was down because not even their web pages would respond. :( I have had many problems with their servers accepting my KumoApps and starting them. Or locking up when I load a second one and run it over top of the first. I had to ask them for help. They never responded but my lockup went away after several days. :(

I just use the Tag update frequency as that is the only time the Tag updates the Tag  servers anyway.  I am thinking about some fast notices / alerts  though for a Fridge Door  open alert. It is getting more common lately and rather than just clean and re-grease the slide/seal surfaces I use technology more often. It's a hard life. :)

Link to comment
Share on other sites

  • 1 month later...

Added a Heartbeat to the KumoApp. All data over a comm line should have this.

var tags = <#tags_[13|21|23|25|26]_N#>;
var isy_ip = <%ISY IP Address%>;
var isy_user = <%ISY username%>;
var isy_password = <%ISY password%>;
var isy_RESTcall = "http://" + isy_user+":"+isy_password + "@" + isy_ip + "/rest/vars/set/2/";

/* Last updated October 20, 2018 by larryllix */

/* Heartbeat variable address. */
var isy_variable_heartbeat = 101;
var $last_heartbeat = +1;

/* Heartbeats sent to ISY - User to replace 45000 (next line) to desired period in milliSeconds. Recommend 30,000 - 60,000 mSec. */
KumoApp.setInterval(pulse, 45000);
pulse(); /* start out with fresh heartbeat pulse */

function pulse() {
    if ($last_heartbeat == +1) {
        $last_heartbeat = -1;
        KumoApp.Log("Heartbeat for ISY(" + isy_variable_heartbeat + ") updated to " + $last_heartbeat);
        KumoApp.httpCall(isy_RESTcall+isy_variable_heartbeat + "/" + $last_heartbeat, "GET");
    } else {
        $last_heartbeat = +1;
        KumoApp.Log("Heartbeat for ISY(" + isy_variable_heartbeat + ") updated to " + $last_heartbeat);
        KumoApp.httpCall(isy_RESTcall+isy_variable_heartbeat + "/" + $last_heartbeat, "GET");
    };
}


tags.forEach(
    function(tag) {
        KumoApp.Log(tag.name + ".updated KumoApp handler installed");
        tag.updated = function() {
    		var cur_name = tag.name;
    		var valid_device = true;
 		
    		switch(cur_name) {
    			case "Main Floor":
    				var isy_variable_temp = 102;
    				var isy_variable_humi = 103;
    				var isy_variable_moved = 104;
    				var isy_variable_battV = 105;
    				var isy_variable_outOfRange = 106;
    				var isy_variable_lux = 107;
    				break;
    			case "Vehicle":
    				var isy_variable_temp = 108;
    				var isy_variable_humi = 109;
    				var isy_variable_moved = 110;
    				var isy_variable_battV = 111;
    				var isy_variable_outOfRange = 112;
    				var isy_variable_lux = 113;
    				break;
    			case "Cold Cellar":
    				var isy_variable_temp = 114;
    				var isy_variable_humi = 115;
    				var isy_variable_moved = 116;
    				var isy_variable_battV = 117;
    				var isy_variable_outOfRange = 118;
    				var isy_variable_lux = 119;
    				break;
    			case "Tag3":
    				var isy_variable_temp = 120;
    				var isy_variable_humi = 121;
    				var isy_variable_moved = 122;
    				var isy_variable_battV = 123;
    				var isy_variable_outOfRange = 124;
    				var isy_variable_lux = 125;
    				break;
    			case "Fridge":
    				var isy_variable_temp = 126;
    				var isy_variable_humi = 127;
    				var isy_variable_moved = 128;
    				var isy_variable_battV = 129;
    				var isy_variable_outOfRange = 130;
    				var isy_variable_lux = 131;
    				break;
    			case "Tag5":
    				var isy_variable_temp = 132;
    				var isy_variable_humi = 133;
    				var isy_variable_moved = 134;
    				var isy_variable_battV = 135;
    				var isy_variable_outOfRange = 136;
    				var isy_variable_lux = 137;
    				break;
    			case "Outside":
    				var isy_variable_temp = 138;
    				var isy_variable_humi = 139;
    				var isy_variable_moved = 140;
    				var isy_variable_battV = 141;
    				var isy_variable_outOfRange = 142;
    				var isy_variable_lux = 143;
    				break;
    			default:
    				var valid_device = false;
    		}

    		if (valid_device == true) {
    			var tag_temp = Math.round(tag.temperature * 10)/10;
    		    KumoApp.Log(cur_name + " Temperature for ISY(" + isy_variable_temp + ") updated to " + tag_temp);
			    KumoApp.httpCall(isy_RESTcall+isy_variable_temp + "/" + tag_temp, "GET");

    			var tag_moisture = Math.round(tag.moisture);
    			KumoApp.Log(cur_name + " Humidity for ISY(" + isy_variable_humi + ") updated to " + tag_moisture);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_humi + "/" + tag_moisture, "GET");

    			var tag_moved = Math.round(tag.hasMoved);
    			var tag_XYZ = (Math.round(tag.angleX/100)+50)*1000000 + (Math.round(tag.angleY/100)+50)*1000 + Math.round(tag.angleZ/100)+50;
                KumoApp.Log(cur_name + " XYZ for ISY(" + isy_variable_moved + ") updated to " + tag_XYZ);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_moved + "/" + tag_XYZ, "GET");

    			var tag_battV = Math.round(tag.batteryVolt * 1000)/1000;
    			KumoApp.Log(cur_name + " Battery Volts for ISY(" + isy_variable_battV + ") updated to " + tag_battV);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_battV + "/" + tag_battV, "GET");
    			
    			var tag_outOfRange = Math.round(tag.outOfRange);
    		    KumoApp.Log(cur_name + " OutOfRange for ISY(" + isy_variable_outOfRange + ") updated to " + tag_outOfRange);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_outOfRange + "/" + tag_outOfRange, "GET");

    			var tag_lux = Math.round(tag.lux);
    		    KumoApp.Log(cur_name + " Lux for ISY(" + isy_variable_lux + ") updated to " + tag_lux);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_lux + "/" + tag_lux, "GET");
    			
    		} else {
    			KumoApp.Log("Data from non-configured device: " + cur_name);
            }
        }
    }
)

 

 

Here is how I monitor my heartbeats in ISY programming.
Notes:

  • This requires the usage of an Integer variable.  I found a State variable to be a nuisance in most programs for this purpose, as I mostly use it for only a filter condition and not a program trigger.
  • My several comm monitoring programs are identical, except for timing and use a common Notification message with all updating variables in the same notification.
     
Tags.Comm.OK - [ID 00E1][Parent 00CD]

If
        $sTags.heartbeat is 1
     Or $sTags.heartbeat is -1
 
Then         <---- we got a validation
        $CAO_Tags.updating  = $cTRUE    <- flag data is updating
        Wait  1 minute and 40 seconds   <----- two 45 sec. heartbeat period times ++ a few seconds tolerence.
        Run Program 'Tags.Comm.OK' (Else Path)
 
Else         <----- we have a serious comm failure
        $CAO_Tags.updating  = $cFALSE    <-------- Flag it - let ISY programs know ASAP
        Wait  30 minutes        <----- bother humans if failure continues too long
        $sAlarm.level  = 2       <-------- in home alarm system
        Send Notification to 'Text  Larry' content 'Device comm report'
        Send Notification to 'eMail Larry' content 'Device comm report'
        Repeat While $sHouse.vacation is $cFALSE   <-------- reminder if vacationing, cancel when home again
           Wait  24 hours 
           Send Notification to 'Text  Larry' content 'Device comm report'
 

 

 

 

Link to comment
Share on other sites

  • 1 year later...

I have modified my Tag Lux inputs to ISY by using the square root of the lux.

This resultant is a more reasonable approximation of how illumination levels appear to the human eye and an easier figure to work with in ISY calculations and triggers. I posted a method of calculation a square root in ISY programming but it was clumsy and using the Kumoapp do the calculation takes some load of my ISY CPU.

Here is my latest code, including a heartbeat. Change variable definitions to suit your own ISY variables.
 

var tags = <#tags_[13|21|23|25|26]_N#>;
var isy_ip = <%ISY IP Address%>;
var isy_user = <%ISY username%>;
var isy_password = <%ISY password%>;
var isy_RESTcall = "http://" + isy_user+":"+isy_password + "@" + isy_ip + "/rest/vars/set/2/";

/* Last updated September 30, 2019 by larryllix */

/* Heartbeat variable address */
var isy_variable_heartbeat = 101;
var $last_heartbeat = +1;

/* Heartbeats sent to ISY - User to replace 45000 (next line) to desired period in milliSeconds. Recommend 30,000 - 60,000 mSec. */
KumoApp.setInterval(pulse, 90000);
pulse(); /* start out with fresh heartbeat pulse */

function pulse() {
    if ($last_heartbeat == +1) {
        $last_heartbeat = -1;
        KumoApp.Log("Heartbeat to ISY(" + isy_variable_heartbeat + ") updated to " + $last_heartbeat);
        KumoApp.httpCall(isy_RESTcall+isy_variable_heartbeat + "/" + $last_heartbeat, "GET");
    } else {
        $last_heartbeat = +1;
        KumoApp.Log("Heartbeat to ISY(" + isy_variable_heartbeat + ") updated to " + $last_heartbeat);
        KumoApp.httpCall(isy_RESTcall+isy_variable_heartbeat + "/" + $last_heartbeat, "GET");
    };
}


tags.forEach(
    function(tag) {
        KumoApp.Log(tag.name + " KumoApp handler installed");
        tag.updated = function() {
    		var valid_device = true;
 		
    		switch(tag.name) {
    			case "Gathering Room":
    				var isy_variable_temp = 102;
    				var isy_variable_humi = 103;
    				var isy_variable_moved = 104;
    				var isy_variable_battV = 105;
    				var isy_variable_outOfRange = 106;
    				var isy_variable_lux = 107;
    				break;
    			case "Vehicle":
    				var isy_variable_temp = 108;
    				var isy_variable_humi = 109;
    				var isy_variable_moved = 110;
    				var isy_variable_battV = 111;
    				var isy_variable_outOfRange = 112;
    				var isy_variable_lux = 113;
    				break;
    			case "Cold Cellar":
    				var isy_variable_temp = 114;
    				var isy_variable_humi = 115;
    				var isy_variable_moved = 116;
    				var isy_variable_battV = 117;
    				var isy_variable_outOfRange = 118;
    				var isy_variable_lux = 119;
    				break;
    			case "Garage Door":
    				var isy_variable_temp = 120;
    				var isy_variable_humi = 121;
    				var isy_variable_moved = 122;
    				var isy_variable_battV = 123;
    				var isy_variable_outOfRange = 124;
    				var isy_variable_lux = 125;
    				break;
    			case "Fridge":
    				var isy_variable_temp = 126;
    				var isy_variable_humi = 127;
    				var isy_variable_moved = 128;
    				var isy_variable_battV = 129;
    				var isy_variable_outOfRange = 130;
    				var isy_variable_lux = 131;
    				break;
    			case "Deck Wall":
    				var isy_variable_temp = 132;
    				var isy_variable_humi = 133;
    				var isy_variable_moved = 134;
    				var isy_variable_battV = 135;
    				var isy_variable_outOfRange = 136;
    				var isy_variable_lux = 137;
    				break;
    			case "Garage Wall":
    				var isy_variable_temp = 138;
    				var isy_variable_humi = 139;
    				var isy_variable_moved = 140;
    				var isy_variable_battV = 141;
    				var isy_variable_outOfRange = 142;
    				var isy_variable_lux = 143;
    				break;
    			default:
    				var valid_device = false;
    		}

    		if (valid_device == true) {
    			var tag_temp = Math.round(tag.temperature * 10)/10;
    		    KumoApp.Log(tag.name + " Temperature for ISY(" + isy_variable_temp + ") updated to " + tag_temp);
			    KumoApp.httpCall(isy_RESTcall+isy_variable_temp + "/" + tag_temp, "GET");

    			var tag_moisture = Math.round(tag.moisture);
    			KumoApp.Log(tag.name + " Humidity for ISY(" + isy_variable_humi + ") updated to " + tag_moisture);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_humi + "/" + tag_moisture, "GET");

    			var tag_moved = Math.round(tag.hasMoved);
    			var tag_XYZ = (Math.round(tag.angleX/100)+50)*1000000 + (Math.round(tag.angleY/100)+50)*1000 + Math.round(tag.angleZ/100)+50;
                KumoApp.Log(tag.name + " XYZ for ISY(" + isy_variable_moved + ") updated to " + tag_XYZ);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_moved + "/" + tag_XYZ, "GET");

    			var tag_battV = Math.round(tag.batteryVolt * 1000)/1000;
    			KumoApp.Log(tag.name + " Battery Volts for ISY(" + isy_variable_battV + ") updated to " + tag_battV);
    			KumoApp.httpCall(isy_RESTcall+isy_variable_battV + "/" + tag_battV, "GET");
    			
    			var tag_outOfRange = Math.round(tag.outOfRange);
    		    KumoApp.Log(tag.name + " OutOfRange for ISY(" + isy_variable_outOfRange + ") updated to " + tag_outOfRange);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_outOfRange + "/" + tag_outOfRange, "GET");


    			if (tag.lux == 0) {
                    var tag_lux = 0;    			    
    			} else {
    			    var tag_lux = Math.round(Math.sqrt(tag.lux));
    			}
    		    KumoApp.Log(tag.name + " Lux for ISY(" + isy_variable_lux + ") updated to " + tag_lux);
    		    KumoApp.httpCall(isy_RESTcall+isy_variable_lux + "/" + tag_lux, "GET");
    			
    		} else {
    			KumoApp.Log("Data from non-configured device: " + tag.name);
            }
        }
    }
)

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...