More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 24s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 24s
This commit is contained in:
46
vehicle.go
46
vehicle.go
@ -628,7 +628,7 @@ func (v *Vehicle) GetVehicleStatus() {
|
|||||||
|
|
||||||
// for i := 0; i < val.NumField(); i++ {
|
// for i := 0; i < val.NumField(); i++ {
|
||||||
for i := range val.NumField() {
|
for i := range val.NumField() {
|
||||||
v.client.logger.Debug("vehicle status >> parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
// v.client.logger.Debug("vehicle status >> parsing a car part", "field", typeOfS.Field(i).Name, "value", val.Field(i).Interface(), "type", val.Field(i).Type())
|
||||||
if slices.Contains(badValues, val.Field(i).Interface()) {
|
if slices.Contains(badValues, val.Field(i).Interface()) {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
@ -796,12 +796,11 @@ func (v *Vehicle) parseDoor(prefix, suffix, name string, value any) {
|
|||||||
submatchall := re.FindAllString(pos, -1)
|
submatchall := re.FindAllString(pos, -1)
|
||||||
// v.client.logger.Debug("VEHICLE COND", "key", name, "value", value, "number", len(submatchall))
|
// v.client.logger.Debug("VEHICLE COND", "key", name, "value", value, "number", len(submatchall))
|
||||||
|
|
||||||
if door, ok := v.Doors[pos]; ok {
|
if d, ok := v.Doors[pos]; ok {
|
||||||
door.Status = value.(string)
|
d.Status = value.(string)
|
||||||
door.Updated = time.Now()
|
d.Updated = time.Now()
|
||||||
|
v.Doors[pos] = d
|
||||||
} else {
|
} else {
|
||||||
door.Status = value.(string)
|
|
||||||
door.Updated = time.Now()
|
|
||||||
v.Doors[pos] = Door{
|
v.Doors[pos] = Door{
|
||||||
Position: submatchall[0],
|
Position: submatchall[0],
|
||||||
Status: value.(string),
|
Status: value.(string),
|
||||||
@ -824,11 +823,11 @@ func (v *Vehicle) parseLock(prefix, suffix, name string, value any) {
|
|||||||
submatchall := re.FindAllString(pos, -1)
|
submatchall := re.FindAllString(pos, -1)
|
||||||
v.client.logger.Debug("door lock status", "key", name, "value", value, "number", len(submatchall))
|
v.client.logger.Debug("door lock status", "key", name, "value", value, "number", len(submatchall))
|
||||||
|
|
||||||
if door, ok := v.Doors[pos]; ok {
|
if d, ok := v.Doors[pos]; ok {
|
||||||
door.Lock = value.(string)
|
d.Lock = value.(string)
|
||||||
|
d.Updated = time.Now()
|
||||||
|
v.Doors[pos] = d
|
||||||
} else {
|
} else {
|
||||||
door.Lock = value.(string)
|
|
||||||
door.Updated = time.Now()
|
|
||||||
v.Doors[pos] = Door{
|
v.Doors[pos] = Door{
|
||||||
Position: submatchall[0],
|
Position: submatchall[0],
|
||||||
Lock: value.(string),
|
Lock: value.(string),
|
||||||
@ -851,12 +850,11 @@ func (v *Vehicle) parseWindow(prefix, suffix, name string, value any) {
|
|||||||
submatchall := re.FindAllString(pos, -1)
|
submatchall := re.FindAllString(pos, -1)
|
||||||
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
||||||
|
|
||||||
if window, ok := v.Windows[pos]; ok {
|
if w, ok := v.Windows[pos]; ok {
|
||||||
window.Status = value.(string)
|
w.Status = value.(string)
|
||||||
window.Updated = time.Now()
|
w.Updated = time.Now()
|
||||||
|
v.Windows[pos] = w
|
||||||
} else {
|
} else {
|
||||||
window.Status = value.(string)
|
|
||||||
window.Updated = time.Now()
|
|
||||||
v.Windows[pos] = Window{
|
v.Windows[pos] = Window{
|
||||||
Position: submatchall[0],
|
Position: submatchall[0],
|
||||||
Status: value.(string),
|
Status: value.(string),
|
||||||
@ -879,12 +877,11 @@ func (v *Vehicle) parseTirePsi(prefix, suffix, name string, value any) {
|
|||||||
submatchall := re.FindAllString(pos, -1)
|
submatchall := re.FindAllString(pos, -1)
|
||||||
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
||||||
|
|
||||||
if tire, ok := v.Tires[pos]; ok {
|
if t, ok := v.Tires[pos]; ok {
|
||||||
tire.PressurePsi = value.(int)
|
t.PressurePsi = value.(int)
|
||||||
tire.Updated = time.Now()
|
t.Updated = time.Now()
|
||||||
|
v.Tires[pos] = t
|
||||||
} else {
|
} else {
|
||||||
tire.PressurePsi = value.(int)
|
|
||||||
tire.Updated = time.Now()
|
|
||||||
v.Tires[pos] = Tire{
|
v.Tires[pos] = Tire{
|
||||||
Position: submatchall[0],
|
Position: submatchall[0],
|
||||||
PressurePsi: value.(int),
|
PressurePsi: value.(int),
|
||||||
@ -907,12 +904,11 @@ func (v *Vehicle) parseTire(prefix, suffix, name string, value any) {
|
|||||||
submatchall := re.FindAllString(pos, -1)
|
submatchall := re.FindAllString(pos, -1)
|
||||||
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
// v.client.logger.Debug("VEHICLE COND", "key", name, "data", value, "number", len(submatchall))
|
||||||
|
|
||||||
if tire, ok := v.Tires[pos]; ok {
|
if t, ok := v.Tires[pos]; ok {
|
||||||
tire.Pressure = value.(int)
|
t.Pressure = value.(int)
|
||||||
tire.Updated = time.Now()
|
t.Updated = time.Now()
|
||||||
|
v.Tires[pos] = t
|
||||||
} else {
|
} else {
|
||||||
tire.Pressure = value.(int)
|
|
||||||
tire.Updated = time.Now()
|
|
||||||
v.Tires[pos] = Tire{
|
v.Tires[pos] = Tire{
|
||||||
Position: submatchall[0],
|
Position: submatchall[0],
|
||||||
Pressure: value.(int),
|
Pressure: value.(int),
|
||||||
|
Reference in New Issue
Block a user