Skip to content

Commit

Permalink
fix(device_icon): remove jpg provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Dec 24, 2024
1 parent dc95dd7 commit d8b9503
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/components/device-image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ type ImageGeneratorFn = (device: Device) => string | undefined;
const z2mBasePath = 'https://www.zigbee2mqtt.io/images/devices/';

export const getZ2mDeviceImage = (device: Device): string =>
`${z2mBasePath}${sanitizeZ2MDeviceName(device?.definition?.model)}.jpg`;
export const getZ2mDeviceImagePng = (device: Device): string =>
`${z2mBasePath}${sanitizeZ2MDeviceName(device?.definition?.model)}.png`;
const getConverterDeviceImage = (device: Device): string | undefined => device.definition?.icon;

/* prettier-ignore */
export const AVAILABLE_GENERATORS: ImageGeneratorFn[] = [
getConverterDeviceImage,
getZ2mDeviceImagePng,
getZ2mDeviceImage,
() => genericDevice,
];
4 changes: 2 additions & 2 deletions src/components/settings-page/image-localiser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Button from '../button';
import { Device, IEEEEAddress } from '../../types';
import { WithDevices } from '../../store';
import { DeviceApi } from '../../actions/DeviceApi';
import { getZ2mDeviceImage, getZ2mDeviceImagePng } from '../device-image';
import { getZ2mDeviceImage } from '../device-image';

type LocaliserState = 'none' | 'start' | 'inprogress' | 'done';

Expand Down Expand Up @@ -52,7 +52,7 @@ function ImageLocaliser(props: Props): JSX.Element {
setLocalisationStatus((curr) => {
return { ...curr, [device.ieee_address]: 'init' };
});
const success = await asyncSome([getZ2mDeviceImagePng, getZ2mDeviceImage], async (generator) => {
const success = await asyncSome([getZ2mDeviceImage], async (generator) => {
const imageUrl = generator(device);
const imageContent = await downloadImage(imageUrl);
await setDeviceOptions(device.ieee_address, { icon: imageContent });
Expand Down

0 comments on commit d8b9503

Please sign in to comment.