custom.js Status of other device?
Posted: Friday 30 April 2021 12:07
Hello
Could someone help me to get the value/state/data of other device in a function getStatus_Block like :
This device WindowTest is a simple switch on/off, and I tried without success:
- blocks['WindowTest']['Data'], blocks['WindowTest'].Data,
- blocks['WindowTest']['Value'], blocks['WindowTest'].value,
- blocks['WindowTest']['State'], blocks['WindowTest'].state,
- blocks['WindowTest']['Status'], blocks['WindowTest'].status,
but it gives me all the time an 'undefined'
I don't think I'm too far cause I can have the blocks['WindowTest'].title and blocks['WindowTest'].idx
Thanks for your help.
Could someone help me to get the value/state/data of other device in a function getStatus_Block like :
Code: Select all
function getStatus_BlindTest(block){
var device = block.device;
if(device['Data']=='Closed') { /* blind closed */
Dashticz.setBlock('BlindTest', {textOff: 'blind closed', imageOff: 'perso/blind_closed.png' });
} else if( device['Data']=='Open' ) { /* blind opened */
if( blocks['WindowTest']['Data']=='On' ) { /* blind opened and window opened */
Dashticz.setBlock('BlindTest', {textOn: 'window opened', imageOn: 'perso/window_opened.png' });
} else { /* blind opened and window closed */
Dashticz.setBlock('BlindTest', {textOn: 'blind opened', imageOn: 'perso/blind_opened.png' });
}
}
}
- blocks['WindowTest']['Data'], blocks['WindowTest'].Data,
- blocks['WindowTest']['Value'], blocks['WindowTest'].value,
- blocks['WindowTest']['State'], blocks['WindowTest'].state,
- blocks['WindowTest']['Status'], blocks['WindowTest'].status,
but it gives me all the time an 'undefined'

I don't think I'm too far cause I can have the blocks['WindowTest'].title and blocks['WindowTest'].idx

Thanks for your help.