private async Task ReadConfiguration() { var hostBase = await _configurationProxy.GetString(ConfigurationConstants.OPENWEATHERMAP_HOST_BASE); var cityId = await _configurationProxy.GetString(ConfigurationConstants.OPENWEATHERMAP_CITY_ID); var appId = await _configurationProxy.GetString(ConfigurationConstants.OPENWEATHERMAP_CLIENT_ID); _regex = await _configurationProxy.GetString(ConfigurationConstants.OPENWEATHERMAP_REGEX); _url = $"{hostBase}?id={cityId}&appid={appId}&units=metric"; }
public async Task <(decimal, decimal)> GetPowerUsage() { var host = await _configurationProxy.GetString(ConfigurationConstants.SHELLY_HOST_BASE); var client = new RestClient(host); client.UseSystemTextJson(); var request = new RestRequest("status", Method.GET); var response = await client.ExecuteAsync <ShellyEMetering>(request); if (response.ResponseStatus == ResponseStatus.Completed && response.StatusCode == HttpStatusCode.OK && response.Data != null && response.Data.Meters.Count == 2) { return(response.Data.Meters[0].Power, response.Data.Meters[1].Power); } return(0M, 0M); }
private async Task ReadConfiguration() { var hostBase = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_HOST_BASE); var loginUrl = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_LOGON_RESOURCE); _loginUrl = $"{hostBase}/{loginUrl}"; var reportUrl = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_REPORT_RESOURCE); _reportUrl = $"{hostBase}/{reportUrl}"; var logoffUrl = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_LOGOFF_RESOURCE); _logoutUrl = $"{hostBase}/{logoffUrl}"; _admin = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_ADMIN); _regex = await _configurationProxy.GetString(ConfigurationConstants.SMAPPEE_REGEX); }
private async Task ReadConfiguration() { _url = await _configurationProxy.GetString(ConfigurationConstants.SAUNASERVICE_HOST); }