AltUI: Device Variables

Google Chrome: Version 46.0.2490.80 m
AltUI: v95.871
openLuup: v5.5

I noticed that I’m not able to modify the variable value within the device, see attached.

Console

Uncaught TypeError: Cannot read property 'service' of undefined _clickOnValue @ J_ALTUI_uimgr.js:3361 m.event.dispatch @ jquery.js:4670 r.handle @ jquery.js:4338 cobalt/:1

I imagine that this is openLuup’s fault, and not AltUI’s, in the first instance.

Perhaps best to deal with this on that board? Would need to know what the HTTP request that is failing is actually requesting. It looks like you have a missing icon, but that shouldn’t be fatal.

However, I might be wrong.

It works OK on a real Vera with the latest AltUI.

Cleared browser cache and this started working in openLuup too.

No, it’s broken again on Vera Edge. Just clicking on various variables seems to insert random values, and then clicking on them again does nothing…

…sorry for the conflicting posts.

This is with AltUI v0.95.871, with both Firefox on a Mac and Safari on an iPad.


Edit: reverting to version 859 fixed this for me.

Hello,

it’s a bug I’ve reported to amg0.
In this function “clickOnValue”, the id of the variables are used as position.
In openLuup, the variables have an unique id and the numbering does not begin again for every device.

Travelling right now. Will look at this when I am back. In the mean time if someone wants to propose a fix ?

Here is a possible fix for “J_ALTUI_uimgr.js” file, line 3357 :

function _deviceDrawVariables(device) {

		function _searchIdInStates(states, id) {
			id = parseInt(id, 10);
			for ( var i = 0; i < states.length; i++ ) {
				if ( states[ i ].id === id ) {
					return i;
				}
			}
			return -1;
		}

		function _clickOnValue() {
			var id = $(this).prop('id');	// idx in variable state array
			id = _searchIdInStates( device.states, id );
			var tbl = [device.states[id].service , device.states[id].variable]//atob(id).split('.');

The missing icon is a known issue which actually you and amg0 looked at in the openLuup/Philips Hue thread for me.

[quote=“akbooer, post:3, topic:189508”]Would need to know what the HTTP request that is failing is actually requesting. It looks like you have a missing icon, but that shouldn’t be fatal.
However, I might be wrong.[/quote]

[quote=“vosmont, post:8, topic:189508”]Here is a possible fix for “J_ALTUI_uimgr.js” file, line 3357 :

[code]
function _deviceDrawVariables(device) {

	function _searchIdInStates(states, id) {
		id = parseInt(id, 10);
		for ( var i = 0; i < states.length; i++ ) {
			if ( states[ i ].id === id ) {
				return i;
			}
		}
		return -1;
	}

	function _clickOnValue() {
		var id = $(this).prop('id');	// idx in variable state array
		id = _searchIdInStates( device.states, id );
		var tbl = [device.states[id].service , device.states[id].variable]//atob(id).split('.');

[/code][/quote]
yes thatnk youj. you can use the MultiBox api. need the same code in the focusout() too. i ll post the fix

var state =  MultiBox.getStateByID( device.altuiid, id );
var tbl = [state.service , state.variable];