Vehicle: add autodetectdisabled feature (#30941)
This commit is contained in:
parent
95868686a0
commit
1056e85af2
6 changed files with 40 additions and 19 deletions
|
|
@ -4,17 +4,18 @@ type Feature int
|
||||||
|
|
||||||
//go:generate go tool enumer -type Feature -text
|
//go:generate go tool enumer -type Feature -text
|
||||||
const (
|
const (
|
||||||
_ Feature = iota
|
_ Feature = iota
|
||||||
CoarseCurrent // charger
|
CoarseCurrent // charger
|
||||||
IntegratedDevice // charger - always connected - no vehicle, no charging sessions
|
IntegratedDevice // charger - always connected - no vehicle, no charging sessions
|
||||||
SwitchDevice // charger - no current control - heat pumps or switch sockets
|
SwitchDevice // charger - no current control - heat pumps or switch sockets
|
||||||
Heating // charger - heating device - soc ist temperature (°C)
|
Heating // charger - heating device - soc ist temperature (°C)
|
||||||
Continuous // charger - heating device where disabled means "normal operation"
|
Continuous // charger - heating device where disabled means "normal operation"
|
||||||
Average // tariff
|
Average // tariff
|
||||||
Cacheable // tariff
|
Cacheable // tariff
|
||||||
Offline // vehicle
|
Offline // vehicle
|
||||||
Retryable // vehicle
|
Retryable // vehicle
|
||||||
Streaming // vehicle
|
Streaming // vehicle
|
||||||
WelcomeCharge // vehicle
|
WelcomeCharge // vehicle
|
||||||
ClimaterDisabled // vehicle - ignore climater state for charge control
|
ClimaterDisabled // vehicle - ignore climater state for charge control
|
||||||
|
AutodetectDisabled // vehicle - do not try to identify vehicle by status
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const _FeatureName = "CoarseCurrentIntegratedDeviceSwitchDeviceHeatingContinuousAverageCacheableOfflineRetryableStreamingWelcomeChargeClimaterDisabled"
|
const _FeatureName = "CoarseCurrentIntegratedDeviceSwitchDeviceHeatingContinuousAverageCacheableOfflineRetryableStreamingWelcomeChargeClimaterDisabledAutodetectDisabled"
|
||||||
|
|
||||||
var _FeatureIndex = [...]uint8{0, 13, 29, 41, 48, 58, 65, 74, 81, 90, 99, 112, 128}
|
var _FeatureIndex = [...]uint8{0, 13, 29, 41, 48, 58, 65, 74, 81, 90, 99, 112, 128, 146}
|
||||||
|
|
||||||
const _FeatureLowerName = "coarsecurrentintegrateddeviceswitchdeviceheatingcontinuousaveragecacheableofflineretryablestreamingwelcomechargeclimaterdisabled"
|
const _FeatureLowerName = "coarsecurrentintegrateddeviceswitchdeviceheatingcontinuousaveragecacheableofflineretryablestreamingwelcomechargeclimaterdisabledautodetectdisabled"
|
||||||
|
|
||||||
func (i Feature) String() string {
|
func (i Feature) String() string {
|
||||||
i -= 1
|
i -= 1
|
||||||
|
|
@ -37,9 +37,10 @@ func _FeatureNoOp() {
|
||||||
_ = x[Streaming-(10)]
|
_ = x[Streaming-(10)]
|
||||||
_ = x[WelcomeCharge-(11)]
|
_ = x[WelcomeCharge-(11)]
|
||||||
_ = x[ClimaterDisabled-(12)]
|
_ = x[ClimaterDisabled-(12)]
|
||||||
|
_ = x[AutodetectDisabled-(13)]
|
||||||
}
|
}
|
||||||
|
|
||||||
var _FeatureValues = []Feature{CoarseCurrent, IntegratedDevice, SwitchDevice, Heating, Continuous, Average, Cacheable, Offline, Retryable, Streaming, WelcomeCharge, ClimaterDisabled}
|
var _FeatureValues = []Feature{CoarseCurrent, IntegratedDevice, SwitchDevice, Heating, Continuous, Average, Cacheable, Offline, Retryable, Streaming, WelcomeCharge, ClimaterDisabled, AutodetectDisabled}
|
||||||
|
|
||||||
var _FeatureNameToValueMap = map[string]Feature{
|
var _FeatureNameToValueMap = map[string]Feature{
|
||||||
_FeatureName[0:13]: CoarseCurrent,
|
_FeatureName[0:13]: CoarseCurrent,
|
||||||
|
|
@ -66,6 +67,8 @@ var _FeatureNameToValueMap = map[string]Feature{
|
||||||
_FeatureLowerName[99:112]: WelcomeCharge,
|
_FeatureLowerName[99:112]: WelcomeCharge,
|
||||||
_FeatureName[112:128]: ClimaterDisabled,
|
_FeatureName[112:128]: ClimaterDisabled,
|
||||||
_FeatureLowerName[112:128]: ClimaterDisabled,
|
_FeatureLowerName[112:128]: ClimaterDisabled,
|
||||||
|
_FeatureName[128:146]: AutodetectDisabled,
|
||||||
|
_FeatureLowerName[128:146]: AutodetectDisabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
var _FeatureNames = []string{
|
var _FeatureNames = []string{
|
||||||
|
|
@ -81,6 +84,7 @@ var _FeatureNames = []string{
|
||||||
_FeatureName[90:99],
|
_FeatureName[90:99],
|
||||||
_FeatureName[99:112],
|
_FeatureName[99:112],
|
||||||
_FeatureName[112:128],
|
_FeatureName[112:128],
|
||||||
|
_FeatureName[128:146],
|
||||||
}
|
}
|
||||||
|
|
||||||
// FeatureString retrieves an enum value from the enum constants string name.
|
// FeatureString retrieves an enum value from the enum constants string name.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package coordinator
|
package coordinator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/evcc-io/evcc/api"
|
"github.com/evcc-io/evcc/api"
|
||||||
|
|
@ -116,7 +117,7 @@ func (c *Coordinator) availableDetectibleVehicles(owner loadpoint.API) []api.Veh
|
||||||
|
|
||||||
for _, vv := range c.vehicles {
|
for _, vv := range c.vehicles {
|
||||||
// status api available
|
// status api available
|
||||||
if api.HasCap[api.ChargeState](vv) {
|
if api.HasCap[api.ChargeState](vv) && !slices.Contains(vv.Features(), api.AutodetectDisabled) {
|
||||||
// available or associated to current loadpoint
|
// available or associated to current loadpoint
|
||||||
if o, ok := c.tracked[vv]; o == owner || !ok {
|
if o, ok := c.tracked[vv]; o == owner || !ok {
|
||||||
res = append(res, vv)
|
res = append(res, vv)
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ func TestVehicleDetectByStatus(t *testing.T) {
|
||||||
v2.MockVehicle.EXPECT().GetTitle().Return("v2").AnyTimes()
|
v2.MockVehicle.EXPECT().GetTitle().Return("v2").AnyTimes()
|
||||||
v1.MockVehicle.EXPECT().Identifiers().Return(nil).AnyTimes()
|
v1.MockVehicle.EXPECT().Identifiers().Return(nil).AnyTimes()
|
||||||
v2.MockVehicle.EXPECT().Identifiers().Return([]string{"it's me"}).AnyTimes()
|
v2.MockVehicle.EXPECT().Identifiers().Return([]string{"it's me"}).AnyTimes()
|
||||||
|
v1.MockVehicle.EXPECT().Features().Return(nil).AnyTimes()
|
||||||
|
v2.MockVehicle.EXPECT().Features().Return(nil).AnyTimes()
|
||||||
|
|
||||||
var lp loadpoint.API
|
var lp loadpoint.API
|
||||||
c := New(log, vehicles)
|
c := New(log, vehicles)
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,14 @@ params:
|
||||||
help:
|
help:
|
||||||
en: Ignore the vehicle's climater state for charge control, so charging stops at the SoC or energy limit even when the vehicle signals an active climater request.
|
en: Ignore the vehicle's climater state for charge control, so charging stops at the SoC or energy limit even when the vehicle signals an active climater request.
|
||||||
de: Klimatisierungsstatus des Fahrzeugs für die Ladesteuerung ignorieren, sodass der Ladevorgang am SoC- oder Energielimit endet, auch wenn das Fahrzeug einen aktiven Klimatisierungswunsch signalisiert.
|
de: Klimatisierungsstatus des Fahrzeugs für die Ladesteuerung ignorieren, sodass der Ladevorgang am SoC- oder Energielimit endet, auch wenn das Fahrzeug einen aktiven Klimatisierungswunsch signalisiert.
|
||||||
|
- name: autodetectdisabled
|
||||||
|
type: bool
|
||||||
|
description:
|
||||||
|
en: Exclude from auto detection
|
||||||
|
de: Von automatischer Erkennung ausschließen
|
||||||
|
help:
|
||||||
|
en: Ignore the vehicle for auto detection of connected vehicles
|
||||||
|
de: Das Fahrzeug von der automatischen Erkennung beim Anschließen eines Fahrzeugs ausschließen
|
||||||
- name: heating
|
- name: heating
|
||||||
type: bool
|
type: bool
|
||||||
description:
|
description:
|
||||||
|
|
@ -590,6 +598,8 @@ presets:
|
||||||
advanced: true
|
advanced: true
|
||||||
- name: climaterdisabled
|
- name: climaterdisabled
|
||||||
advanced: true
|
advanced: true
|
||||||
|
- name: autodetectdisabled
|
||||||
|
advanced: true
|
||||||
vehicle-climater:
|
vehicle-climater:
|
||||||
- name: climaterdisabled
|
- name: climaterdisabled
|
||||||
advanced: true
|
advanced: true
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{{ define "vehicle-features" }}
|
{{ define "vehicle-features" }}
|
||||||
{{- if or .basefeatures (eq .coarsecurrent "true") (eq .welcomecharge "true") (eq .streaming "true") (eq .climaterdisabled "true") }}
|
{{- if or .basefeatures (eq .coarsecurrent "true") (eq .welcomecharge "true") (eq .streaming "true") (eq .climaterdisabled "true") (eq .autodetectdisabled "true") }}
|
||||||
features:
|
features:
|
||||||
{{- range .basefeatures }}
|
{{- range .basefeatures }}
|
||||||
- {{ . }}
|
- {{ . }}
|
||||||
|
|
@ -16,5 +16,8 @@ features:
|
||||||
{{- if eq .climaterdisabled "true" }}
|
{{- if eq .climaterdisabled "true" }}
|
||||||
- climaterdisabled
|
- climaterdisabled
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if eq .autodetectdisabled "true" }}
|
||||||
|
- autodetectdisabled
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue