Ejemplo n.º 1
0
    public async Task CreateRuleTest()
    {
      Rule rule = new Rule()
      {
        Name = "test",
        Actions = new List<InternalBridgeCommand>() { 
          new InternalBridgeCommand() { Address = "/groups/0/action", Body = new SceneCommand() { Scene = "S3" }, Method = HttpMethod.Put } ,
          new InternalBridgeCommand() { Address = "/groups/1/action", Body = new LightCommand() { On = true }, Method = HttpMethod.Put } 
        },
        Conditions = new List<RuleCondition>() { new RuleCondition() { Address = "/sensors/2/state/buttonevent", Operator = RuleOperator.Equal, Value = "16" } }
      };

      var result = await _client.CreateRule(rule);

      Assert.IsNotNull(result);
    }
Ejemplo n.º 2
0
    public Task<string> CreateRule(Rule rule)
    {
      if(rule == null)
        throw new ArgumentNullException("rule");

      return CreateRule(rule.Name, rule.Conditions, rule.Actions);
    }
Ejemplo n.º 3
0
    public Task<HueResults> UpdateRule(Rule rule)
    {
      if (rule == null)
        throw new ArgumentNullException("rule");

      return UpdateRule(rule.Id, rule.Name, rule.Conditions, rule.Actions);
    }