Skip to content

Commit 9d70355

Browse files
committed
Closes #1, temperature values should be human readable
1 parent 14e0318 commit 9d70355

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/HomeAutio.Mqtt.Ecobee/EcobeeMqttService.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ await _client.PostAsync<ThermostatUpdateRequest, Response>(request)
154154
case "desiredHeat/set":
155155
if (int.TryParse(message, out int desiredHeatValue))
156156
{
157-
request.Thermostat = new { Runtime = new { DesiredHeat = desiredHeatValue * 100 } };
157+
request.Thermostat = new { Runtime = new { DesiredHeat = desiredHeatValue * 10 } };
158158
var desiredHeatResponse = await _client.PostAsync<ThermostatUpdateRequest, Response>(request)
159159
.ConfigureAwait(false);
160160
_log.LogInformation($"{request.Uri} response: ({desiredHeatResponse.Status.Code}) {desiredHeatResponse.Status.Message}");
@@ -164,7 +164,7 @@ await _client.PostAsync<ThermostatUpdateRequest, Response>(request)
164164
case "desiredCool/set":
165165
if (int.TryParse(message, out int desiredCoolValue))
166166
{
167-
request.Thermostat = new { Runtime = new { DesiredCool = desiredCoolValue * 100 } };
167+
request.Thermostat = new { Runtime = new { DesiredCool = desiredCoolValue * 10 } };
168168
var desiredCoolResponse = await _client.PostAsync<ThermostatUpdateRequest, Response>(request)
169169
.ConfigureAwait(false);
170170
_log.LogInformation($"{request.Uri} response: ({desiredCoolResponse.Status.Code}) {desiredCoolResponse.Status.Message}");
@@ -249,10 +249,10 @@ private async void RefreshThermostatAsync(RevisionStatus revisionStatus)
249249
thermostatStatus.Status["dehumidifierMode"] = thermostat.Settings.DehumidifierMode;
250250
thermostatStatus.Status["autoAway"] = thermostat.Settings.AutoAway ? "true" : "false";
251251
thermostatStatus.Status["vent"] = thermostat.Settings.Vent;
252-
thermostatStatus.Status["actualTemperature"] = thermostat.Runtime.ActualTemperature.ToString();
252+
thermostatStatus.Status["actualTemperature"] = (thermostat.Runtime.ActualTemperature / 10m).ToString();
253253
thermostatStatus.Status["actualHumidity"] = thermostat.Runtime.ActualHumidity.ToString();
254-
thermostatStatus.Status["desiredHeat"] = thermostat.Runtime.DesiredHeat.ToString();
255-
thermostatStatus.Status["desiredCool"] = thermostat.Runtime.DesiredCool.ToString();
254+
thermostatStatus.Status["desiredHeat"] = (thermostat.Runtime.DesiredHeat / 10m).ToString();
255+
thermostatStatus.Status["desiredCool"] = (thermostat.Runtime.DesiredCool / 10m).ToString();
256256
thermostatStatus.Status["desiredHumidity"] = thermostat.Runtime.DesiredHumidity.ToString();
257257
thermostatStatus.Status["desiredDehumidity"] = thermostat.Runtime.DesiredDehumidity.ToString();
258258
thermostatStatus.Status["desiredFanMode"] = thermostat.Runtime.DesiredFanMode;
@@ -262,7 +262,10 @@ private async void RefreshThermostatAsync(RevisionStatus revisionStatus)
262262
{
263263
foreach (var sensor in thermostat.RemoteSensors)
264264
{
265-
thermostatStatus.Sensors[sensor.Name] = sensor.Capability.ToDictionary(s => s.Type, s => s.Value);
265+
// Convert temperature values to human readable
266+
thermostatStatus.Sensors[sensor.Name] = sensor.Capability.ToDictionary(
267+
s => s.Type,
268+
s => string.Equals(s.Type, "temperature", System.StringComparison.OrdinalIgnoreCase) ? (decimal.Parse(s.Value) / 10m).ToString() : s.Value);
266269
}
267270
}
268271

0 commit comments

Comments
 (0)