示例#1
0
        public async Task <bool> Start()
        {
            _aircoManager = new AircoManager(_httpClientFactory.CreateClient());

            if (!string.IsNullOrEmpty(_config.AuthCode))
            {
                _aircoManager.SetAuthorizationToken(_config.AuthCode);

                _schedulerService.AddPolling(PollingConds, "PANASONIC_AIR_CONDITIONER",
                                             SchedulerServicePollingEnum.NORMAL_POLLING);
            }
            else if (!string.IsNullOrEmpty(_config.Username))
            {
                var result = await _aircoManager.Login("0", _config.Username, _config.Password);

                if (result.Result == 0)
                {
                    _config.AuthCode = result.UToken;

                    _componentsService.SaveComponentConfig(_config);
                }
            }

            return(true);
        }
示例#2
0
 public PanasonicAirComponent(ILoggerFactory loggerFactory, IIoTService ioTService, IComponentsService componentsService, IHttpClientFactory httpClientFactory) : base(loggerFactory, ioTService, componentsService)
 {
     _aircoManager = new AircoManager(httpClientFactory.CreateClient());
 }