Relates to #248 old format support
This commit is contained in:
@ -453,11 +453,16 @@ class HomeAssistant {
|
|||||||
String tapAction = EntityTapAction.moreInfo;
|
String tapAction = EntityTapAction.moreInfo;
|
||||||
String holdAction = EntityTapAction.none;
|
String holdAction = EntityTapAction.none;
|
||||||
if (card.type == CardType.glance || card.type == CardType.entityButton) {
|
if (card.type == CardType.glance || card.type == CardType.entityButton) {
|
||||||
if (rawEntity["tap_action"] != null && !(rawEntity["tap_action"] is String)) {
|
if (rawEntity["tap_action"] != null) {
|
||||||
|
if (rawEntity["tap_action"] is String) {
|
||||||
|
tapAction = rawEntity["tap_action"];
|
||||||
|
holdAction = rawEntity["hold_action"];
|
||||||
|
} else {
|
||||||
tapAction = rawEntity["tap_action"]["action"];
|
tapAction = rawEntity["tap_action"]["action"];
|
||||||
holdAction = rawEntity["hold_action"]["action"];
|
holdAction = rawEntity["hold_action"]["action"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
card.entities.add(
|
card.entities.add(
|
||||||
EntityWrapper(
|
EntityWrapper(
|
||||||
entity: e,
|
entity: e,
|
||||||
@ -476,10 +481,15 @@ class HomeAssistant {
|
|||||||
var en = rawCard["entity"];
|
var en = rawCard["entity"];
|
||||||
String tapAction = EntityTapAction.moreInfo;
|
String tapAction = EntityTapAction.moreInfo;
|
||||||
String holdAction = EntityTapAction.none;
|
String holdAction = EntityTapAction.none;
|
||||||
if (rawCard["tap_action"] != null && !(rawCard["tap_action"] is String)) {
|
if (rawCard["tap_action"] != null) {
|
||||||
|
if (rawCard["tap_action"] is String) {
|
||||||
|
tapAction = rawCard["tap_action"];
|
||||||
|
holdAction = rawCard["hold_action"];
|
||||||
|
} else {
|
||||||
tapAction = rawCard["tap_action"]["action"];
|
tapAction = rawCard["tap_action"]["action"];
|
||||||
holdAction = rawCard["hold_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);
|
||||||
|
Reference in New Issue
Block a user