Exemplo n.º 1
0
        /// <summary>
        /// Retrieves Min and Max data from a specific inverter asyncronously
        /// </summary>
        /// <param name="deviceId">Inverter to retrieve data from</param>
        /// <returns>Min and Max data for the given inverter</returns>
        public async Task <MinMaxInverterData> GetMinMaxInverterDataAsync(int deviceId = 1)
        {
            Uri ep = new Uri($"{BaseUrlString}GetInverterRealtimeData.cgi?Scope=Device&DataCollection=MinMaxInverterData&DeviceId={deviceId}");

            HttpResponseMessage m = await _httpClient.GetAsync(ep);

            string content = await m.Content.ReadAsStringAsync();

            SolarApiResponse <MinMaxInverterData> r = JsonConvert.DeserializeObject <SolarApiResponse <MinMaxInverterData> >(content);

            return(r.Body.Data);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieve smart meter data from the solarnet asyncronously.
        /// </summary>
        /// <returns>Meter data from single or three phase meters. <see cref="GetEnrichedSystemMeterDataAsync"/> for retrieving meter data with unit information.</returns>
        /// <seealso cref="GetEnrichedSystemMeterDataAsync"/>
        public async Task <MeterData> GetSystemMeterDataAsync()
        {
            Uri ep = new Uri($"{BaseUrlString}GetMeterRealtimeData.cgi?Scope=System");

            HttpResponseMessage m = await _httpClient.GetAsync(ep);

            string content = await m.Content.ReadAsStringAsync();

            SolarApiResponse <MeterData> r = JsonConvert.DeserializeObject <SolarApiResponse <MeterData> >(content);

            return(r.Body.Data);
        }