Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
fix(sensor): add NaN check to temperature and humidity sensors (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ultra-bob authored Aug 14, 2024
1 parent 6f910d9 commit be15131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class HumidityMeasurementAspect extends AspectBase {
}

getMeasuredValue(state: string) {
if (state != null) {
if (state != null && !isNaN(+state)) {
return +state * 100;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class TemperatureMeasurementAspect extends AspectBase {
}

getTemperatureInCelsius(entity: HomeAssistantMatterEntity): number | null {
if (entity.state == null) {
if (entity.state == null || isNaN(+entity.state)) {
return null;
}

Expand Down

0 comments on commit be15131

Please sign in to comment.