diff --git a/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.html b/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.html index 2fe720ef..857cad21 100644 --- a/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.html +++ b/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.html @@ -36,7 +36,7 @@

{{ 'IOTDEVICE.DETAIL' | translate }}

{{ 'IOTDEVICE.GENERIC_HTTP.APIKEY' | translate }} - {{ getGenericHttpDeviceUrl(device) }} + {{ httpDeviceUrl }}

diff --git a/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.ts b/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.ts index 703e1a24..ac439b80 100644 --- a/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.ts +++ b/src/app/applications/iot-devices/iot-device-detail/iot-device-detail-generic/iot-device-detail-generic.component.ts @@ -30,6 +30,7 @@ export class IotDeviceDetailGenericComponent @Input() longitude = 0; deleteDevice = new EventEmitter(); baseUrl: string = environment.baseUrl; + httpDeviceUrl: string; private readonly CHIRPSTACK_BATTERY_NOT_AVAILIBLE = 255; @@ -43,6 +44,7 @@ export class IotDeviceDetailGenericComponent ngOnChanges(changes: SimpleChanges): void { this.batteryStatusPercentage = this.getBatteryProcentage(); + this.httpDeviceUrl = this.getGenericHttpDeviceUrl(); if ( changes?.device?.previousValue?.metadata !== @@ -66,7 +68,7 @@ export class IotDeviceDetailGenericComponent }; } - getBatteryProcentage(): number { + private getBatteryProcentage(): number { if ( this.device?.lorawanSettings?.deviceStatusBattery === this.CHIRPSTACK_BATTERY_NOT_AVAILIBLE @@ -76,8 +78,8 @@ export class IotDeviceDetailGenericComponent return Math.round(this.device?.lorawanSettings?.deviceStatusBattery); } - getGenericHttpDeviceUrl(device: IotDevice): string { - return `${this.baseUrl}receive-data?apiKey=${device.apiKey}`; + private getGenericHttpDeviceUrl(): string { + return `${this.baseUrl}receive-data?apiKey=${this.device.apiKey}`; } ngOnDestroy(): void {}