Resolves #248 tap_action parsing fix
This commit is contained in:
@ -450,14 +450,13 @@ class HomeAssistant {
|
|||||||
} else {
|
} else {
|
||||||
if (entities.isExist(rawEntity["entity"])) {
|
if (entities.isExist(rawEntity["entity"])) {
|
||||||
Entity e = entities.get(rawEntity["entity"]);
|
Entity e = entities.get(rawEntity["entity"]);
|
||||||
String tapAction;
|
String tapAction = EntityTapAction.moreInfo;
|
||||||
String holdAction;
|
String holdAction = EntityTapAction.none;
|
||||||
if (card.type == CardType.glance || card.type == CardType.entityButton) {
|
if (card.type == CardType.glance || card.type == CardType.entityButton) {
|
||||||
tapAction = rawEntity["tap_action"] ?? EntityTapAction.moreInfo;
|
if (rawEntity["tap_action"] != null && !(rawEntity["tap_action"] is String)) {
|
||||||
holdAction = rawEntity["hold_action"] ?? EntityTapAction.none;
|
tapAction = rawEntity["tap_action"]["action"];
|
||||||
} else {
|
holdAction = rawEntity["hold_action"]["action"];
|
||||||
tapAction = EntityTapAction.moreInfo;
|
}
|
||||||
holdAction = EntityTapAction.none;
|
|
||||||
}
|
}
|
||||||
card.entities.add(
|
card.entities.add(
|
||||||
EntityWrapper(
|
EntityWrapper(
|
||||||
@ -466,8 +465,8 @@ class HomeAssistant {
|
|||||||
icon: rawEntity["icon"],
|
icon: rawEntity["icon"],
|
||||||
tapAction: tapAction,
|
tapAction: tapAction,
|
||||||
holdAction: holdAction,
|
holdAction: holdAction,
|
||||||
tapActionService: rawEntity["service"],
|
//tapActionService: rawEntity["service"],
|
||||||
tapActionServiceData: rawEntity["service_data"] ?? {"entity_id": e.entityId}
|
//tapActionServiceData: rawEntity["service_data"] ?? {"entity_id": e.entityId}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -475,8 +474,12 @@ class HomeAssistant {
|
|||||||
});
|
});
|
||||||
if (rawCard["entity"] != null) {
|
if (rawCard["entity"] != null) {
|
||||||
var en = rawCard["entity"];
|
var en = rawCard["entity"];
|
||||||
String tapAction = rawCard["tap_action"] ?? EntityTapAction.moreInfo;
|
String tapAction = EntityTapAction.moreInfo;
|
||||||
String holdAction = rawCard["hold_action"] ?? EntityTapAction.none;
|
String holdAction = EntityTapAction.none;
|
||||||
|
if (rawCard["tap_action"] != null && !(rawCard["tap_action"] is String)) {
|
||||||
|
tapAction = rawCard["tap_action"]["action"];
|
||||||
|
holdAction = rawCard["hold_action"]["action"];
|
||||||
|
}
|
||||||
if (en is String) {
|
if (en is String) {
|
||||||
if (entities.isExist(en)) {
|
if (entities.isExist(en)) {
|
||||||
Entity e = entities.get(en);
|
Entity e = entities.get(en);
|
||||||
@ -484,8 +487,8 @@ class HomeAssistant {
|
|||||||
entity: e,
|
entity: e,
|
||||||
tapAction: tapAction,
|
tapAction: tapAction,
|
||||||
holdAction: holdAction,
|
holdAction: holdAction,
|
||||||
tapActionService: rawCard["service"],
|
//tapActionService: rawCard["service"],
|
||||||
tapActionServiceData: rawCard["service_data"] ?? {"entity_id": e.entityId}
|
//tapActionServiceData: rawCard["service_data"] ?? {"entity_id": e.entityId}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user