@@ -12,6 +12,30 @@ export interface Auth {
12
12
region : string
13
13
}
14
14
15
+ export const ClimateSeatSettingCool : Record < string , number > = {
16
+ Off : 0 ,
17
+ Low : 3 ,
18
+ Medium : 4 ,
19
+ High : 5 ,
20
+ }
21
+
22
+ export const ClimateSeatSettingWarm : Record < string , number > = {
23
+ Off : 0 ,
24
+ Low : 6 ,
25
+ Medium : 7 ,
26
+ High : 8 ,
27
+ }
28
+
29
+ export const ClimateSeatSetting : Record < string , number > = {
30
+ Off : 0 ,
31
+ 'Cool - Low' : 3 ,
32
+ 'Cool - Medium' : 4 ,
33
+ 'Cool - High' : 5 ,
34
+ 'Heat - Low' : 6 ,
35
+ 'Heat - Medium' : 7 ,
36
+ 'Heat - High' : 8 ,
37
+ }
38
+
15
39
export interface CustomClimateConfig {
16
40
name : string
17
41
tempType : 'C' | 'F'
@@ -20,6 +44,8 @@ export interface CustomClimateConfig {
20
44
rearDefrost : boolean
21
45
steering : boolean
22
46
durationMinutes : number
47
+ seatClimate : string
48
+ seatClimateSettings : 'DRIVER' | 'FRONT' | 'ALL'
23
49
}
24
50
25
51
export interface ChargeLimitConfig {
@@ -35,6 +61,7 @@ export interface Config {
35
61
distanceUnit : 'km' | 'mi'
36
62
climateTempWarm : number
37
63
climateTempCold : number
64
+ climateSeatLevel : string
38
65
allowWidgetRemoteRefresh : boolean
39
66
carColor : string
40
67
debugLogging : boolean
@@ -66,6 +93,7 @@ export interface FlattenedConfig {
66
93
distanceUnit : 'km' | 'mi'
67
94
climateTempWarm : number
68
95
climateTempCold : number
96
+ climateSeatLevel : string
69
97
allowWidgetRemoteRefresh : boolean
70
98
carColor : string
71
99
debugLogging : boolean
@@ -105,6 +133,7 @@ const DEFAULT_CONFIG = {
105
133
distanceUnit : 'km' ,
106
134
climateTempCold : DEFAULT_TEMPS . C . cold ,
107
135
climateTempWarm : DEFAULT_TEMPS . C . warm ,
136
+ climateSeatLevel : 'Off' ,
108
137
debugLogging : false ,
109
138
multiCar : false ,
110
139
promptForUpdate : true ,
@@ -205,6 +234,7 @@ export async function loadConfigScreen(bl: Bluelink | undefined = undefined) {
205
234
distanceUnit,
206
235
climateTempWarm,
207
236
climateTempCold,
237
+ climateSeatLevel,
208
238
debugLogging,
209
239
multiCar,
210
240
promptForUpdate,
@@ -229,6 +259,7 @@ export async function loadConfigScreen(bl: Bluelink | undefined = undefined) {
229
259
distanceUnit : distanceUnit ,
230
260
climateTempCold : climateTempCold ,
231
261
climateTempWarm : climateTempWarm ,
262
+ climateSeatLevel : climateSeatLevel ,
232
263
allowWidgetRemoteRefresh : allowWidgetRemoteRefresh ,
233
264
carColor : carColor ? carColor . toLocaleLowerCase ( ) : 'white' ,
234
265
debugLogging : debugLogging ,
@@ -335,6 +366,12 @@ export async function loadConfigScreen(bl: Bluelink | undefined = undefined) {
335
366
label : 'Climate temp when pre-cooling (whole number or .5)' ,
336
367
isRequired : true ,
337
368
} ,
369
+ climateSeatLevel : {
370
+ type : 'dropdown' ,
371
+ label : 'Climate Seat Setting' ,
372
+ isRequired : true ,
373
+ options : Object . keys ( ClimateSeatSettingCool ) ,
374
+ } ,
338
375
carColor : {
339
376
type : 'dropdown' ,
340
377
label : 'Car Color (Will default to white if not available)' ,
@@ -499,22 +536,34 @@ export async function loadWidgetConfigScreen() {
499
536
500
537
export async function loadCustomClimateConfig ( climateConfig : CustomClimateConfig | undefined ) {
501
538
const previousName = climateConfig ? climateConfig . name : undefined
502
- if ( ! climateConfig ) {
503
- climateConfig = {
504
- name : '' ,
505
- tempType : 'C' ,
506
- temp : DEFAULT_TEMPS . C . warm ,
507
- frontDefrost : true ,
508
- rearDefrost : true ,
509
- steering : true ,
510
- durationMinutes : 15 ,
511
- } as CustomClimateConfig
512
- }
539
+ const defaultClimateConfig = {
540
+ name : '' ,
541
+ tempType : 'C' ,
542
+ temp : DEFAULT_TEMPS . C . warm ,
543
+ frontDefrost : true ,
544
+ rearDefrost : true ,
545
+ steering : true ,
546
+ durationMinutes : 15 ,
547
+ seatClimate : 'OFF' ,
548
+ seatClimateSettings : 'ALL' ,
549
+ } as CustomClimateConfig
550
+ if ( ! climateConfig ) climateConfig = defaultClimateConfig
551
+ else climateConfig = { ...defaultClimateConfig , ...climateConfig } // merge with default config
513
552
514
553
return await form < CustomClimateConfig & { delete : boolean } > ( {
515
554
title : 'Custom Climate Configuration' ,
516
555
subtitle : previousName ? `Editing configuration: ${ previousName } ` : 'Create new configuration' ,
517
- onSubmit : ( { name, tempType, temp, frontDefrost, rearDefrost, steering, durationMinutes } ) => {
556
+ onSubmit : ( {
557
+ name,
558
+ tempType,
559
+ temp,
560
+ frontDefrost,
561
+ rearDefrost,
562
+ steering,
563
+ durationMinutes,
564
+ seatClimate,
565
+ seatClimateSettings,
566
+ } ) => {
518
567
const config = getConfig ( )
519
568
const newConfig = {
520
569
name : name ,
@@ -524,6 +573,8 @@ export async function loadCustomClimateConfig(climateConfig: CustomClimateConfig
524
573
rearDefrost : rearDefrost ,
525
574
steering : steering ,
526
575
durationMinutes : durationMinutes ,
576
+ seatClimate : seatClimate || 'OFF' ,
577
+ seatClimateSettings : seatClimateSettings || 'ALL' ,
527
578
} as CustomClimateConfig
528
579
if ( previousName ) {
529
580
const index = config . customClimates . findIndex ( ( x ) => x . name === previousName )
@@ -599,6 +650,18 @@ export async function loadCustomClimateConfig(climateConfig: CustomClimateConfig
599
650
label : 'Number of Minutes to run climate' ,
600
651
isRequired : true ,
601
652
} ,
653
+ seatClimate : {
654
+ type : 'dropdown' ,
655
+ label : 'Seat Climate Setting' ,
656
+ isRequired : true ,
657
+ options : Object . keys ( ClimateSeatSetting ) ,
658
+ } ,
659
+ seatClimateSettings : {
660
+ type : 'dropdown' ,
661
+ label : 'Seat Climate Settings' ,
662
+ isRequired : true ,
663
+ options : [ 'DRIVER' , 'FRONT' , 'ALL' ] ,
664
+ } ,
602
665
delete : {
603
666
type : 'clickable' ,
604
667
label : 'Delete Climate Configuration' ,
0 commit comments