diff --git a/src/views/VehicleConfig.vue b/src/views/VehicleConfig.vue
index b4d49b88..851369a4 100644
--- a/src/views/VehicleConfig.vue
+++ b/src/views/VehicleConfig.vue
@@ -107,17 +107,17 @@
-
+
-
+
Das Standard-Fahrzeug kann nicht umbenannt
werden.
@@ -150,12 +150,16 @@
:options="evTemplateList"
:model-value="
$store.state.mqtt[
- 'openWB/vehicle/' + id + '/ev_template'
+ 'openWB/vehicle/' +
+ vehicleId +
+ '/ev_template'
]
"
@update:model-value="
updateState(
- 'openWB/vehicle/' + id + '/ev_template',
+ 'openWB/vehicle/' +
+ vehicleId +
+ '/ev_template',
$event
)
"
@@ -165,12 +169,16 @@
:options="chargeTemplateList"
:model-value="
$store.state.mqtt[
- 'openWB/vehicle/' + id + '/charge_template'
+ 'openWB/vehicle/' +
+ vehicleId +
+ '/charge_template'
]
"
@update:model-value="
updateState(
- 'openWB/vehicle/' + id + '/charge_template',
+ 'openWB/vehicle/' +
+ vehicleId +
+ '/charge_template',
$event
)
"
@@ -180,12 +188,12 @@
title="Zugeordnete Tags"
:model-value="
$store.state.mqtt[
- 'openWB/vehicle/' + id + '/tag_id'
+ 'openWB/vehicle/' + vehicleId + '/tag_id'
]
"
@update:model-value="
updateState(
- 'openWB/vehicle/' + id + '/tag_id',
+ 'openWB/vehicle/' + vehicleId + '/tag_id',
$event
)
"
@@ -194,22 +202,16 @@
@@ -221,15 +223,15 @@
v-if="
$store.state.mqtt[
'openWB/vehicle/' +
- id +
+ vehicleId +
'/soc_module/config'
].type
"
- :deviceId="id"
+ :deviceId="vehicleId"
:deviceType="
$store.state.mqtt[
'openWB/vehicle/' +
- id +
+ vehicleId +
'/soc_module/config'
].type
"
@@ -237,14 +239,14 @@
:configuration="
$store.state.mqtt[
'openWB/vehicle/' +
- id +
+ vehicleId +
'/soc_module/config'
].configuration
"
@update:configuration="
updateConfiguration(
'openWB/vehicle/' +
- id +
+ vehicleId +
'/soc_module/config',
$event
)
@@ -1504,6 +1506,13 @@ export default {
return myList;
},
},
+ socModuleList: {
+ get() {
+ return this.$store.state.mqtt[
+ "openWB/system/configurable/soc_modules"
+ ];
+ },
+ },
},
methods: {
getChargeTemplateScheduledChargingPlans(chargeTemplate) {
@@ -1558,10 +1567,30 @@ export default {
? this.$store.state.mqtt["openWB/vehicle/" + id + "/name"]
: "Fahrzeug " + id;
},
- getSocModuleList() {
- return this.$store.state.mqtt[
- "openWB/system/configurable/soc_modules"
- ];
+ getSocDefaultConfiguration(socType) {
+ const socDefaults = this.socModuleList.find(
+ (element) => element.value == socType
+ );
+ if (Object.prototype.hasOwnProperty.call(socDefaults, "defaults")) {
+ return { ...socDefaults.defaults.configuration };
+ }
+ console.warn(
+ "no default configuration found for soc type!",
+ socType
+ );
+ return {};
+ },
+ updateSelectedSocModule(vehicleId, $event) {
+ this.updateState(
+ "openWB/vehicle/" + vehicleId + "/soc_module/config",
+ $event,
+ "type"
+ );
+ this.updateState(
+ "openWB/vehicle/" + vehicleId + "/soc_module/config",
+ this.getSocDefaultConfiguration($event),
+ "configuration"
+ );
},
updateConfiguration(key, event) {
console.debug("updateConfiguration", key, event);