Skip to content

Commit

Permalink
add/remove loadpoint, quickfix init errors
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis committed Jul 10, 2024
1 parent 05d7085 commit ee0331d
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 158 deletions.
2 changes: 0 additions & 2 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "bootstrap/dist/css/bootstrap.min.css";
import "../css/app.css";
import { createApp, h } from "vue";
import { VueHeadMixin, createHead } from "@unhead/vue";
import PrimeVue from "primevue/config";
import App from "./views/App.vue";
import setupRouter from "./router";
import setupI18n from "./i18n";
Expand Down Expand Up @@ -71,7 +70,6 @@ app.use(i18n);
app.use(setupRouter(i18n));
app.use(featureflags);
app.use(head);
app.use(PrimeVue, { unstyled: true });
app.mixin(VueHeadMixin);
window.app = app.mount("#app");

Expand Down
123 changes: 0 additions & 123 deletions assets/js/components/Config/CurrentRange.vue

This file was deleted.

6 changes: 3 additions & 3 deletions assets/js/components/Config/LoadpointModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@
id="loadpointParamVehicle"
label="Default vehicle"
:help="
values.defaultVehicle
values.vehicle
? 'Always assume this vehicle is charging here. Auto-detection disabled. Manual override is possible.'
: 'Automatically selects the most plausible vehicle. Manual override is possible.'
"
>
<PropertyField
id="loadpointParamVehicle"
v-model="values.defaultVehicle"
v-model="values.vehicle"
type="String"
class="me-2"
:valid-values="allVehicleOptions"
Expand Down Expand Up @@ -392,7 +392,7 @@ const defaultValues = {
poll: { mode: "pollcharging", interval: 60 },
estimate: false,
},
defaultVehicle: "",
vehicle: "",
charger: "",
meter: "",
};
Expand Down
4 changes: 2 additions & 2 deletions assets/js/views/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
<ul class="p-0 config-list">
<DeviceCard
v-for="loadpoint in loadpoints"
:key="!!loadpoint.name"
:key="loadpoint.name"
:name="loadpoint.title"
:editable="true"
:editable="!!loadpoint.id"
data-testid="loadpoint"
@edit="editLoadpoint(loadpoint.id)"
>
Expand Down
6 changes: 3 additions & 3 deletions cmd/demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,6 @@ tariffs:
feedin:
type: fixed
price: 0.08 # EUR/kWh
#co2:
# type: grünstromindex
# zip: 12349
co2:
type: grünstromindex
zip: 12349
6 changes: 5 additions & 1 deletion cmd/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ CONTINUE:
hasRoot = true
}

if slices.ContainsFunc(loadpoints, func(lp *core.Loadpoint) bool {
if slices.ContainsFunc(loadpoints, func(lp *core.Loadpoint) bool {
return lp.GetCircuit() == instance
}) {
continue CONTINUE
Expand Down Expand Up @@ -1010,6 +1010,10 @@ func configureLoadpoints(conf globalconfig.All) error {
log := util.NewLoggerWithLoadpoint(name, id+1)
settings := &core.Settings{Key: "lp" + cc.Name + "."}

// TODO: proper handling of id/name
delete(cc.Other, "id")
delete(cc.Other, "name")

instance, err := core.NewLoadpointFromConfig(log, settings, cc.Other)
if err != nil {
return fmt.Errorf("failed configuring loadpoint: %w", err)
Expand Down
12 changes: 0 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"markty-toml": "^0.1.1",
"prettier": "^3.0.0",
"prettier-plugin-toml": "^2.0.1",
"primevue": "^4.0.0-beta.4",
"rollup-plugin-visualizer": "^5.8.3",
"smoothscroll-polyfill": "^0.4.4",
"typescript": "^5.2.2",
Expand All @@ -68,4 +67,4 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.7.1"
}
}
}
21 changes: 11 additions & 10 deletions server/http_config_loadpoint_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@ import (

type loadpointStaticConfig struct {
// static config
Charger *string `json:"charger,omitempty"`
Meter *string `json:"meter,omitempty"`
Circuit *string `json:"circuit,omitempty"`
Vehicle *string `json:"vehicle,omitempty"`
Title string `json:"title"`
Charger string `json:"charger,omitempty"`
Meter string `json:"meter,omitempty"`
Circuit string `json:"circuit,omitempty"`
Vehicle string `json:"vehicle,omitempty"`
}

func getLoadpointStaticConfig(lp loadpoint.API) loadpointStaticConfig {
return loadpointStaticConfig{
Charger: util.PtrTo(lp.GetChargerName()),
Meter: util.PtrTo(lp.GetMeterName()),
Circuit: util.PtrTo(lp.GetCircuitName()),
Vehicle: util.PtrTo(lp.GetDefaultVehicle()),
Title: lp.GetTitle(),
Charger: lp.GetChargerName(),
Meter: lp.GetMeterName(),
Circuit: lp.GetCircuitName(),
Vehicle: lp.GetDefaultVehicle(),
}
}

type loadpointDynamicConfig struct {
// dynamic config
Title string `json:"title"`
Mode string `json:"mode"`
Priority int `json:"priority"`
Phases int `json:"phases"`
Expand All @@ -50,6 +49,7 @@ type loadpointDynamicConfig struct {

func getLoadpointDynamicConfig(lp loadpoint.API) loadpointDynamicConfig {
return loadpointDynamicConfig{
Title: lp.GetTitle(),
Mode: string(lp.GetMode()),
Priority: lp.GetPriority(),
Phases: lp.GetPhases(),
Expand All @@ -62,6 +62,7 @@ func getLoadpointDynamicConfig(lp loadpoint.API) loadpointDynamicConfig {
}

func loadpointUpdateDynamicConfig(payload loadpointDynamicConfig, lp loadpoint.API) error {
lp.SetTitle(payload.Title)
lp.SetPriority(payload.Priority)
lp.SetSmartCostLimit(payload.SmartCostLimit)
lp.SetThresholds(payload.Thresholds)
Expand Down

0 comments on commit ee0331d

Please sign in to comment.