Skip to content

Commit

Permalink
add soh
Browse files Browse the repository at this point in the history
add minutes_to_charged
  • Loading branch information
arteck committed Jan 3, 2025
1 parent 1df21f3 commit da62a6f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/create_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,18 @@ class Create_tools {
native: {},
});

await this.adapter.setObjectNotExistsAsync(vin + '.vehicleStatus.battery.soh', {
type: 'state',
common: {
name: 'SoH',
type: 'number',
role: 'indicator',
read: true,
write: false,
},
native: {},
});

await this.adapter.setObjectNotExistsAsync(vin + '.vehicleStatus.battery.plugin', {
type: 'state',
common: {
Expand Down
14 changes: 13 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,8 @@ class Bluelink extends utils.Adapter {
val: newStatus.vehicleStatus.evStatus.batteryCharge,
ack: true
});


await this.setStateAsync(vin + '.vehicleStatus.battery.plugin', {
val: newStatus.vehicleStatus.evStatus.batteryPlugin,
ack: true
Expand Down Expand Up @@ -697,7 +699,17 @@ class Bluelink extends utils.Adapter {
val: newStatus.ccs2Status.state.Vehicle.Green.ChargingInformation.ConnectorFastening.State == 1 ? true : false,
ack: true
});


await this.setStateAsync(vin + '.vehicleStatus.battery.minutes_to_charged', {
val: newStatus.ccs2Status.state.Vehicle.Green.ChargingInformation.Charging.RemainTime,
ack: true,
});

await this.setStateAsync(vin + '.vehicleStatus.battery.soh', {
val: newStatus.ccs2Status.state.Vehicle.Green.BatteryManagement.SoH.Ratio,
ack: true,
});

//Location
const latitude = newStatus.ccs2Status.state.Vehicle.Location.GeoCoord.Latitude;
const longitude = newStatus.ccs2Status.state.Vehicle.Location.GeoCoord.Longitude;
Expand Down

0 comments on commit da62a6f

Please sign in to comment.