/// <summary>
        /// Refreshes the states.
        /// </summary>
        public void RefreshStates()
        {
            InnogyRequestHandler reqH = new InnogyRequestHandler(authHandler.Token);

            DeviceStates     = reqH.Perform(RequestTyp.DeviceState) as List <DeviceState>;
            CapabilityStates = reqH.Perform(RequestTyp.CapabilityState) as List <DeviceState>;
        }
        /// <summary>
        /// Initializes the data.
        /// </summary>
        public void InitializeData()
        {
            InnogyRequestHandler reqH = default(InnogyRequestHandler);

            reqH = new InnogyRequestHandler(authHandler.Token);

            if (!this.IsInitialized)
            {
                CurrentConf = reqH.Perform(RequestTyp.Initialize) as CurrentConf;

                //User
                User = reqH.Perform(RequestTyp.User) as User;

                //Nachrichten
                Messages = reqH.Perform(RequestTyp.Message) as List <Message>;

                //Ortes
                Locations     = reqH.Perform(RequestTyp.Location) as List <Location>;
                LocationTypes = reqH.Perform(RequestTyp.LocationTypes) as List <LocationTypes>;

                //Geräte-Daten
                Devices      = reqH.Perform(RequestTyp.Device) as List <Device>;
                DeviceStates = reqH.Perform(RequestTyp.DeviceState) as List <DeviceState>;

                //Funktionen
                Capabilities     = reqH.Perform(RequestTyp.Capability) as List <Capability>;
                CapabilityStates = reqH.Perform(RequestTyp.CapabilityState) as List <DeviceState>;

                //Szenarien
                Interactions = reqH.Perform(RequestTyp.Interaction) as List <Interaction>;

                this.IsInitialized = true;
                this.websockerHandler.Open(authHandler.Token);
            }
        }
        /// <summary>
        /// Gets the activities.
        /// </summary>
        /// <param name="devActInf">The dev act inf.</param>
        /// <returns></returns>
        public DeviceActivity GetActivities(DeviceActivityInfo devActInf)
        {
            InnogyRequestHandler reqH       = new InnogyRequestHandler(authHandler.Token);
            DeviceActivity       devData    = new DeviceActivity();
            DeviceActivity       dynDevData = default(DeviceActivity);
            int p = 0;

            //Mehrere Requests ausführen, da nur 100 Datensätze pro Request geliefert werden
            p = 0;
            do
            {
                p         += 1;
                dynDevData = reqH.Perform(RequestTyp.DeviceActivity, devActInf.ToQuery(p)) as DeviceActivity;
                if (p == 1)
                {
                    devData = dynDevData;
                }
                else
                {
                    devData.Activities.AddRange(dynDevData.Activities);
                }

                Thread.Sleep(600);
            } while (devData.Count > p * 100);

            devData.Returned = devData.Activities.Count;
            return(devData);
        }
        /// <summary>
        /// Does the action.
        /// </summary>
        /// <param name="actInf">The act inf.</param>
        /// <returns></returns>
        public bool DoAction(ActionInfo actInf)
        {
            ActionResponse       actres = default(ActionResponse);
            InnogyRequestHandler reqH   = new InnogyRequestHandler(authHandler.Token);

            actres = reqH.Perform(RequestTyp.Action, actInf.ToInAction()) as ActionResponse;
            if (actres.ResultCode == "Success")
            {
                IHasID iObejct = GetObjectByID <DeviceState>(actInf.ID);
                if (iObejct.GetType() == typeof(DeviceState))
                {
                    (iObejct as DeviceState).State.Find(s => s.Name == actInf.Setting).Value = actInf.Value.ToString();
                }
                return(true);
            }
            return(false);
        }