diff --git a/lib/data_model.dart b/lib/data_model.dart index 5bd5820..fcfdca2 100644 --- a/lib/data_model.dart +++ b/lib/data_model.dart @@ -30,6 +30,8 @@ class HassioDataModel { } else { _fetchingTimer = new Timer(new Duration(seconds: 10), () { _fetchCompleter.completeError({"message": "Data fetching timeout."}); + _hassioChannel.sink.close(); + _hassioChannel = null; }); _fetchCompleter = new Completer(); _reConnectSocket().then((r) { @@ -139,7 +141,7 @@ class HassioDataModel { debugPrint(" $message"); _hassioChannel.sink.add(message); }).catchError((e){ - debugPrint("Unable to connect for sending =("); + debugPrint("Unable to connect for sending: $e"); }); } diff --git a/lib/main.dart b/lib/main.dart index 39af8cc..d336e0f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -279,7 +279,7 @@ class _MainPageState extends State { title: _buildTitle() ), drawer: _buildAppDrawer(), - body: Text(_dataModelErrorMessage != null ? "Well... no. There was an error: $_dataModelErrorMessage" : "Loading... or not..."), + body: Text(_dataModelErrorMessage != null ? "Well... no.\n\nThere was an error:\n$_dataModelErrorMessage" : "Loading... or not...\n\nJust wait 10 seconds"), floatingActionButton: new FloatingActionButton( onPressed: _refreshData, tooltip: 'Increment',