public static string GetToken()
        {
            PhotonRESTService service = new PhotonRESTService();

            service.GetJSONOAuth();

            return "";
        }
        //Get movement YES/NO
        public static Variable GetDevicePIRStatus()
        {
            PhotonRESTService service = new PhotonRESTService();

            string json = service.GetJSONVariable("PIRState");

            //dynamic context = JObject.Parse(json);
            Variable variable = Newtonsoft.Json.JsonConvert.DeserializeObject<Variable>(json);
            return variable;
        }
        public static Device GetDeviceStatus(string deviceId)
        {
            string cacheLocation = "DeviceStatus." + deviceId;
            try
            {
                if (Photon.Services.Utilities.CacheManager.ValidatExistence(cacheLocation))
                {
                    return Photon.Services.Utilities.CacheManager.Get(cacheLocation) as Device;
                }
                else
                {
                    lock (syncRoot)
                    {
                        if (!Photon.Services.Utilities.CacheManager.ValidatExistence(cacheLocation))
                        {
                            PhotonRESTService service = new PhotonRESTService();

                            //Dictionary<string, string> additionalParameters = new Dictionary<string, string>();
                            //additionalParameters.Add("area_id", "1"); //World
                            //additionalParameters.Add("authorized", "yes"); //authorized

                            string json = service.GetJSON(deviceId);

                            Device device = Newtonsoft.Json.JsonConvert.DeserializeObject<Device>(json);
                            Photon.Services.Utilities.CacheManager.Add(cacheLocation, deviceId, 1);
                            return device;
                        }
                        else
                        {
                            return Photon.Services.Utilities.CacheManager.Get(cacheLocation) as Device;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return new Device() { Connected = false };
            }
        }