Deduped picker variable

This commit is contained in:
Philip Abbey
2025-10-29 15:14:30 +00:00
parent 35333f4d75
commit d1f6f6d9d2
2 changed files with 3 additions and 2 deletions

View File

@@ -177,11 +177,13 @@ class HomeAssistantNumericMenuItem extends HomeAssistantMenuItem {
//
function getNumericTemplate() as Lang.String? {
var entity_id = mData["entity_id"];
var attribute = (mPicker["attribute"] as Lang.String);
var attribute = mPicker["attribute"] as Lang.String;
if (entity_id == null) {
return null;
} else {
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() + "')}}";
} else {
return "{{state_attr('" + entity_id.toString() + "','" + attribute + "')}}";