Esempio n. 1
0
        public async Task blindUpBedroom()
        {
            var actionToPerform = (int)Enums.HomeActions.BlindDownMailbox;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageBlindToHome(actionToPerform);
        }
Esempio n. 2
0
        public async Task LightOnAll()
        {
            var actionToPerform = (int)Enums.HomeActions.LightOnAll;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageToHome(actionToPerform);
        }
Esempio n. 3
0
        public async Task BlindOffAll()
        {
            var actionToPerform = (int)Enums.HomeActions.BlindDownAll;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageBlindToHome(actionToPerform);
        }
Esempio n. 4
0
        public async Task BlindUpKitchen()
        {
            var actionToPerform = (int)Enums.HomeActions.BlindUpKitchen;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageBlindToHome(actionToPerform);
        }
Esempio n. 5
0
        public async Task MailUser()
        {
            var actionToPerform = (int)Enums.HomeActions.MailUser;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageBlindToHome(actionToPerform);
        }
Esempio n. 6
0
        public async Task GetTemperature()
        {
            var actionToPerform = (int)Enums.HomeActions.GetTemperature;

            var bicServiceBus = new BicServiceBus();

            await bicServiceBus.SendMessageToHome(actionToPerform);
        }
Esempio n. 7
0
        public async Task AuthyOneActionResult([FromBody] AuthyOneClientCallbackResult req)
        {
            var mensajeBot = string.Empty;

            if (req.status == "approved")
            {
                mensajeBot = "La solicitud ha sido aprobada";

                var authyRegister = _context.AuthyAuthorization.Where(authy => authy.AuthyIdentifier == req.uuid).FirstOrDefault();

                if (authyRegister != null)
                {
                    int actionToPerform = 0;
                    var bicServiceBus   = new BicServiceBus();

                    // Encender luz
                    if (authyRegister.AcionToExecute == "encenderluzbaño")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOnBathRoom;
                        await this.sendBotMessage("Encendida luz del baño ok ");
                    }
                    if (authyRegister.AcionToExecute == "encenderluzcocina")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOnKitchen;
                        await this.sendBotMessage("Encendida luz de la cocina");
                    }

                    if (authyRegister.AcionToExecute == "encenderluzrecibidor")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOnEntranceHall;
                        await this.sendBotMessage("Encendida luz del recibidor");
                    }

                    if (authyRegister.AcionToExecute == "encenderluzhabitacion")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOnBedroom;
                        await this.sendBotMessage("Encendida luz de la habitación");
                    }

                    //apagar luz
                    if (authyRegister.AcionToExecute == "apagarluzbaño")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOffBathRoom;
                        await this.sendBotMessage("Apagada luz del baño");
                    }

                    if (authyRegister.AcionToExecute == "apagarluzcocina")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOffKitchen;
                        await this.sendBotMessage("Apagada luz de la cocina");
                    }

                    if (authyRegister.AcionToExecute == "apagarluzrecibidor")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOffEntranceHall;
                        await this.sendBotMessage("Apagada luz del recibidor");
                    }

                    if (authyRegister.AcionToExecute == "apagarluzhabitacion")
                    {
                        actionToPerform = (int)Enums.HomeActions.LightOffBedroom;
                        await this.sendBotMessage("Apagada luz de la habitación");
                    }

                    if (authyRegister.AcionToExecute == "entregarpaquetecartero")
                    {
                        actionToPerform = (int)Enums.HomeActions.MailUser;
                        await this.sendBotMessage("Buzón abierto para depositar el paquete");
                    }

                    if (authyRegister.AcionToExecute == "entregarpaquetecartero")
                    {
                        await bicServiceBus.SendMessageBlindToHome(actionToPerform);
                    }
                    else
                    {
                        await bicServiceBus.SendMessageToHome(actionToPerform);
                    }
                }
            }
            else
            {
                mensajeBot = "La solicitud ha sido rechazada";
            }
        }