public void SetColor(TrustColorRgb color)
        {
            var value   = new TrustXyValue(color.ToXyz().ToYxy());
            var result  = value.ToValue();
            var command = TrustCommand.SimpleCommand(Home.Mac, Home.AesKey, Convert.ToInt32(Id), 5, result);

            TrustHttp.SendCommand(Home.Mac, Hub.Email, Hub.Password, command);
        }
Example #2
0
        public TrustHub(string macAddress, string email, string password)
        {
            MacAddress = macAddress;
            Email      = email;
            Password   = password;
            var baseTrustDevices = TrustHttp.GetHubDevices(MacAddress, Email, Password);
            var devices          = baseTrustDevices.Select(baseTrustDevice => new TrustDevice(this, baseTrustDevice)).ToList();

            Devices = devices.ToArray();
            User    = new TrustUser(this, TrustHttp.LoginUser(MacAddress, Email, Password));

            // get groups
            Groups = Devices
                     .Where(d => d.Data.group != null)
                     .Select(d => new TrustDeviceGroup(this, d.Data.group, d.Base))
                     .ToArray();
        }
Example #3
0
 public static TrustHub GetHub(string macAddress, string email, string password)
 {
     return(TrustHttp.GetHub(macAddress, email, password));
 }
        public void TurnOff()
        {
            var command = TrustCommand.SimpleCommand(Home.Mac, Home.AesKey, Convert.ToInt32(Id), 3, 0);

            TrustHttp.SendCommand(Home.Mac, Hub.Email, Hub.Password, command);
        }