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