Skip to content

Commit

Permalink
mysolarpv.php Add Solar Threshold to Edit options
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve R committed Mar 18, 2022
1 parent 836553d commit db14894
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/OpenEnergyMonitor/mysolarpv/mysolarpv.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function getTranslations(){
'Cumulative solar generation in kWh': "<?php echo _('Cumulative solar generation in kWh') ?>",
'Cumulative grid import in kWh': "<?php echo _('Cumulative grid import in kWh') ?>",
'Display power as kW': "<?php echo _('Display power as kW') ?>",
'Display solar power as 0 below this threshold in w': "<?php echo _('Display solar power as 0 below this threshold in w') ?>",
'PERFECT BALANCE': "<?php echo _('PERFECT BALANCE') ?>",
'EXPORTING': "<?php echo _('EXPORTING') ?>",
'IMPORTING': "<?php echo _('IMPORTING') ?>",
Expand Down Expand Up @@ -211,7 +212,8 @@ function getTranslations(){
"use_kwh":{"optional":true, "type":"feed", "autoname":"use_kwh", "description":_("Cumulative use in kWh")},
"solar_kwh":{"optional":true, "type":"feed", "autoname":"solar_kwh", "description":_("Cumulative solar generation in kWh")},
"import_kwh":{"optional":true, "type":"feed", "autoname":"import_kwh", "description":_("Cumulative grid import in kWh")},
"kw":{"type":"checkbox", "default":0, "name": "Show kW", "description":_("Display power as kW")}
"kw":{"type":"checkbox", "default":0, "name": "Show kW", "description":_("Display power as kW")},
"solar_disp_min":{"type":"value", "default":10, "name": "Solar Threshold", "description":_("Display solar power as 0 below this threshold in w")}
//"import_unitcost":{"type":"value", "default":0.1508, "name": "Import unit cost", "description":"Unit cost of imported grid electricity"}
};
config.name = "<?php echo $name; ?>";
Expand Down Expand Up @@ -434,7 +436,7 @@ function livefn()
view.start = now - live_timerange;
}
// Lower limit for solar
if (solar_now<10) solar_now = 0;
if (solar_now<config.app.solar_disp_min.value) solar_now = 0;

var balance = solar_now - use_now;
if (balance==0) {
Expand Down Expand Up @@ -537,7 +539,7 @@ function draw_powergraph() {
// -------------------------------------------------------------------------------------------------------
// Supply / demand balance calculation
// -------------------------------------------------------------------------------------------------------
if (solar_now<10) solar_now = 0;
if (solar_now<config.app.solar_disp_min.value) solar_now = 0;
var balance = solar_now - use_now;

if (balance>=0) total_use_direct_kwh += (use_now*interval)/(1000*3600);
Expand Down

0 comments on commit db14894

Please sign in to comment.