public void GetStatesResponse(CommandResponseObject resp)
        {
            var result = resp.Result as JArray;

            if (result == null)
            {
                Log("GetStatesResponse: result was null");
                return;
            }

            foreach (var obj in result)
            {
                var state = obj.ToObject <StateObject>();
                EntityStateChanged?.Invoke(this, new DataEventArgs <StateObject>(state));
            }
        }
        private void OnHAEvent(EventObject ev)
        {
            StateObject state = null;

            try
            {
                state = ev.Event.Data.NewState;
            }
            catch (NullReferenceException)
            {
                // Will handle below
            }

            if (ev == null)
            {
                Log("OnHAEvent: some data was null");
            }
            else
            {
                EntityStateChanged?.Invoke(this, new DataEventArgs <StateObject>(state));
            }
        }