private void ThingsService_ValueRemoved(ValueNotificationEventArgs e) { if (ValueRemoved != null) { ValueRemoved(e); } }
private void ThingsService_ValueChanged(ValueNotificationEventArgs e) { _setValueWaitHandle.Set(); if (ValueChanged != null) { ValueChanged(e); } }
private void _things_ValueRemoved(ValueNotificationEventArgs e) { Activities.Add(new NodeActivity { OccuredOn = DateTime.Now, EventType = "Value Removed", NodeId = e.NodeId, Label = e.Label, Location = e.Location, Name = e.Name, Product = e.Product, Value = e.Value, ValueId = e.ValueId.ToString() }); }
private void _things_ValueChanged(ValueNotificationEventArgs e) { Activities.Add(new NodeActivity { OccuredOn = DateTime.Now, EventType = "Value Changed", Label = e.Label, Location = e.Location, Name = e.Name, NodeId = e.NodeId, Product = e.Product, Value = e.Value, ValueId = e.ValueId.ToString() }); /* if (_rulesJson == null) return; if (_rulesJson.Root == null) return; foreach (var rule in _rulesJson.SelectToken("rules.rule").Where(rule => rule.SelectToken("enabled").ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))) { var ifNode = rule.SelectToken("if"); var thenNode = rule.SelectToken("then"); var elseNode = rule.SelectToken("else"); if (ifNode == null || thenNode == null) continue; var conditions = ifNode.SelectToken("conditions"); if (conditions == null) continue; foreach (var condition in conditions) { var ifCondition = condition.SelectToken("condition"); var ifEquals = condition.SelectToken("equals"); if (ifCondition == null || (ifEquals == null && ifCondition.SelectToken("type").ToString() != "builtIn")) continue; switch (ifCondition.SelectToken("type").ToString()) { case "nodeValueId": { if (ifEquals == null) continue; var pair = ifCondition.SelectToken("text").ToString().Split(':'); if (pair.Length != 2) continue; int nodeId; ulong valueId; if (!int.TryParse(pair[0], out nodeId)) continue; if (!ulong.TryParse(pair[1], out valueId)) continue; if (nodeId == e.NodeId && valueId == e.ValueId) { Logger.Log(EntryType.Information, "Found rule"); if (ifEquals.SelectToken("text").ToString().ToLower() == e.Value.ToLower()) { var actions = GetActionsJson(thenNode); foreach (var action in actions) { Logger.Log(EntryType.Information, "Executing 'then' action"); action.Function(action.Parameters, null); } } else { if (elseNode == null) continue; var actions = GetActionsJson(elseNode); foreach (var action in actions) { Logger.Log(EntryType.Information, "Executing 'else' action"); action.Function(action.Parameters, null); } } } break; } } } } */ }
private void _zwave_ValueRemoved(ValueNotificationEventArgs e) { OnValueRemoved(e); }
protected void OnValueRemoved(ValueNotificationEventArgs e) { if (ValueRemoved != null) { ValueRemoved(e); } }