Compare commits

...

3 Commits

Author SHA1 Message Date
Philip Abbey
3a7676f4bf Add Numeric Menu Item (#298)
Added a new numeric menu item to set numeric values e.g. for heating,
volume, dimmer etc.
2025-10-29 20:11:31 +00:00
thmichel
f19eb7c276 Fixed compiler warning for unreachable code 2025-10-29 19:18:06 +01:00
thmichel
c617d2cad6 Merge pull request #4 from house-of-abbey/Picker-formatter
Suggested code changes from philipabbey
2025-10-29 18:33:54 +01:00

View File

@@ -177,13 +177,11 @@ 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 + "')}}";