Skip to content

Commit

Permalink
fix: don't throw error if no related entities found
Browse files Browse the repository at this point in the history
  • Loading branch information
punxaphil committed Oct 28, 2024
1 parent a66a876 commit 96de3f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services/hass-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class HassService {
}

async getRelatedEntities(player: MediaPlayer, ...entityTypes: string[]) {
return new Promise<HassEntity[]>(async (resolve, reject) => {
return new Promise<HassEntity[]>(async (resolve) => {
const subscribeMessage = {
type: 'render_template',
template: "{{ device_entities(device_id('" + player.id + "')) }}",
Expand All @@ -59,8 +59,8 @@ export default class HassService {
.map((item) => this.hass.states[item]),
);
}, subscribeMessage);
} catch (e) {
reject(e);
} catch {
resolve([]);
}
});
}
Expand Down

0 comments on commit 96de3f2

Please sign in to comment.