var deviceState='';
function getBlock_123(device, idx){
$('.block_'+idx);
if (device['Level']= 0) deviceState='Off';
else if (device['Lev[code]el']= 10) deviceState='CV';
else if (device['Level']= 20) deviceState='WW';
else window.deviceState='Error';
console.log("DeviceState inside function", deviceState); //It works
return deviceState;
}
function getBlock_456(device, idx){
console.log("DeviceState inside another function", deviceState); //It works
}
[Can you spot the logical or grammatical error in this line of codes?
Brackets, if, else without or within brackets is not my strength (Any programing language)
if (levelNamesEncoded === true) names = window.atob(_idxvalues_236['LevelNames']).split('|'); //Show the text level of idx236
else names = _idxvalues_236['LevelNames'].split('|');
//Untill here it's working, vars are also tested and working
/* Here is where the grammar and/or logic is not in sync, lots of code changes to try to make dashticz start so I lost track */
for (a in names){
if (a == parseFloat(device['Level'] ) // I use all the values
if (_idxvalues_238['Level'] =='50' && _idxvalues_236['Level'] =='30'); //If this compare is true
html += '<div class="col-xs-6 col-data-thermostat">';
html += '<strong class="Title">' + Handmatig + _SetPoint +symbol_temp+'</strong><br />'; //Display this
else if (_idxvalues_236['Level'] =='30'); //Else if this is true
html += '<strong class="title">' + Tijdelijk +names[a] +'</strong><br />'; //Display this
else if (_idxvalues_236['Level'] =='20'); // Else if this is true
html += '<strong class="title">'+Scene_value+'</strong><br />'; //Display this
else console.log("Not defined"); //Catch all error, do we really need the "else" statement to close" ?
// switch statement could also work here I guess
}
}
Last edited by Ierlandfan on Tuesday 26 November 2019 18:12, edited 1 time in total.
if (levelNamesEncoded === true) names = window.atob(_idxvalues_236['LevelNames']).split('|'); //Show the text level of idx236
else names = _idxvalues_236['LevelNames'].split('|');
//Untill here it's working, vars are also tested and working
/* Here is where the grammar and/or logic is not in sync, lots of code changes to try to make dashticz start so I lost track */
for (a in names)
{
if (a == parseFloat(device['Level'] ) // I use all the values
{
if (_idxvalues_238['Level'] =='50' && _idxvalues_236['Level'] =='30'); //If this compare is true
{
html += '<div class="col-xs-6 col-data-thermostat">';
html += '<strong class="Title">' + Handmatig + _SetPoint +symbol_temp+'</strong><br />'; //Display this
}
else if (_idxvalues_236['Level'] =='30'); //Else if this is true
{
html += '<strong class="title">' + Tijdelijk +names[a] +'</strong><br />'; //Display this
}
else if (_idxvalues_236['Level'] =='20'); // Else if this is true
{
html += '<strong class="title">'+Scene_value+'</strong><br />'; //Display this
}
else console.log("Not defined"); //Catch all error, do we really need the "else" statement to close" ?
{
// switch statement could also work here I guess
}
}
}
There were quite a few errors; missing parenthesis, if statements not closed, etc. This is now valid JS, I will leave it to you to check the variable names, ids, etc. Cheers