public async Task <bool> SetState(NodeDeviceCommands command, object value) { try { var data = new { nodeId = command.NodeId, commandClass = command.ClassId, instance = command.Instance, index = command.Index, value = value }; Console.WriteLine($"Sending: {data.ToJson ()}"); var s = await Post(data); return(true); } catch (Exception ex) { Console.WriteLine(ex); } return(false); }
public static object GetValue(this NodeDeviceCommands command, DeviceUpdate update) { if (command.SimpleStringCommand == "38 - 0") { if (update.DataType == DataTypes.Bool) { return(update.BoolValue.Value ? 99 : 0); } if (update.DataType == DataTypes.Decimal) { return(Clamp((int)update.DecimalValue.Value, 0, 99)); } if (update.DataType == DataTypes.Int) { return(Clamp(update.IntValue.Value, 0, 99)); } } return(update.Value); }