private async Task <bool> Command(Command command) { bool isSent = false; Log(String.Format("Incoming Command: {0}", command.Primary)); Log("Filtering"); var c = ApplyBehaviors(command); if (c == null) { Log(String.Format("Command Filtered to nothing")); return(true); } Log(String.Format("Sending command to interface: {0}", c.Primary.ToString())); try { if (_iface != null) { isSent = await _iface.Command(c); } else { Log("Command issued however no interface"); isSent = true; } } catch (System.Exception ex) { Log(ex); } _CommandReceived(c); return(isSent); }
public void CommandTests() { var result = _ha.Command(new Command() { Primary = CommandType.On }).Result; // We arent expecting a success or failure response so we need to wait for async // to catch up. Thread.Sleep(1000); Assert.AreEqual(CommandType.On.ToString(), _data); }