WIP #120 History widget improvements

This commit is contained in:
Yegor Vialov
2018-10-28 18:07:52 +02:00
parent 6e038b0685
commit e16338c3f2
8 changed files with 320 additions and 229 deletions

View File

@ -477,7 +477,6 @@ class HomeAssistant {
DateTime now = DateTime.now();
//String endTime = formatDate(now, [yyyy, '-', mm, '-', dd, 'T', HH, ':', nn, ':', ss, z]);
String startTime = formatDate(now.subtract(Duration(hours: 24)), [yyyy, '-', mm, '-', dd, 'T', HH, ':', nn, ':', ss, z]);
TheLogger.debug( "$startTime");
String url = "$homeAssistantWebHost/api/history/period/$startTime?&filter_entity_id=$entityId";
TheLogger.debug( "$url");
http.Response historyResponse;
@ -494,7 +493,7 @@ class HomeAssistant {
}
var history = json.decode(historyResponse.body);
if (history is List) {
TheLogger.debug( "${history.toString()}");
TheLogger.debug( "Got ${history.first.length} history recors");
return history;
} else {
return [];