Resolves #494
This commit is contained in:
		| @@ -63,10 +63,6 @@ class HomeAssistant { | ||||
|     futures.add(_getServices()); | ||||
|     futures.add(_getUserInfo()); | ||||
|     futures.add(_getPanels()); | ||||
|     futures.add(ConnectionManager().sendSocketMessage( | ||||
|       type: "subscribe_events", | ||||
|       additionalData: {"event_type": "state_changed"}, | ||||
|     )); | ||||
|     Future.wait(futures).then((_) { | ||||
|       if (isMobileAppEnabled) { | ||||
|         if (!childMode) _createUI(); | ||||
|   | ||||
| @@ -148,11 +148,17 @@ class ConnectionManager { | ||||
|                   }); | ||||
|                 } else if (data["type"] == "auth_ok") { | ||||
|                   Logger.d("[Received] <== ${data.toString()}"); | ||||
|                   Logger.d("[Connection] Subscribing to events"); | ||||
|                   sendSocketMessage( | ||||
|                     type: "subscribe_events", | ||||
|                     additionalData: {"event_type": "state_changed"}, | ||||
|                   ).whenComplete((){ | ||||
|                     _messageResolver["auth"]?.complete(); | ||||
|                     _messageResolver.remove("auth"); | ||||
|                     if (_token != null) { | ||||
|                       if (!connecting.isCompleted) connecting.complete(); | ||||
|                     } | ||||
|                   }); | ||||
|                 } else if (data["type"] == "auth_invalid") { | ||||
|                   Logger.d("[Received] <== ${data.toString()}"); | ||||
|                   _messageResolver["auth"]?.completeError(HAError("${data["message"]}", actions: [HAErrorAction.loginAgain()])); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user