Page 1 of 1

change block/device title when value changes

Posted: Wednesday 25 September 2019 21:09
by pvklink
Hi

I made a script that changes the block title when the state of the device changes
Problem is that the title does not change.
When the switch 1474 is On the title must be test1 and test2 when off...

function getChange_1474(idx,value,device){
if(parseFloat(device['state'])='On'){
blocks['1474']['title'] = 'test1';
}

else {
blocks['1474']['title'] = 'test2';
}
}

Re: change block/device title when value changes

Posted: Thursday 26 September 2019 1:38
by HansieNL
Can you try:

Code: Select all

function getStatus_1474(idx,value,device){
	if (device.Data == "On") {
			blocks[1474]['title'] = "test1"
	 }
	 else {
		blocks[1474]['title'] = "test2"
	 }
 }

Re: change block/device title when value changes

Posted: Thursday 26 September 2019 20:28
by pvklink
thanks!
will try that!

Re: change block/device title when value changes

Posted: Friday 27 September 2019 19:51
by pvklink
yes works!

thanks Hansie