public static OperationMessage PercentageDimmer(this Dimmable dimmable, float percentage, byte seconds = 0) { byte value = (byte)(percentage * 100); ushort destinationAddress = (ushort)(dimmable.Connector == null ? 0 : dimmable.Connector.Node.Address); return(OperationMessage.DimmerWrite((ushort)dimmable.Id, value, seconds, destinationAddress)); }
private async void button3_Click(object sender, EventArgs e) { var userMod = CommunicationManager.Instance.FindModule <UserModule>(); Debug.WriteLine("Dimmer at " + dimmerValue); await userMod.SendMessage(OperationMessage.DimmerWrite(1, dimmerValue, 0, 0x02)); dimmerValue = (byte)((dimmerValue + 10) % 130); }