Heating: basic support (#9393)
This commit is contained in:
parent
0a37348b08
commit
f41819ff15
10 changed files with 53 additions and 17 deletions
|
|
@ -16,4 +16,5 @@ const (
|
|||
Offline
|
||||
CoarseCurrent
|
||||
IntegratedDevice
|
||||
Heating
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
const _FeatureName = "OfflineCoarseCurrentIntegratedDevice"
|
||||
const _FeatureName = "OfflineCoarseCurrentIntegratedDeviceHeating"
|
||||
|
||||
var _FeatureIndex = [...]uint8{0, 7, 20, 36}
|
||||
var _FeatureIndex = [...]uint8{0, 7, 20, 36, 43}
|
||||
|
||||
const _FeatureLowerName = "offlinecoarsecurrentintegrateddevice"
|
||||
const _FeatureLowerName = "offlinecoarsecurrentintegrateddeviceheating"
|
||||
|
||||
func (i Feature) String() string {
|
||||
i -= 1
|
||||
|
|
@ -28,9 +28,10 @@ func _FeatureNoOp() {
|
|||
_ = x[Offline-(1)]
|
||||
_ = x[CoarseCurrent-(2)]
|
||||
_ = x[IntegratedDevice-(3)]
|
||||
_ = x[Heating-(4)]
|
||||
}
|
||||
|
||||
var _FeatureValues = []Feature{Offline, CoarseCurrent, IntegratedDevice}
|
||||
var _FeatureValues = []Feature{Offline, CoarseCurrent, IntegratedDevice, Heating}
|
||||
|
||||
var _FeatureNameToValueMap = map[string]Feature{
|
||||
_FeatureName[0:7]: Offline,
|
||||
|
|
@ -39,12 +40,15 @@ var _FeatureNameToValueMap = map[string]Feature{
|
|||
_FeatureLowerName[7:20]: CoarseCurrent,
|
||||
_FeatureName[20:36]: IntegratedDevice,
|
||||
_FeatureLowerName[20:36]: IntegratedDevice,
|
||||
_FeatureName[36:43]: Heating,
|
||||
_FeatureLowerName[36:43]: Heating,
|
||||
}
|
||||
|
||||
var _FeatureNames = []string{
|
||||
_FeatureName[0:7],
|
||||
_FeatureName[7:20],
|
||||
_FeatureName[20:36],
|
||||
_FeatureName[36:43],
|
||||
}
|
||||
|
||||
// FeatureString retrieves an enum value from the enum constants string name.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
:class="disabled ? 'opacity-25' : 'opacity-100'"
|
||||
data-testid="charging-plan"
|
||||
>
|
||||
<h3 class="value m-0 d-block d-sm-flex align-items-baseline justify-content-center">
|
||||
<h3 class="value m-0 d-block align-items-baseline justify-content-center">
|
||||
<button
|
||||
class="value-button p-0"
|
||||
:class="enabled ? 'evcc-default-text' : 'text-gray'"
|
||||
|
|
|
|||
|
|
@ -210,6 +210,7 @@ export default {
|
|||
|
||||
// charger
|
||||
chargerFeatureIntegratedDevice: Boolean,
|
||||
chargerFeatureHeating: Boolean,
|
||||
chargerIcon: String,
|
||||
|
||||
// vehicle
|
||||
|
|
@ -278,6 +279,9 @@ export default {
|
|||
integratedDevice: function () {
|
||||
return this.chargerFeatureIntegratedDevice;
|
||||
},
|
||||
heating: function () {
|
||||
return this.chargerFeatureHeating;
|
||||
},
|
||||
phasesProps: function () {
|
||||
return this.collectProps(Phases);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
<template>
|
||||
<LabelAndValue
|
||||
class="flex-grow-1"
|
||||
:label="$t('main.vehicle.targetSoc')"
|
||||
align="end"
|
||||
data-testid="target-soc"
|
||||
>
|
||||
<LabelAndValue class="flex-grow-1" :label="title" align="end" data-testid="target-soc">
|
||||
<h3 class="value m-0 d-block d-sm-flex align-items-baseline justify-content-end">
|
||||
<label class="position-relative">
|
||||
<select :value="targetSoc" class="custom-select" @change="change">
|
||||
|
|
@ -37,6 +32,7 @@ export default {
|
|||
props: {
|
||||
targetSoc: Number,
|
||||
rangePerSoc: Number,
|
||||
heating: Boolean,
|
||||
},
|
||||
emits: ["target-soc-updated"],
|
||||
|
||||
|
|
@ -53,6 +49,11 @@ export default {
|
|||
}
|
||||
return result;
|
||||
},
|
||||
title: function () {
|
||||
return this.heating
|
||||
? this.$t("main.vehicle.tempLimit")
|
||||
: this.$t("main.vehicle.targetSoc");
|
||||
},
|
||||
estimatedTargetRange: function () {
|
||||
return this.estimatedRange(this.targetSoc);
|
||||
},
|
||||
|
|
@ -68,7 +69,8 @@ export default {
|
|||
return null;
|
||||
},
|
||||
formatSoc: function (value) {
|
||||
return `${Math.round(value)}%`;
|
||||
// todo: add fahrenheit support
|
||||
return this.heating ? this.fmtNumber(value, 1, "celsius") : `${Math.round(value)}%`;
|
||||
},
|
||||
formatKm: function (value) {
|
||||
return `${this.fmtNumber(value, 0)} ${distanceUnit()}`;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
<LabelAndValue
|
||||
v-if="socBasedCharging"
|
||||
class="flex-grow-1"
|
||||
:label="$t('main.vehicle.vehicleSoc')"
|
||||
:value="vehicleSoc ? `${Math.round(vehicleSoc)}%` : '--'"
|
||||
:label="vehicleSocTitle"
|
||||
:value="formattedSoc"
|
||||
:extraValue="range ? `${fmtNumber(range, 0)} ${rangeUnit}` : null"
|
||||
align="start"
|
||||
/>
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
align="start"
|
||||
/>
|
||||
<ChargingPlan
|
||||
v-if="!heating"
|
||||
class="flex-grow-1 target-charge"
|
||||
v-bind="chargingPlan"
|
||||
:disabled="chargingPlanDisabled"
|
||||
|
|
@ -44,6 +45,7 @@
|
|||
class="flex-grow-1 text-end"
|
||||
:target-soc="displayTargetSoc"
|
||||
:range-per-soc="rangePerSoc"
|
||||
:heating="heating"
|
||||
@target-soc-updated="targetSocUpdated"
|
||||
/>
|
||||
<TargetEnergySelect
|
||||
|
|
@ -87,6 +89,7 @@ export default {
|
|||
id: [String, Number],
|
||||
connected: Boolean,
|
||||
integratedDevice: Boolean,
|
||||
heating: Boolean,
|
||||
vehiclePresent: Boolean,
|
||||
vehicleSoc: Number,
|
||||
vehicleTargetSoc: Number,
|
||||
|
|
@ -147,6 +150,22 @@ export default {
|
|||
chargingPlan: function () {
|
||||
return this.collectProps(ChargingPlan);
|
||||
},
|
||||
formattedSoc: function () {
|
||||
if (!this.vehicleSoc) {
|
||||
return "--";
|
||||
}
|
||||
if (this.heating) {
|
||||
// todo: add celsius/fahrenheit option to ui
|
||||
return this.fmtNumber(this.vehicleSoc, 1, "celsius");
|
||||
}
|
||||
return `${Math.round(this.vehicleSoc)}%`;
|
||||
},
|
||||
vehicleSocTitle: function () {
|
||||
if (this.heating) {
|
||||
return this.$t("main.vehicle.temp");
|
||||
}
|
||||
return this.$t("main.vehicle.vehicleSoc");
|
||||
},
|
||||
range: function () {
|
||||
return distanceValue(this.vehicleRange);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -51,9 +51,11 @@ export default {
|
|||
fmtKWh: function (watt, kw = true, withUnit = true, digits) {
|
||||
return this.fmtKw(watt, kw, withUnit, digits) + (withUnit ? "h" : "");
|
||||
},
|
||||
fmtNumber: function (number, decimals) {
|
||||
fmtNumber: function (number, decimals, unit) {
|
||||
const style = unit ? "unit" : "decimal";
|
||||
return new Intl.NumberFormat(this.$i18n.locale, {
|
||||
style: "decimal",
|
||||
style,
|
||||
unit,
|
||||
minimumFractionDigits: decimals,
|
||||
maximumFractionDigits: decimals,
|
||||
}).format(number);
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ func (lp *Loadpoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Even
|
|||
lp.publishTimer(guardTimer, 0, timerInactive)
|
||||
|
||||
// charger features
|
||||
for _, f := range []api.Feature{api.IntegratedDevice} {
|
||||
for _, f := range []api.Feature{api.IntegratedDevice, api.Heating} {
|
||||
lp.publishChargerFeature(f)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ fallbackName = "Fahrzeug"
|
|||
moreActions = "Weitere Aktionen"
|
||||
none = "Kein Fahrzeug"
|
||||
targetSoc = "Ladeziel"
|
||||
temp = "Temp."
|
||||
tempLimit = "Zieltemp."
|
||||
unknown = "Gastfahrzeug"
|
||||
vehicleSoc = "Ladestand"
|
||||
|
||||
|
|
|
|||
|
|
@ -232,6 +232,8 @@ fallbackName = "Vehicle"
|
|||
moreActions = "More actions"
|
||||
none = "No vehicle"
|
||||
targetSoc = "Limit"
|
||||
temp = "Temp."
|
||||
tempLimit = "Temp. limit"
|
||||
unknown = "Guest vehicle"
|
||||
vehicleSoc = "Charge"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue