Skip to content

Commit

Permalink
Change int to decimal to support more sensors (#1)
Browse files Browse the repository at this point in the history
Use `double` instead of `int` for `CurrentTemperature` to support more accurate sensors.

---------

Co-authored-by: ugge <IamOskar@hotmail.com>
  • Loading branch information
oskary and ugge authored Mar 2, 2024
1 parent 1efab10 commit 55da2d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dirigera.Lib/Dirigera.Lib/Models/EnvironmentSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Dirigera.Models
{
public class EnvironmentSensor : Device
{
public int CurrentTemperature { get; internal set; }
public double CurrentTemperature { get; internal set; }
public int CurrentRH { get; internal set; }
public int CurrentPM25 { get; internal set; }
public int MaxMeasuredPM25 { get; internal set; }
Expand All @@ -25,7 +25,7 @@ internal override void PopulateFromDto(DeviceDto dto)
// Extract the "standard" attributes from the Attributes dictionary into their own properties
if (dto.Attributes is not null)
{
if (dto.Attributes.ContainsKey("currentTemperature")) CurrentTemperature = dto.Attributes["currentTemperature"].GetInt32();
if (dto.Attributes.ContainsKey("currentTemperature")) CurrentTemperature = dto.Attributes["currentTemperature"].GetDouble();
if (dto.Attributes.ContainsKey("currentRH")) CurrentRH = dto.Attributes["currentRH"].GetInt32();
if (dto.Attributes.ContainsKey("currentPM25")) CurrentPM25 = dto.Attributes["currentPM25"].GetInt32();
if (dto.Attributes.ContainsKey("maxMeasuredPM25")) MaxMeasuredPM25 = dto.Attributes["maxMeasuredPM25"].GetInt32();
Expand Down

0 comments on commit 55da2d5

Please sign in to comment.