diff --git a/info.md b/info.md index f1c66e7..6588b71 100644 --- a/info.md +++ b/info.md @@ -26,7 +26,7 @@ resources: | title | False | _string_ | The heading to display. Don't set to hide header | dark | False | _bool_ | Dark mode | controls | False | _list_ | List of used controls (select 3 from `arm`, `ign`, `horn`, `webasto`, `out`) -| info | False | _list_ | List of information tiles (allowed values: `balance`, `battery`, `ctemp`, `etemp`, `gps`, `fuel`) +| info | False | _list_ | List of information tiles (allowed values: `balance`, `battery`, `ctemp`, `etemp`, `gps`, `fuel`, `mileage`) | entity_id | False | _string_ | Automatic card configuration by one entity_id (e.g. `device_tracker.audi_location`) | device_id | False | _string_ | Automatic card configuration by device_id | entities | False | _map_ | Map of used entities (see below) @@ -40,6 +40,7 @@ resources: | entities.gsm_lvl | True | _string_ | GSM signal level _sensor_ entity_id | entities.gps | False | _string_ | GPS satellites count _sensor_ entity_id | entities.fuel | False | _string_ | Fuel volume _sensor_ entity_id +| entities.mileage | False | _string_ | Mileage _sensor_ entity_id | entities.hbrake | False | _string_ | Hand brake _binary_sensor_ entity_id | entities.hood | True | _string_ | Hood _binary_sensor_ entity_id | entities.horn | True | _string_ | Horn _button_ entity_id @@ -107,6 +108,7 @@ entities: gsm_lvl: sensor.audi_gsm_signal gps: sensor.audi_gps_satellites fuel: sensor.audi_fuel_volume + mileage: sensor.audi_mileage hbrake: binary_sensor.audi_hand_brake hood: binary_sensor.audi_hood horn: switch.audi_horn diff --git a/src/starline.html b/src/starline.html index d69781d..aab3162 100644 --- a/src/starline.html +++ b/src/starline.html @@ -63,6 +63,10 @@ +
+ + +
diff --git a/src/ts/StarlineCard.ts b/src/ts/StarlineCard.ts index c7d4d39..8231b09 100644 --- a/src/ts/StarlineCard.ts +++ b/src/ts/StarlineCard.ts @@ -4,7 +4,7 @@ import type {ClickPosition, Config, ConfigEntity, ConfigInfo, UIElement} from '. export class StarlineCard extends HTMLElement { private _config: Config = { controls: ['arm', 'ign', 'horn', 'webasto', 'out'], - info: ['balance', 'battery', 'ctemp', 'etemp', 'gps'], + info: ['balance', 'battery', 'ctemp', 'etemp', 'gps', 'mileage'], dark: false }; @@ -42,6 +42,10 @@ export class StarlineCard extends HTMLElement { fuel: { element: null, value: null + }, + mileage: { + element: null, + value: null } }; @@ -121,6 +125,7 @@ export class StarlineCard extends HTMLElement { this._info.etemp.element = this.$wrapper.querySelector('.info-engine'!); this._info.gps.element = this.$wrapper.querySelector('.info-gps')!; this._info.fuel.element = this.$wrapper.querySelector('.info-fuel')!; + this._info.mileage.element = this.$wrapper.querySelector('.info-mileage')!; this._gsm_lvl.element = this.$wrapper.querySelector('.gsm-lvl')!; this._handsfree.element = this.$wrapper.querySelector('.handsfree')!; diff --git a/src/ts/entities.ts b/src/ts/entities.ts index 43f4d25..092ff05 100644 --- a/src/ts/entities.ts +++ b/src/ts/entities.ts @@ -106,4 +106,9 @@ export const STARLINE_ENTITIES: {[key in ConfigEntity]: {name: string, required: required: false, regex: /^binary_sensor\.(.+)_moving_ban(_[0-9]+)?$/, }, + 'mileage': { + name: 'Mileage', + required: false, + regex: /^sensor\.(.+)_mileage(_[0-9]+)?$/, + }, }; diff --git a/src/ts/types.ts b/src/ts/types.ts index 509b751..1fe24c2 100644 --- a/src/ts/types.ts +++ b/src/ts/types.ts @@ -1,9 +1,9 @@ export type ConfigEntity = 'battery' | 'balance' | 'ctemp' | 'etemp' | 'gps' | 'gsm_lvl' | 'fuel' | 'hbrake' | 'hood' | 'horn' | 'trunk' | 'alarm' | 'door' | 'engine' | 'webasto' | 'out' | 'security' - | 'location' | 'handsfree' | 'neutral' | 'moving_ban'; + | 'location' | 'handsfree' | 'neutral' | 'moving_ban' | 'mileage'; -export type ConfigInfo = 'balance' | 'battery' | 'ctemp' | 'etemp' | 'gps' | 'fuel'; // TODO: Extract? +export type ConfigInfo = 'balance' | 'battery' | 'ctemp' | 'etemp' | 'gps' | 'fuel' | 'mileage'; // TODO: Extract? export type ConfigControls = 'arm' | 'ign' | 'horn' | 'webasto' | 'out'; // TODO: Extract?