Esempio n. 1
0
        public LifxBulb(string json, LifxManager manager)
        {
            JToken bulbData = JObject.Parse(json);

            this.manager = manager;
            id           = bulbData.Value <string>("id");
            Uuid         = bulbData.Value <string>("uuid");
            Label        = bulbData.Value <string>("label");
            Connected    = bulbData.Value <bool>("connected") ? "Online" : "Offline";
            Power        = bulbData.Value <string>("power").Equals("on") && Connected.Equals("Online") ? true : false;
            Brightness   = bulbData.Value <float>("brightness");
            Color        = new LifxColor(bulbData.Value <JToken>("color").ToString());
            Group        = new LifxGroup(bulbData.Value <JToken>("group").ToString(), manager);
            Location     = new LifxLocation(bulbData.Value <JToken>("location").ToString(), manager);
            ProductName  = bulbData.Value <string>("product_name");
            //Capabilities = new LifxCapability(bulbData.Value<JToken>("capabilities").ToString());
            LastSeen         = bulbData.Value <string>("last_seen");
            SecondsSinceSeen = bulbData.Value <double>("seconds_since_seen");
        }
Esempio n. 2
0
 public Task setColor(LifxColor color, int duration)
 {
     return(manager.setColor(color.getLifxColorString(), duration, getSelector()));
 }