Ejemplo n.º 1
0
        private void SendDataToPvOutput(DomoticzData energyGenerationData, DomoticzData p1MeterData)
        {
            PvOutputData pvOutputData = new PvOutputData();

            pvOutputData.Date             = DateTime.Parse(energyGenerationData.Result[0].LastUpdate).ToString("yyyyMMdd");
            pvOutputData.Time             = DateTime.Parse(energyGenerationData.Result[0].LastUpdate).ToString("HH:mm");
            pvOutputData.EnergyGeneration = int.Parse(Regex.Replace(energyGenerationData.Result[0].CounterToday, "[^0-9]", ""));
            pvOutputData.PowerGeneration  = int.Parse(Regex.Replace(energyGenerationData.Result[0].Usage, "[^0-9]", ""));


            //Energy
            var counterToday  = p1MeterData.Result[0].CounterToday;
            var deliveryToday = p1MeterData.Result[0].CounterDelivToday;

            // Power
            var usage            = int.Parse(Regex.Replace(p1MeterData.Result[0].Usage, "[^0-9]", ""));
            var delivery         = int.Parse(Regex.Replace(p1MeterData.Result[0].UsageDeliv, "[^0-9]", ""));
            var powerConsumption = usage - delivery;

            pvOutputData.PowerConsumption = powerConsumption;

            PvOutputDataList.Add(pvOutputData);
            if (PvOutputDataList.Count > 50)
            {
                PvOutputDataList.RemoveAt(0);
            }

            PvOutputService.AddStatus(pvOutputData);

            InvokeAsync(StateHasChanged);
        }
Ejemplo n.º 2
0
        public async Task <DomoticzData> GetDeviceByIdx(int idx)
        {
            var result1 = await httpClient.GetAsync($"/json.htm?type=devices&rid={idx}");

            var resultString = await result1.Content.ReadAsStringAsync();

            DomoticzData domoticzData = JsonConvert.DeserializeObject <DomoticzData>(resultString);

            return(domoticzData);
        }
Ejemplo n.º 3
0
 public async void GetDomoticzData()
 {
     domoticzData = await DomoticzService.GetDomoticzData();            // GetDeviceByIdx(26);
     await InvokeAsync(StateHasChanged);
 }