Skip to content

Commit

Permalink
Parse missing fields from SSE update events. (#1383)
Browse files Browse the repository at this point in the history
We previously didn't update icon, label color and value color via SSE.

Fixes #1380.

Signed-off-by: Danny Baumann <dannybaumann@web.de>
  • Loading branch information
maniac103 authored and mueller-ma committed May 31, 2019
1 parent 48b3b5e commit a6210b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mobile/src/main/java/org/openhab/habdroid/model/Widget.java
Expand Up @@ -319,12 +319,16 @@ public static Widget updateFromEvent(Widget source, JSONObject eventPayload,
Item item = Item.updateFromEvent(
source.item(), eventPayload.getJSONObject("item"));

String icon = eventPayload.optString("icon", source.icon());
String iconPath = determineOH2IconPath(item, source.type(),
source.icon(), iconFormat, !source.mappings().isEmpty());
icon, iconFormat, !source.mappings().isEmpty());
return source.toBuilder()
.label(eventPayload.optString("label", source.label()))
.state(determineWidgetState(eventPayload.optString("state", null), item))
.labelColor(eventPayload.optString("labelcolor", source.labelColor()))
.valueColor(eventPayload.optString("valuecolor", source.valueColor()))
.item(item)
.icon(icon)
.iconPath(iconPath)
.build();
}
Expand Down

0 comments on commit a6210b8

Please sign in to comment.