Change button image/url depends data other block
Posted: Saturday 14 November 2020 11:51
Is it possible to change the btnimage and url for a button depending on the data of another block.
I have a block "Yamaha_AlbumArt". I want the data of this block is the input for the btnimage and url.
Data is for example "http://x.x.x.x/YamahaRemoteControl/Albu ... RT8175.png".
Below an example, but this doesn't work:
config.js
blocks['Yamaha_AlbumArt'] = {
idx: 2636,
last_update: false,
width: 4,
}
buttons.yamahaalbum = {
width: 3,
key: 'yamahaalbum',
forcerefresh:1,
isimage: true,
refresh: 5,
}
custom.js
function getStatus_Yamaha_AlbumArt(block) {
var idx = block.idx;
var device = block.device;
console.log(device.Data);
Dashticz.setBlock("buttons.yamahaalbum", {
image: device.Data,
});
}
I have a block "Yamaha_AlbumArt". I want the data of this block is the input for the btnimage and url.
Data is for example "http://x.x.x.x/YamahaRemoteControl/Albu ... RT8175.png".
Below an example, but this doesn't work:
config.js
blocks['Yamaha_AlbumArt'] = {
idx: 2636,
last_update: false,
width: 4,
}
buttons.yamahaalbum = {
width: 3,
key: 'yamahaalbum',
forcerefresh:1,
isimage: true,
refresh: 5,
}
custom.js
function getStatus_Yamaha_AlbumArt(block) {
var idx = block.idx;
var device = block.device;
console.log(device.Data);
Dashticz.setBlock("buttons.yamahaalbum", {
image: device.Data,
});
}