/// <summary>
 /// Helper method to convert a <see cref="ThermostatInfo"/> instance
 /// to a <see cref="ThermostatData"/> instance.
 /// </summary>
 /// <param name="info">The full data instance.</param>
 /// <returns>The converted data.</returns>
 public static ThermostatData ToThermostatData(this ThermostatInfo info)
 {
     return(new ThermostatData()
     {
         Uuid = info?.Uuid,
         Link = info?.Link,
         Name = info?.Name
     });
 }
Beispiel #2
0
        public async Task <ThermostatData> GetThermostatData(string thermostatId)
        {
            Log.Information("Getting thermostat info");
            Log.Debug("Requesting information for thermostat ID {ThermostatId}", thermostatId);

            var requestUrl = thermostatsUrl + thermostatId;

            var json = await getJsonData(requestUrl).ConfigureAwait(false);

            var thermostat = ThermostatInfo.FromJson(json);

            return(thermostat.Data);
        }
 /// <summary>
 /// Helper method to copy data from a <see cref="ThermostatData"/>
 /// to a <see cref="ThermostatInfo"/> instance.
 /// </summary>
 /// <param name="info">The full data instance.</param>
 /// <param name="data">The data instance.</param>
 public static void CopyFrom(this ThermostatInfo info, ThermostatData data)
 {
     info.Link = data?.Link;
     info.Name = data?.Name;
 }