Homey Community

Device setAlbumArtImage



in device.js

const avtoRadioLogo = new Homey.Image('png');
avtoRadioLogo.register().then(result => console.log("REGISTER ", result)).catch(console.error);


Image {
  format: 'png',
  id: '65f4cfbd-c135-4d53-98a0-7e25696b7697',
  __client: { emit: [Function: bound __onImageEmit] },
  _type: 'path',
  _source: './assets/images/radio/logos/avtoradio.png' }

this.setAlbumArtImage(avtoRadioLogo, true)

not worked


Where/when exactly do you call this.setAlbumArtImage()? Also, what does “not worked” mean? Do you get errors?


I want to change the images for the album
does not work this.setAlbumArtImage(autoRadioLogo, true)


Do you have your code online somewhere?



I’m not quite sure if you can register an image there (at the top of your module), but I’ve never worked with images before. Perhaps putting it inside of onInit is better:

async onInit() {
 this.avtoRadioLogo = new Homey.Image('png');
 await this.avtoRadioLogo.register().then(result => console.log("REGISTER ", result)).catch(console.error);

(and use this.avtoRadioLogo instead of avtoRadioLogo when you need to reference it)

Also, this seems strange:

that.setAlbumArtImage(avtoRadioLogo, true)

The second argument for setAlbumArtImage should be an (optional) callback, not a boolean. I have no idea if passing a boolean will make it fail or not, but either pass a function, or nothing at all:




it’s decided

async onInit() {
this.image = new Homey.Image(‘jpg’);
.then(() => {
return this.setAlbumArtImage(this.image);

on some function