public void OnCommandTests() { _ha.OnCommand(source: null, callback: _OnCommandData); Thread.Sleep(1000); _ha._DataReceived("on"); Thread.Sleep(2000); //Thread.Sleep(200000); Assert.AreEqual("on", _data.ToLower()); }
public StateDevice(string address = null, HAInterface iface = null, List <StateDevice> devices = null, List <BehaviorBase> behaviors = null) { _iface = iface; Address = address; _commandDelegates = new List <Action <Command> >(); _stateDelegates = new List <Action <State> >(); _behaviors = new List <BehaviorBase>(); _state = new State() { Primary = StateType.Unknown }; _Initialize(); RegisterDevices(devices); RegisterBehaviors(behaviors); if (_iface != null) { _iface.OnCommand(source: Address, action: _CommandReceived); } }