ha: log trigger errors and default after error

pull/3375/head
Rob Pilling 2024-04-21 19:29:27 +01:00
parent 3c2e6725fa
commit e2a62eabca
1 changed files with 5 additions and 3 deletions

View File

@ -33,15 +33,17 @@ function _getIcon(trigger){
}
exports.getTriggers = function(){
var triggers = [
{display: "Empty", trigger: "NOP", icon: "ha"},
];
var triggers;
try{
triggers = require("Storage").read("ha.trigger.json");
triggers = JSON.parse(triggers);
} catch(e) {
// In case there are no user triggers yet, we show the default...
console.log("ha: error loading triggers:", e);
triggers = [
{display: "Empty", trigger: "NOP", icon: "ha"},
];
}
// We lazy load all icons, otherwise, we have to keep