diff --git a/main.js b/main.js index 83997e5..37a532e 100644 --- a/main.js +++ b/main.js @@ -389,6 +389,14 @@ class Covid19 extends utils.Adapter { try { await this.writeHospitalDataForId(channelName, await HospitalService.getGermanHospitalDataByFederalState(germanHospitalData$, federalStateName)); + // Create hospital channel for each Federal State + await this.extendObjectAsync(`${channelName}.Hospital`, { + type: 'channel', + common: { + name: `Hospital`, + }, + native: {}, + }); } catch (error) { this.log.error(`Cannot write hospital data for ${channelName}: ${error}`); } @@ -885,6 +893,15 @@ class Covid19 extends utils.Adapter { return; } + + await this.extendObjectAsync(`${id}.Hospital`, { + type: 'channel', + common: { + name: `Hospital`, + }, + native: {}, + }); + for (const key of Object.keys(data)) { await this.localCreateState(`${id}.Hospital.${key}`, key, data[key]); }