Example #1
0
        static async Task <int> Status(StatusOptions options)
        {
            await ValidateToken();

            var status = await _manager.GetDeviceStatus(options.DeviceId);

            Console.WriteLine($"OperationMode: {status.Parameters.OperationMode.ToString()}");
            Console.WriteLine($"InsideTemperature: {status.Parameters.InsideTemperature}");
            Console.WriteLine($"OutTemperature: {status.Parameters.OutTemperature}");
            Console.WriteLine($"TemperatureSet: {status.Parameters.TemperatureSet}");

            return(0);
        }
Example #2
0
        private async void PollingConds()
        {
            try
            {
                var deviceGroups = await _aircoManager.GetDeviceGroups();

                deviceGroups.GroupList.ForEach(g =>
                {
                    g.DeviceIdList.ForEach(async d =>
                    {
                        try
                        {
                            var device   = await _aircoManager.GetDeviceStatus(d.DeviceGuid);
                            var deviceEd = new PanasonicAirConditioner
                            {
                                EntityName        = d.DeviceName,
                                DeviceId          = d.DeviceGuid,
                                GroupName         = g.GroupName,
                                InsideTemperature = device.Parameters.InsideTemperature,
                                OutTemperature    = device.Parameters.OutTemperature,
                                TemperatureSet    = device.Parameters.TemperatureSet,
                                OperationMode     = device.Parameters.OperationMode.ToString()
                            };


                            _ioTService.InsertEvent(deviceEd);
                        }
                        catch (Exception e)
                        {
                            _logger.LogError($"Error during air conditioner => {e}");
                        }
                    });
                });
            }
            catch (Exception e)
            {
                if (e.Message.Contains("Token expires"))
                {
                    _config.AuthCode = "";
                    await Start();
                }
                else
                {
                    _logger.LogError($"Error during air conditioner");
                }
                //throw;
            }
        }