[quote=“reneboer, post:1, topic:198456”]Hi amg0,
I am developing a new plugin and as always you end up with a couple of variables you no longer need. When trying to delete them on the Variables screen, their values got removed, but the variables them self are not removed. What I did see is that values of other variables got changed/wiped.
I can reproduce this. Running on openLuup, latest Firefox on Win10 with latest ALTUI version. Open the Variables page, click delete on two or three variables, click save. Re-open the variables and things look wrong.
If you want me to test a bit more let me know.
Cheers Rene[/quote]
first, do it one by one from the variable dialog box. each one may / should trigger a reload and you need to wait for it, or simply delete the value and go into misc / debug / fix device states
are you sure it is not a openluup bug ? I do use it on vera successfully, have you tried on VERA ?
in fact ALTUI just sends a ModifyUserData for the device, with all the device variables reordered and it is exactly one piece of code on openluup side that akbooer has to review due to recent changes I had to due because of new firmware security hardening
[code] function modifyDevice( device, cbfunc)
{
var target = {};
target.devices={};
target.devices["devices"+device.id]={
states:[]
};
// build state map with unique ID for states
var states_arr = target.devices["devices_"+device.id].states;
var n=0;
$.each(device.states, function(idx,state) {
if ( state.value.toString()!="") {
state.id = n++;
states_arr.push(state)
}
});
return _ModifyUserData( target, function(result) {
if (result==null) {
PageMessage.message( "Modify Device action failed!", "warning" );
}
else {
PageMessage.message( "Modify Device succeeded! a LUUP reload will happen now, be patient", "success" );
}
if ($.isFunction(cbfunc))
(cbfunc)(result);
});
};
[/code]
and the modify user data does
return $.ajax({
url: url,
type: "POST",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
data: {
id:'lu_action',
serviceId:'urn:micasaverde-com:serviceId:HomeAutomationGateway1',
action:'ModifyUserData',
DataFormat:'json',
inUserData: JSON.stringify(target)
}
})