mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-12-16 02:58:15 +00:00
Deduped picker variable
This commit is contained in:
@@ -177,11 +177,13 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
|
|||||||
//
|
//
|
||||||
function getNumericTemplate() as Lang.String? {
|
function getNumericTemplate() as Lang.String? {
|
||||||
var entity_id = mData["entity_id"];
|
var entity_id = mData["entity_id"];
|
||||||
var attribute = (mPicker["attribute"] as Lang.String);
|
var attribute = mPicker["attribute"] as Lang.String;
|
||||||
if (entity_id == null) {
|
if (entity_id == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
if (attribute == null) {
|
if (attribute == null) {
|
||||||
|
// Compiler says: "Statement is not reachable."
|
||||||
|
// This is wrong because a break point on the following line proves it is executed!
|
||||||
return "{{states('" + entity_id.toString() + "')}}";
|
return "{{states('" + entity_id.toString() + "')}}";
|
||||||
} else {
|
} else {
|
||||||
return "{{state_attr('" + entity_id.toString() + "','" + attribute + "')}}";
|
return "{{state_attr('" + entity_id.toString() + "','" + attribute + "')}}";
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class HomeAssistantView extends WatchUi.Menu2 {
|
|||||||
var content = items[i].get("content") as Lang.String?;
|
var content = items[i].get("content") as Lang.String?;
|
||||||
var entity = items[i].get("entity") as Lang.String?;
|
var entity = items[i].get("entity") as Lang.String?;
|
||||||
var tap_action = items[i].get("tap_action") as Lang.Dictionary?;
|
var tap_action = items[i].get("tap_action") as Lang.Dictionary?;
|
||||||
var picker = items[i].get("picker") as Lang.Dictionary?; // optional for numeric items
|
|
||||||
var service = items[i].get("service") as Lang.String?; // Deprecated schema
|
var service = items[i].get("service") as Lang.String?; // Deprecated schema
|
||||||
var confirm = false as Lang.Boolean?;
|
var confirm = false as Lang.Boolean?;
|
||||||
var pin = false as Lang.Boolean?;
|
var pin = false as Lang.Boolean?;
|
||||||
|
|||||||
Reference in New Issue
Block a user