Skip to content

Commit

Permalink
error correction JSON parse ems-esp
Browse files Browse the repository at this point in the history
  • Loading branch information
tp1de committed Jul 8, 2023
1 parent 800a11d commit 8024aa6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ems.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ async function write_state(statename,value,def) {

let defj = {};
if (def != "" && def != "Invalid") {
try {defj = JSON.parse(def);} catch(e) {def = def.replace(".,", ",");}
/* 2nd try with corrected numeric values */
try {defj = JSON.parse(def);}
catch(e) {
adapter.log.warn("wrong ems-esp state definition: " + statename + " " + def);
Expand Down

0 comments on commit 8024aa6

Please sign in to comment.