emoncms / app

Emoncms App module: application specific dashboards: includes myelectric, mysolarpv, myheatpump and solar + wind app.
GNU Affero General Public License v3.0
28 stars 70 forks source link

My Solar PV Battery - Undefined object error when SOC field disabled #158

Open jernaug opened 3 years ago

jernaug commented 3 years ago

My Solar PV Battery - Undefined object error when SOC field disabled Reported by Neil Oakley

EmonCMS Error Message: TypeError: undefined is not an object (evaluating ‘feeds[config.app.battery_soc.value].value’) Route: app/view?name=My+Solar+Battery2 Line: 722 Column: 71

jernaug commented 3 years ago

I’m able to reproduce the issue by disabling the SOC feed too. The issue seems to be due to if (config.app.battery_soc.value) evaluating to true when battery_soc has been disabled in the settings page. For me this then disabled access to the settings view when subsequently trying to access the app.

I managed to get access back to the settings view by modifying line 381 in mysolarpvbattery.php to set the optional property to false instead of true. “battery_soc”:{“optional”:false, “type”:“feed”, “autoname”:“battery_soc”, “engine”:“5”, “description”:“Battery state of charge %”},

FredM67 commented 3 years ago

When one of the feed is disabled, then the graph is broken... Tried with "Wind"...