Skip to content
Snippets Groups Projects
Commit a6210b83 authored by maniac103's avatar maniac103 Committed by mueller-ma
Browse files

Parse missing fields from SSE update events. (#1383)


We previously didn't update icon, label color and value color via SSE.

Fixes #1380.

Signed-off-by: default avatarDanny Baumann <dannybaumann@web.de>
parent 48b3b5e7
No related branches found
No related tags found
No related merge requests found
...@@ -319,12 +319,16 @@ public abstract class Widget implements Parcelable { ...@@ -319,12 +319,16 @@ public abstract class Widget implements Parcelable {
Item item = Item.updateFromEvent( Item item = Item.updateFromEvent(
source.item(), eventPayload.getJSONObject("item")); source.item(), eventPayload.getJSONObject("item"));
String icon = eventPayload.optString("icon", source.icon());
String iconPath = determineOH2IconPath(item, source.type(), String iconPath = determineOH2IconPath(item, source.type(),
source.icon(), iconFormat, !source.mappings().isEmpty()); icon, iconFormat, !source.mappings().isEmpty());
return source.toBuilder() return source.toBuilder()
.label(eventPayload.optString("label", source.label())) .label(eventPayload.optString("label", source.label()))
.state(determineWidgetState(eventPayload.optString("state", null), item)) .state(determineWidgetState(eventPayload.optString("state", null), item))
.labelColor(eventPayload.optString("labelcolor", source.labelColor()))
.valueColor(eventPayload.optString("valuecolor", source.valueColor()))
.item(item) .item(item)
.icon(icon)
.iconPath(iconPath) .iconPath(iconPath)
.build(); .build();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment