Example #1
0
        public object SetAcMode(int selecteId, AcMode mode)
        {
            var result = _client.ConnectAndSend(_atMessages.GetInitMsg());
            var parser = new MessageResponseParser();
            var at     = parser.Parse(result);

            var ac = at.GetSelectedAircon();

            if (ac != null)
            {
                result = _client.ConnectAndSend(_atMessages.SetMode(at.SelectedAc, ac.BrandId, (int)mode));
                at     = parser.Parse(result);
            }
            else
            {
                throw new Exception("Failed to find selected aircon unit");
            }

            var response = System.Text.Json.JsonSerializer.Serialize <AirTouchSystem>(at, _serializeOptions);

            Log.ForContext <VzduchDotekController>().Verbose("{@AirTouchSystem}", at);

            return(Content(response, "application/json"));
        }
Example #2
0
 public AcCommand Heat()
 {
     _mode = AcMode.Heat; return(this);
 }
Example #3
0
 public AcCommand Cold()
 {
     _mode = AcMode.Cold; return(this);
 }