volkswagencarnet 5.0.0b4__py3-none-any.whl → 5.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of volkswagencarnet might be problematic. Click here for more details.

@@ -2,14 +2,13 @@
2
2
 
3
3
  # Thanks to molobrakos
4
4
 
5
- import logging
6
5
  from datetime import datetime
6
+ import logging
7
7
 
8
8
  from .vw_const import TEMP_CELSIUS, VWDeviceClass, VWStateClass
9
9
  from .vw_utilities import camel2slug
10
10
  from .vw_vehicle import Vehicle
11
11
 
12
-
13
12
  _LOGGER = logging.getLogger(__name__)
14
13
 
15
14
 
@@ -27,7 +26,7 @@ class Instrument:
27
26
  entity_type: str | None = None,
28
27
  device_class: str | None = None,
29
28
  state_class: str | None = None,
30
- ):
29
+ ) -> None:
31
30
  """Init."""
32
31
  self.attr = attr
33
32
  self.component = component
@@ -44,7 +43,6 @@ class Instrument:
44
43
 
45
44
  def configurate(self, **args):
46
45
  """Override in subclasses."""
47
- pass
48
46
 
49
47
  @property
50
48
  def slug_attr(self) -> str:
@@ -55,7 +53,9 @@ class Instrument:
55
53
  """Set up entity if supported."""
56
54
  self.vehicle = vehicle
57
55
  if not self.is_supported:
58
- _LOGGER.debug("%s (%s:%s) is not supported", self, type(self).__name__, self.attr)
56
+ _LOGGER.debug(
57
+ "%s (%s:%s) is not supported", self, type(self).__name__, self.attr
58
+ )
59
59
  return False
60
60
 
61
61
  _LOGGER.debug("%s is supported", self)
@@ -87,8 +87,7 @@ class Instrument:
87
87
  """Return current state."""
88
88
  if hasattr(self.vehicle, self.attr):
89
89
  return getattr(self.vehicle, self.attr)
90
- else:
91
- _LOGGER.debug(f'Could not find attribute "{self.attr}"')
90
+ _LOGGER.debug('Could not find attribute "%s"', self.attr)
92
91
  return self.vehicle.get_attr(self.attr)
93
92
 
94
93
  @property
@@ -102,16 +101,20 @@ class Instrument:
102
101
  supported = "is_" + self.attr + "_supported"
103
102
  if hasattr(self.vehicle, supported):
104
103
  return getattr(self.vehicle, supported)
105
- else:
106
- return False
104
+ return False
107
105
 
108
106
  @property
109
107
  def last_refresh(self) -> datetime | None:
108
+ """Return last_updated attribute."""
110
109
  if hasattr(self.vehicle, self.attr + "_last_updated"):
111
110
  return getattr(self.vehicle, self.attr + "_last_updated")
112
- _LOGGER.warning(f"Implement in subclasses. {self.__class__}:{self.attr}_last_updated")
111
+ _LOGGER.warning(
112
+ "Implement in subclasses. %s:%s_last_updated", self.__class__, self.attr
113
+ )
113
114
  if self.state_class is not None:
114
- raise NotImplementedError(f"Implement in subclasses. {self.__class__}:{self.attr}_last_updated")
115
+ raise NotImplementedError(
116
+ f"Implement in subclasses. {self.__class__}:{self.attr}_last_updated"
117
+ )
115
118
  return None
116
119
 
117
120
 
@@ -127,7 +130,7 @@ class Sensor(Instrument):
127
130
  entity_type: str | None = None,
128
131
  device_class: str | None = None,
129
132
  state_class: str | None = None,
130
- ):
133
+ ) -> None:
131
134
  """Init."""
132
135
  super().__init__(
133
136
  component="sensor",
@@ -142,72 +145,90 @@ class Sensor(Instrument):
142
145
  self.convert = False
143
146
 
144
147
  def configurate(self, miles=False, scandinavian_miles=False, **config):
148
+ """Configure unit conversion."""
145
149
  if self.unit and miles:
146
- if "km" == self.unit:
150
+ if self.unit == "km":
147
151
  self.unit = "mi"
148
152
  self.convert = True
149
- elif "km/h" == self.unit:
153
+ elif self.unit == "km/h":
150
154
  self.unit = "mi/h"
151
155
  self.convert = True
152
- elif "l/100 km" == self.unit:
156
+ elif self.unit == "l/100 km":
153
157
  self.unit = "l/100 mi"
154
158
  self.convert = True
155
- elif "kWh/100 km" == self.unit:
159
+ elif self.unit == "kWh/100 km":
156
160
  self.unit = "kWh/100 mi"
157
161
  self.convert = True
158
162
  elif self.unit and scandinavian_miles:
159
- if "km" == self.unit:
163
+ if self.unit == "km":
160
164
  self.unit = "mil"
161
- elif "km/h" == self.unit:
165
+ elif self.unit == "km/h":
162
166
  self.unit = "mil/h"
163
- elif "l/100 km" == self.unit:
167
+ elif self.unit == "l/100 km":
164
168
  self.unit = "l/100 mil"
165
- elif "kWh/100 km" == self.unit:
169
+ elif self.unit == "kWh/100 km":
166
170
  self.unit = "kWh/100 mil"
167
171
 
168
172
  @property
169
173
  def is_mutable(self):
174
+ """Return boolean is_mutable."""
170
175
  return False
171
176
 
172
177
  @property
173
178
  def str_state(self):
179
+ """Return current state as string."""
174
180
  if self.unit:
175
181
  return f"{self.state} {self.unit}"
176
- else:
177
- return f"{self.state}"
182
+ return f"{self.state}"
178
183
 
179
184
  @property
180
185
  def state(self):
186
+ """Return current state."""
187
+ # Base value
181
188
  val = super().state
182
- if val and self.unit and "mi" in self.unit and self.convert is True:
183
- return round(int(val) * 0.6213712)
184
- elif val and self.unit and "mi/h" in self.unit and self.convert is True:
185
- return round(int(val) * 0.6213712)
186
- elif val and self.unit and "gal/100 mi" in self.unit and self.convert is True:
187
- return round(val * 0.4251438, 1)
188
- elif val and self.unit and "kWh/100 mi" in self.unit and self.convert is True:
189
- return round(val * 0.4251438, 1)
190
- elif val and self.unit and "°F" in self.unit and self.convert is True:
191
- temp = round((val * 9 / 5) + 32, 1)
192
- return temp
193
- elif val and self.unit in ["mil", "mil/h"]:
194
- return val / 10
195
- else:
189
+ # If the base value is not valid or convert is not true, return the original value
190
+ if not val or not self.convert:
196
191
  return val
192
+ # Simplified condition checking
193
+ if self.unit:
194
+ if "mi" in self.unit:
195
+ if self.unit in ["mi", "mi/h"]:
196
+ return round(int(val) * 0.6213712)
197
+ if "gal/100 mi" in self.unit or "kWh/100 mi" in self.unit:
198
+ return round(val * 0.4251438, 1)
199
+ if "°F" in self.unit:
200
+ return round((val * 9 / 5) + 32, 1)
201
+ if self.unit in ["mil", "mil/h"]:
202
+ return val / 10
203
+ # Default case, return the unmodified value
204
+ return val
197
205
 
198
206
 
199
207
  class BinarySensor(Instrument):
200
- def __init__(self, attr, name, device_class, icon="", entity_type=None, reverse_state=False):
201
- super().__init__(component="binary_sensor", attr=attr, name=name, icon=icon, entity_type=entity_type)
208
+ """BinarySensor instrument."""
209
+
210
+ def __init__(
211
+ self, attr, name, device_class, icon="", entity_type=None, reverse_state=False
212
+ ) -> None:
213
+ """Init."""
214
+ super().__init__(
215
+ component="binary_sensor",
216
+ attr=attr,
217
+ name=name,
218
+ icon=icon,
219
+ entity_type=entity_type,
220
+ )
202
221
  self.device_class = device_class
203
222
  self.reverse_state = reverse_state
204
223
 
205
224
  @property
206
225
  def is_mutable(self):
226
+ """Return boolean is_mutable."""
207
227
  return False
208
228
 
209
229
  @property
210
230
  def str_state(self):
231
+ """Return current state as string."""
211
232
  if self.device_class in [VWDeviceClass.DOOR, VWDeviceClass.WINDOW]:
212
233
  return "Open" if self.state else "Closed"
213
234
  if self.device_class == VWDeviceClass.LOCK:
@@ -223,47 +244,53 @@ class BinarySensor(Instrument):
223
244
 
224
245
  @property
225
246
  def state(self):
247
+ """Return current state."""
226
248
  val = super().state
227
249
 
228
250
  if isinstance(val, (bool, list)):
229
251
  if self.reverse_state:
230
252
  if bool(val):
231
253
  return False
232
- else:
233
- return True
234
- else:
235
- return bool(val)
236
- elif isinstance(val, str):
254
+ return True
255
+ return bool(val)
256
+ if isinstance(val, str):
237
257
  return val != "Normal"
238
258
  return val
239
259
 
240
260
  @property
241
261
  def is_on(self):
262
+ """Return state."""
242
263
  return self.state
243
264
 
244
265
 
245
266
  class Switch(Instrument):
246
267
  """Switch instrument."""
247
268
 
248
- def __init__(self, attr, name, icon, entity_type=None):
249
- super().__init__(component="switch", attr=attr, name=name, icon=icon, entity_type=entity_type)
269
+ def __init__(self, attr, name, icon, entity_type=None) -> None:
270
+ """Init."""
271
+ super().__init__(
272
+ component="switch", attr=attr, name=name, icon=icon, entity_type=entity_type
273
+ )
250
274
 
251
275
  @property
252
276
  def is_mutable(self):
277
+ """Return boolean is_mutable."""
253
278
  return True
254
279
 
255
280
  @property
256
281
  def str_state(self):
282
+ """Return current state as string."""
257
283
  return "On" if self.state else "Off"
258
284
 
259
285
  def is_on(self):
286
+ """Return state."""
260
287
  return self.state
261
288
 
262
289
  def turn_on(self):
263
- pass
290
+ """Turn on."""
264
291
 
265
292
  def turn_off(self):
266
- pass
293
+ """Turn off."""
267
294
 
268
295
  @property
269
296
  def assumed_state(self) -> bool:
@@ -272,6 +299,8 @@ class Switch(Instrument):
272
299
 
273
300
 
274
301
  class Number(Instrument):
302
+ """Number instrument."""
303
+
275
304
  def __init__(
276
305
  self,
277
306
  attr: str,
@@ -281,7 +310,7 @@ class Number(Instrument):
281
310
  entity_type: str | None = None,
282
311
  device_class: str | None = None,
283
312
  state_class: str | None = None,
284
- ):
313
+ ) -> None:
285
314
  """Init."""
286
315
  super().__init__(
287
316
  component="number",
@@ -296,35 +325,91 @@ class Number(Instrument):
296
325
 
297
326
  @property
298
327
  def is_mutable(self):
328
+ """Return boolean is_mutable."""
299
329
  return False
300
330
 
301
331
  @property
302
332
  def state(self):
333
+ """Return current state."""
303
334
  raise NotImplementedError
304
335
 
305
336
  @property
306
337
  def min_value(self):
338
+ """Return min value."""
307
339
  raise NotImplementedError
308
340
 
309
341
  @property
310
342
  def max_value(self):
343
+ """Return max value."""
311
344
  raise NotImplementedError
312
345
 
313
346
  @property
314
347
  def native_step(self):
348
+ """Return native step."""
349
+ raise NotImplementedError
350
+
351
+
352
+ class Select(Instrument):
353
+ """Select instrument."""
354
+
355
+ def __init__(
356
+ self,
357
+ attr: str,
358
+ name: str,
359
+ icon: str | None,
360
+ unit: str | None,
361
+ entity_type: str | None = None,
362
+ device_class: str | None = None,
363
+ state_class: str | None = None,
364
+ ) -> None:
365
+ """Init."""
366
+ super().__init__(
367
+ component="select",
368
+ attr=attr,
369
+ name=name,
370
+ icon=icon,
371
+ entity_type=entity_type,
372
+ device_class=device_class,
373
+ state_class=state_class,
374
+ )
375
+ self.unit = unit
376
+
377
+ @property
378
+ def is_mutable(self):
379
+ """Return boolean is_mutable."""
380
+ return False
381
+
382
+ @property
383
+ def state(self):
384
+ """Return current state."""
385
+ raise NotImplementedError
386
+
387
+ @property
388
+ def current_option(self):
389
+ """Return current option."""
390
+ raise NotImplementedError
391
+
392
+ @property
393
+ def options(self):
394
+ """Return options."""
315
395
  raise NotImplementedError
316
396
 
317
397
 
318
398
  class Position(Instrument):
319
- def __init__(self):
399
+ """Position instrument."""
400
+
401
+ def __init__(self) -> None:
402
+ """Init."""
320
403
  super().__init__(component="device_tracker", attr="position", name="Position")
321
404
 
322
405
  @property
323
406
  def is_mutable(self):
407
+ """Return boolean is_mutable."""
324
408
  return False
325
409
 
326
410
  @property
327
411
  def state(self):
412
+ """Return current state."""
328
413
  state = super().state # or {}
329
414
  return (
330
415
  state.get("lat", "?"),
@@ -334,6 +419,7 @@ class Position(Instrument):
334
419
 
335
420
  @property
336
421
  def str_state(self):
422
+ """Return current state as string."""
337
423
  state = super().state # or {}
338
424
  ts = state.get("timestamp", None)
339
425
  return (
@@ -344,81 +430,106 @@ class Position(Instrument):
344
430
 
345
431
 
346
432
  class DoorLock(Instrument):
347
- def __init__(self):
348
- super().__init__(component=VWDeviceClass.LOCK, attr="door_locked", name="Door locked")
433
+ """DoorLock instrument."""
434
+
435
+ def __init__(self) -> None:
436
+ """Init."""
437
+ super().__init__(
438
+ component=VWDeviceClass.LOCK, attr="door_locked", name="Door locked"
439
+ )
349
440
  self.spin = ""
350
441
 
351
442
  def configurate(self, **config):
443
+ """Configure spin."""
352
444
  self.spin = config.get("spin", "")
353
445
 
354
446
  @property
355
447
  def is_mutable(self):
448
+ """Return boolean is_mutable."""
356
449
  return True
357
450
 
358
451
  @property
359
452
  def str_state(self):
453
+ """Return current state as string."""
360
454
  return "Locked" if self.state else "Unlocked"
361
455
 
362
456
  @property
363
457
  def state(self):
458
+ """Return current state."""
364
459
  return self.vehicle.door_locked
365
460
 
366
461
  @property
367
462
  def is_locked(self):
463
+ """Return current state."""
368
464
  return self.state
369
465
 
370
466
  async def lock(self):
467
+ """Trigger Lock."""
371
468
  try:
372
469
  response = await self.vehicle.set_lock(VWDeviceClass.LOCK, self.spin)
373
470
  await self.vehicle.update()
374
471
  if self.callback is not None:
375
472
  self.callback()
376
- return response
377
- except Exception as e:
378
- _LOGGER.error("Lock failed: %", e.args[0])
473
+ except Exception as e: # pylint: disable=broad-exception-caught
474
+ _LOGGER.error("Lock failed: %s", e.args[0])
379
475
  return False
476
+ else:
477
+ return response
380
478
 
381
479
  async def unlock(self):
480
+ """Trigger Unlock."""
382
481
  try:
383
482
  response = await self.vehicle.set_lock("unlock", self.spin)
384
483
  await self.vehicle.update()
385
484
  if self.callback is not None:
386
485
  self.callback()
387
- return response
388
- except Exception as e:
389
- _LOGGER.error("Unlock failed: %", e.args[0])
486
+ except Exception as e: # pylint: disable=broad-exception-caught
487
+ _LOGGER.error("Unlock failed: %s", e.args[0])
390
488
  return False
489
+ else:
490
+ return response
391
491
 
392
492
  @property
393
493
  def attributes(self) -> dict:
394
494
  """Return attributes."""
395
- return dict(last_result=self.vehicle.lock_action_status)
495
+ return {"last_result": self.vehicle.lock_action_status}
396
496
 
397
497
 
398
498
  class TrunkLock(Instrument):
399
- def __init__(self):
400
- super().__init__(component=VWDeviceClass.LOCK, attr="trunk_locked", name="Trunk locked")
499
+ """TrunkLock instrument."""
500
+
501
+ def __init__(self) -> None:
502
+ """Init."""
503
+ super().__init__(
504
+ component=VWDeviceClass.LOCK, attr="trunk_locked", name="Trunk locked"
505
+ )
401
506
 
402
507
  @property
403
508
  def is_mutable(self):
509
+ """Return boolean is_mutable."""
404
510
  return True
405
511
 
406
512
  @property
407
513
  def str_state(self):
514
+ """Return current state as string."""
408
515
  return "Locked" if self.state else "Unlocked"
409
516
 
410
517
  @property
411
518
  def state(self):
519
+ """Return current state."""
412
520
  return self.vehicle.trunk_locked
413
521
 
414
522
  @property
415
523
  def is_locked(self):
524
+ """Return current state."""
416
525
  return self.state
417
526
 
418
527
  async def lock(self):
528
+ """Trigger lock."""
419
529
  return None
420
530
 
421
531
  async def unlock(self):
532
+ """Trigger unlock."""
422
533
  return None
423
534
 
424
535
 
@@ -428,7 +539,8 @@ class TrunkLock(Instrument):
428
539
  class AuxiliaryDuration(Number):
429
540
  """Currently disabled due to the lack of auxiliary settings API."""
430
541
 
431
- def __init__(self):
542
+ def __init__(self) -> None:
543
+ """Init."""
432
544
  super().__init__(
433
545
  attr="auxiliary_duration",
434
546
  name="Auxiliary duration",
@@ -439,37 +551,45 @@ class AuxiliaryDuration(Number):
439
551
  self.spin = ""
440
552
 
441
553
  def configurate(self, **config):
554
+ """Configure spin."""
442
555
  self.spin = config.get("spin", "")
443
556
 
444
557
  @property
445
558
  def state(self):
559
+ """Return current state."""
446
560
  return self.vehicle.auxiliary_duration
447
561
 
448
562
  async def set_value(self, minutes: int):
563
+ """Set value."""
449
564
  await self.vehicle.set_auxiliary_duration(minutes, self.spin)
450
565
  await self.vehicle.update()
451
566
 
452
567
  @property
453
568
  def min_value(self):
569
+ """Return min value."""
454
570
  return 5
455
571
 
456
572
  @property
457
573
  def max_value(self):
574
+ """Return max value."""
458
575
  return 30
459
576
 
460
577
  @property
461
578
  def native_step(self):
579
+ """Return native step."""
462
580
  return 5
463
581
 
464
582
  @property
465
583
  def attributes(self) -> dict:
466
584
  """Return attributes."""
467
- return dict(last_result=self.vehicle.climater_action_status)
585
+ return {"last_result": self.vehicle.climater_action_status}
468
586
 
469
587
 
470
588
  class BatteryTargetSOC(Number):
589
+ """Battery target charge level."""
471
590
 
472
- def __init__(self):
591
+ def __init__(self) -> None:
592
+ """Init."""
473
593
  super().__init__(
474
594
  attr="battery_target_charge_level",
475
595
  name="Battery target charge level",
@@ -480,33 +600,42 @@ class BatteryTargetSOC(Number):
480
600
 
481
601
  @property
482
602
  def state(self):
603
+ """Return current state."""
483
604
  return self.vehicle.battery_target_charge_level
484
605
 
485
606
  async def set_value(self, value: int):
486
- await self.vehicle.set_charging_settings(setting="battery_target_charge_level", value=value)
607
+ """Set value."""
608
+ await self.vehicle.set_charging_settings(
609
+ setting="battery_target_charge_level", value=value
610
+ )
487
611
  await self.vehicle.update()
488
612
 
489
613
  @property
490
614
  def min_value(self):
615
+ """Return min value."""
491
616
  return 50
492
617
 
493
618
  @property
494
619
  def max_value(self):
620
+ """Return max value."""
495
621
  return 100
496
622
 
497
623
  @property
498
624
  def native_step(self):
625
+ """Return native step."""
499
626
  return 10
500
627
 
501
628
  @property
502
629
  def attributes(self) -> dict:
503
630
  """Return attributes."""
504
- return dict(last_result=self.vehicle.charger_action_status)
631
+ return {"last_result": self.vehicle.charger_action_status}
505
632
 
506
633
 
507
634
  class ClimatisationTargetTemperature(Number):
635
+ """Climatisation target temperature."""
508
636
 
509
- def __init__(self):
637
+ def __init__(self) -> None:
638
+ """Init."""
510
639
  super().__init__(
511
640
  attr="climatisation_target_temperature",
512
641
  name="Climatisation target temperature",
@@ -517,49 +646,102 @@ class ClimatisationTargetTemperature(Number):
517
646
 
518
647
  @property
519
648
  def state(self):
649
+ """Return current state."""
520
650
  return self.vehicle.climatisation_target_temperature
521
651
 
522
652
  async def set_value(self, value: float):
523
- await self.vehicle.set_climatisation_settings(setting="climatisation_target_temperature", value=value)
653
+ """Set value."""
654
+ await self.vehicle.set_climatisation_settings(
655
+ setting="climatisation_target_temperature", value=value
656
+ )
524
657
  await self.vehicle.update()
525
658
 
526
659
  @property
527
660
  def min_value(self):
661
+ """Return min value."""
528
662
  return 15.5
529
663
 
530
664
  @property
531
665
  def max_value(self):
666
+ """Return max value."""
532
667
  return 30
533
668
 
534
669
  @property
535
670
  def native_step(self):
671
+ """Return native step."""
536
672
  return 0.5
537
673
 
538
674
  @property
539
675
  def attributes(self) -> dict:
540
676
  """Return attributes."""
541
- return dict(last_result=self.vehicle.climater_action_status)
677
+ return {"last_result": self.vehicle.climater_action_status}
678
+
679
+
680
+ # Select
681
+
682
+
683
+ class ChargeMaxACAmpere(Select):
684
+ """Maximum charge ampere."""
685
+
686
+ def __init__(self) -> None:
687
+ """Init."""
688
+ super().__init__(
689
+ attr="charge_max_ac_ampere",
690
+ name="Charger max AC ampere",
691
+ icon="mdi:flash-auto",
692
+ unit="A",
693
+ entity_type="config",
694
+ )
695
+
696
+ @property
697
+ def state(self):
698
+ """Return current state."""
699
+ return self.vehicle.charge_max_ac_ampere
700
+
701
+ @property
702
+ def current_option(self):
703
+ """Return current option."""
704
+ return str(self.vehicle.charge_max_ac_ampere)
705
+
706
+ @property
707
+ def options(self) -> dict:
708
+ """Return options."""
709
+ return ["5", "10", "13", "32"]
710
+
711
+ async def set_value(self, ampere: str):
712
+ """Set value."""
713
+ await self.vehicle.set_charging_settings(
714
+ setting="max_charge_amperage", value=ampere
715
+ )
716
+ await self.vehicle.update()
542
717
 
543
718
 
544
719
  # Switches
545
720
 
546
721
 
547
722
  class RequestUpdate(Switch):
548
- def __init__(self):
549
- super().__init__(attr="refresh_data", name="Force data refresh", icon="mdi:car-connected")
723
+ """Force data refresh."""
724
+
725
+ def __init__(self) -> None:
726
+ """Init."""
727
+ super().__init__(
728
+ attr="refresh_data", name="Force data refresh", icon="mdi:car-connected"
729
+ )
550
730
 
551
731
  @property
552
732
  def state(self):
733
+ """Return current state."""
553
734
  return self.vehicle.refresh_data
554
735
 
555
736
  async def turn_on(self):
737
+ """Turn on."""
556
738
  await self.vehicle.set_refresh()
557
739
  await self.vehicle.update()
558
740
  if self.callback is not None:
559
741
  self.callback()
560
742
 
561
743
  async def turn_off(self):
562
- pass
744
+ """Turn off."""
563
745
 
564
746
  @property
565
747
  def assumed_state(self) -> bool:
@@ -569,22 +751,32 @@ class RequestUpdate(Switch):
569
751
  @property
570
752
  def attributes(self) -> dict:
571
753
  """Return attributes."""
572
- return dict(last_result=self.vehicle.refresh_action_status)
754
+ return {"last_result": self.vehicle.refresh_action_status}
573
755
 
574
756
 
575
757
  class ElectricClimatisation(Switch):
576
- def __init__(self):
577
- super().__init__(attr="electric_climatisation", name="Electric Climatisation", icon="mdi:air-conditioner")
758
+ """Electric Climatisation."""
759
+
760
+ def __init__(self) -> None:
761
+ """Init."""
762
+ super().__init__(
763
+ attr="electric_climatisation",
764
+ name="Electric Climatisation",
765
+ icon="mdi:air-conditioner",
766
+ )
578
767
 
579
768
  @property
580
769
  def state(self):
770
+ """Return current state."""
581
771
  return self.vehicle.electric_climatisation
582
772
 
583
773
  async def turn_on(self):
774
+ """Turn on."""
584
775
  await self.vehicle.set_climatisation("start")
585
776
  await self.vehicle.update()
586
777
 
587
778
  async def turn_off(self):
779
+ """Turn off."""
588
780
  await self.vehicle.set_climatisation("stop")
589
781
  await self.vehicle.update()
590
782
 
@@ -596,26 +788,37 @@ class ElectricClimatisation(Switch):
596
788
  @property
597
789
  def attributes(self) -> dict:
598
790
  """Return attributes."""
599
- return dict(last_result=self.vehicle.climater_action_status)
791
+ return {"last_result": self.vehicle.climater_action_status}
600
792
 
601
793
 
602
794
  class AuxiliaryClimatisation(Switch):
603
- def __init__(self):
604
- super().__init__(attr="auxiliary_climatisation", name="Auxiliary Climatisation", icon="mdi:radiator")
795
+ """Auxiliary Climatisation."""
796
+
797
+ def __init__(self) -> None:
798
+ """Init."""
799
+ super().__init__(
800
+ attr="auxiliary_climatisation",
801
+ name="Auxiliary Climatisation",
802
+ icon="mdi:radiator",
803
+ )
605
804
  self.spin = ""
606
805
 
607
806
  def configurate(self, **config):
807
+ """Configure spin."""
608
808
  self.spin = config.get("spin", "")
609
809
 
610
810
  @property
611
811
  def state(self):
812
+ """Return current state."""
612
813
  return self.vehicle.auxiliary_climatisation
613
814
 
614
815
  async def turn_on(self):
816
+ """Turn on."""
615
817
  await self.vehicle.set_auxiliary_climatisation("start", self.spin)
616
818
  await self.vehicle.update()
617
819
 
618
820
  async def turn_off(self):
821
+ """Turn off."""
619
822
  await self.vehicle.set_auxiliary_climatisation("stop", self.spin)
620
823
  await self.vehicle.update()
621
824
 
@@ -627,22 +830,28 @@ class AuxiliaryClimatisation(Switch):
627
830
  @property
628
831
  def attributes(self) -> dict:
629
832
  """Return attributes."""
630
- return dict(last_result=self.vehicle.climater_action_status)
833
+ return {"last_result": self.vehicle.climater_action_status}
631
834
 
632
835
 
633
836
  class Charging(Switch):
634
- def __init__(self):
837
+ """Charging."""
838
+
839
+ def __init__(self) -> None:
840
+ """Init."""
635
841
  super().__init__(attr="charging", name="Charging", icon="mdi:battery")
636
842
 
637
843
  @property
638
844
  def state(self):
845
+ """Return current state."""
639
846
  return self.vehicle.charging
640
847
 
641
848
  async def turn_on(self):
849
+ """Turn on."""
642
850
  await self.vehicle.set_charger("start")
643
851
  await self.vehicle.update()
644
852
 
645
853
  async def turn_off(self):
854
+ """Turn off."""
646
855
  await self.vehicle.set_charger("stop")
647
856
  await self.vehicle.update()
648
857
 
@@ -654,25 +863,38 @@ class Charging(Switch):
654
863
  @property
655
864
  def attributes(self) -> dict:
656
865
  """Return attributes."""
657
- return dict(last_result=self.vehicle.charger_action_status)
866
+ return {"last_result": self.vehicle.charger_action_status}
658
867
 
659
868
 
660
869
  class ReducedACCharging(Switch):
661
- def __init__(self):
870
+ """Reduced AC Charging."""
871
+
872
+ def __init__(self) -> None:
873
+ """Init."""
662
874
  super().__init__(
663
- attr="reduced_ac_charging", name="Reduced AC Charging", icon="mdi:ev-station", entity_type="config"
875
+ attr="reduced_ac_charging",
876
+ name="Reduced AC Charging",
877
+ icon="mdi:ev-station",
878
+ entity_type="config",
664
879
  )
665
880
 
666
881
  @property
667
882
  def state(self):
883
+ """Return current state."""
668
884
  return self.vehicle.reduced_ac_charging
669
885
 
670
886
  async def turn_on(self):
671
- await self.vehicle.set_charging_settings(setting="reduced_ac_charging", value="reduced")
887
+ """Turn on."""
888
+ await self.vehicle.set_charging_settings(
889
+ setting="reduced_ac_charging", value="reduced"
890
+ )
672
891
  await self.vehicle.update()
673
892
 
674
893
  async def turn_off(self):
675
- await self.vehicle.set_charging_settings(setting="reduced_ac_charging", value="maximum")
894
+ """Turn off."""
895
+ await self.vehicle.set_charging_settings(
896
+ setting="reduced_ac_charging", value="maximum"
897
+ )
676
898
  await self.vehicle.update()
677
899
 
678
900
  @property
@@ -683,11 +905,14 @@ class ReducedACCharging(Switch):
683
905
  @property
684
906
  def attributes(self) -> dict:
685
907
  """Return attributes."""
686
- return dict(last_result=self.vehicle.charger_action_status)
908
+ return {"last_result": self.vehicle.charger_action_status}
687
909
 
688
910
 
689
911
  class AutoReleaseACConnector(Switch):
690
- def __init__(self):
912
+ """Auto-release AC connector."""
913
+
914
+ def __init__(self) -> None:
915
+ """Init."""
691
916
  super().__init__(
692
917
  attr="auto_release_ac_connector",
693
918
  name="Auto-release AC connector",
@@ -697,14 +922,21 @@ class AutoReleaseACConnector(Switch):
697
922
 
698
923
  @property
699
924
  def state(self):
925
+ """Return current state."""
700
926
  return self.vehicle.auto_release_ac_connector
701
927
 
702
928
  async def turn_on(self):
703
- await self.vehicle.set_charging_settings(setting="auto_release_ac_connector", value="permanent")
929
+ """Turn on."""
930
+ await self.vehicle.set_charging_settings(
931
+ setting="auto_release_ac_connector", value="permanent"
932
+ )
704
933
  await self.vehicle.update()
705
934
 
706
935
  async def turn_off(self):
707
- await self.vehicle.set_charging_settings(setting="auto_release_ac_connector", value="off")
936
+ """Turn off."""
937
+ await self.vehicle.set_charging_settings(
938
+ setting="auto_release_ac_connector", value="off"
939
+ )
708
940
  await self.vehicle.update()
709
941
 
710
942
  @property
@@ -714,7 +946,10 @@ class AutoReleaseACConnector(Switch):
714
946
 
715
947
 
716
948
  class BatteryCareMode(Switch):
717
- def __init__(self):
949
+ """Battery care mode."""
950
+
951
+ def __init__(self) -> None:
952
+ """Init."""
718
953
  super().__init__(
719
954
  attr="battery_care_mode",
720
955
  name="Battery care mode",
@@ -724,13 +959,16 @@ class BatteryCareMode(Switch):
724
959
 
725
960
  @property
726
961
  def state(self):
962
+ """Return current state."""
727
963
  return self.vehicle.battery_care_mode
728
964
 
729
965
  async def turn_on(self):
966
+ """Turn on."""
730
967
  await self.vehicle.set_charging_care_settings(value="activated")
731
968
  await self.vehicle.update()
732
969
 
733
970
  async def turn_off(self):
971
+ """Turn off."""
734
972
  await self.vehicle.set_charging_care_settings(value="deactivated")
735
973
  await self.vehicle.update()
736
974
 
@@ -742,11 +980,14 @@ class BatteryCareMode(Switch):
742
980
  @property
743
981
  def attributes(self) -> dict:
744
982
  """Return attributes."""
745
- return dict(last_result=self.vehicle.charger_action_status)
983
+ return {"last_result": self.vehicle.charger_action_status}
746
984
 
747
985
 
748
986
  class OptimisedBatteryUse(Switch):
749
- def __init__(self):
987
+ """Optimised battery use."""
988
+
989
+ def __init__(self) -> None:
990
+ """Init."""
750
991
  super().__init__(
751
992
  attr="optimised_battery_use",
752
993
  name="Optimised battery use",
@@ -756,13 +997,16 @@ class OptimisedBatteryUse(Switch):
756
997
 
757
998
  @property
758
999
  def state(self):
1000
+ """Return current state."""
759
1001
  return self.vehicle.optimised_battery_use
760
1002
 
761
1003
  async def turn_on(self):
1004
+ """Turn on."""
762
1005
  await self.vehicle.set_readiness_battery_support(value=True)
763
1006
  await self.vehicle.update()
764
1007
 
765
1008
  async def turn_off(self):
1009
+ """Turn off."""
766
1010
  await self.vehicle.set_readiness_battery_support(value=False)
767
1011
  await self.vehicle.update()
768
1012
 
@@ -774,20 +1018,25 @@ class OptimisedBatteryUse(Switch):
774
1018
  @property
775
1019
  def attributes(self) -> dict:
776
1020
  """Return attributes."""
777
- return dict(last_result=self.vehicle.charger_action_status)
1021
+ return {"last_result": self.vehicle.charger_action_status}
778
1022
 
779
1023
 
780
1024
  class DepartureTimer(Switch):
781
1025
  """Departure timers."""
782
1026
 
783
- def __init__(self, id: str | int):
1027
+ def __init__(self, id: str | int) -> None:
1028
+ """Init."""
784
1029
  self._id = id
785
1030
  super().__init__(
786
- attr=f"departure_timer{id}", name=f"Departure Timer {id}", icon="mdi:car-clock", entity_type="config"
1031
+ attr=f"departure_timer{id}",
1032
+ name=f"Departure Timer {id}",
1033
+ icon="mdi:car-clock",
1034
+ entity_type="config",
787
1035
  )
788
1036
  self.spin = ""
789
1037
 
790
1038
  def configurate(self, **config):
1039
+ """Configure spin."""
791
1040
  self.spin = config.get("spin", "")
792
1041
 
793
1042
  @property
@@ -797,12 +1046,16 @@ class DepartureTimer(Switch):
797
1046
 
798
1047
  async def turn_on(self):
799
1048
  """Enable timer."""
800
- await self.vehicle.set_departure_timer(timer_id=self._id, spin=self.spin, enable=True)
1049
+ await self.vehicle.set_departure_timer(
1050
+ timer_id=self._id, spin=self.spin, enable=True
1051
+ )
801
1052
  await self.vehicle.update()
802
1053
 
803
1054
  async def turn_off(self):
804
1055
  """Disable timer."""
805
- await self.vehicle.set_departure_timer(timer_id=self._id, spin=self.spin, enable=False)
1056
+ await self.vehicle.set_departure_timer(
1057
+ timer_id=self._id, spin=self.spin, enable=False
1058
+ )
806
1059
  await self.vehicle.update()
807
1060
 
808
1061
  @property
@@ -820,15 +1073,19 @@ class DepartureTimer(Switch):
820
1073
  class ACDepartureTimer(Switch):
821
1074
  """Air conditioning departure timers."""
822
1075
 
823
- def __init__(self, id: str | int):
1076
+ def __init__(self, id: str | int) -> None:
1077
+ """Init."""
824
1078
  self._id = id
825
1079
  super().__init__(
826
- attr=f"ac_departure_timer{id}", name=f"AC Departure Timer {id}", icon="mdi:fan-clock", entity_type="config"
1080
+ attr=f"ac_departure_timer{id}",
1081
+ name=f"AC Departure Timer {id}",
1082
+ icon="mdi:fan-clock",
1083
+ entity_type="config",
827
1084
  )
828
1085
 
829
1086
  @property
830
1087
  def state(self):
831
- """Return switch state."""
1088
+ """Return current state."""
832
1089
  return self.vehicle.ac_departure_timer_enabled(self._id)
833
1090
 
834
1091
  async def turn_on(self):
@@ -854,18 +1111,26 @@ class ACDepartureTimer(Switch):
854
1111
 
855
1112
 
856
1113
  class WindowHeater(Switch):
857
- def __init__(self):
858
- super().__init__(attr="window_heater", name="Window Heater", icon="mdi:car-defrost-rear")
1114
+ """Window Heater."""
1115
+
1116
+ def __init__(self) -> None:
1117
+ """Init."""
1118
+ super().__init__(
1119
+ attr="window_heater", name="Window Heater", icon="mdi:car-defrost-rear"
1120
+ )
859
1121
 
860
1122
  @property
861
1123
  def state(self):
1124
+ """Return current state."""
862
1125
  return self.vehicle.window_heater
863
1126
 
864
1127
  async def turn_on(self):
1128
+ """Turn on."""
865
1129
  await self.vehicle.set_window_heating("start")
866
1130
  await self.vehicle.update()
867
1131
 
868
1132
  async def turn_off(self):
1133
+ """Turn off."""
869
1134
  await self.vehicle.set_window_heating("stop")
870
1135
  await self.vehicle.update()
871
1136
 
@@ -877,11 +1142,14 @@ class WindowHeater(Switch):
877
1142
  @property
878
1143
  def attributes(self) -> dict:
879
1144
  """Return attributes."""
880
- return dict(last_result=self.vehicle.climater_action_status)
1145
+ return {"last_result": self.vehicle.climater_action_status}
881
1146
 
882
1147
 
883
1148
  class BatteryClimatisation(Switch):
884
- def __init__(self):
1149
+ """Climatisation from battery."""
1150
+
1151
+ def __init__(self) -> None:
1152
+ """Init."""
885
1153
  super().__init__(
886
1154
  attr="climatisation_without_external_power",
887
1155
  name="Climatisation from battery",
@@ -891,14 +1159,21 @@ class BatteryClimatisation(Switch):
891
1159
 
892
1160
  @property
893
1161
  def state(self):
1162
+ """Return current state."""
894
1163
  return self.vehicle.climatisation_without_external_power
895
1164
 
896
1165
  async def turn_on(self):
897
- await self.vehicle.set_climatisation_settings(setting="climatisation_without_external_power", value=True)
1166
+ """Turn on."""
1167
+ await self.vehicle.set_climatisation_settings(
1168
+ setting="climatisation_without_external_power", value=True
1169
+ )
898
1170
  await self.vehicle.update()
899
1171
 
900
1172
  async def turn_off(self):
901
- await self.vehicle.set_climatisation_settings(setting="climatisation_without_external_power", value=False)
1173
+ """Turn off."""
1174
+ await self.vehicle.set_climatisation_settings(
1175
+ setting="climatisation_without_external_power", value=False
1176
+ )
902
1177
  await self.vehicle.update()
903
1178
 
904
1179
  @property
@@ -909,11 +1184,14 @@ class BatteryClimatisation(Switch):
909
1184
  @property
910
1185
  def attributes(self) -> dict:
911
1186
  """Return attributes."""
912
- return dict(last_result=self.vehicle.climater_action_status)
1187
+ return {"last_result": self.vehicle.climater_action_status}
913
1188
 
914
1189
 
915
1190
  class AuxiliaryAC(Switch):
916
- def __init__(self):
1191
+ """Auxiliary air conditioning."""
1192
+
1193
+ def __init__(self) -> None:
1194
+ """Init."""
917
1195
  super().__init__(
918
1196
  attr="auxiliary_air_conditioning",
919
1197
  name="Auxiliary air conditioning",
@@ -923,14 +1201,21 @@ class AuxiliaryAC(Switch):
923
1201
 
924
1202
  @property
925
1203
  def state(self):
1204
+ """Return current state."""
926
1205
  return self.vehicle.auxiliary_air_conditioning
927
1206
 
928
1207
  async def turn_on(self):
929
- await self.vehicle.set_climatisation_settings(setting="auxiliary_air_conditioning", value=True)
1208
+ """Turn on."""
1209
+ await self.vehicle.set_climatisation_settings(
1210
+ setting="auxiliary_air_conditioning", value=True
1211
+ )
930
1212
  await self.vehicle.update()
931
1213
 
932
1214
  async def turn_off(self):
933
- await self.vehicle.set_climatisation_settings(setting="auxiliary_air_conditioning", value=False)
1215
+ """Turn off."""
1216
+ await self.vehicle.set_climatisation_settings(
1217
+ setting="auxiliary_air_conditioning", value=False
1218
+ )
934
1219
  await self.vehicle.update()
935
1220
 
936
1221
  @property
@@ -941,11 +1226,14 @@ class AuxiliaryAC(Switch):
941
1226
  @property
942
1227
  def attributes(self) -> dict:
943
1228
  """Return attributes."""
944
- return dict(last_result=self.vehicle.climater_action_status)
1229
+ return {"last_result": self.vehicle.climater_action_status}
945
1230
 
946
1231
 
947
1232
  class AutomaticWindowHeating(Switch):
948
- def __init__(self):
1233
+ """Automatic window heating."""
1234
+
1235
+ def __init__(self) -> None:
1236
+ """Init."""
949
1237
  super().__init__(
950
1238
  attr="automatic_window_heating",
951
1239
  name="Automatic window heating",
@@ -955,14 +1243,21 @@ class AutomaticWindowHeating(Switch):
955
1243
 
956
1244
  @property
957
1245
  def state(self):
1246
+ """Return current state."""
958
1247
  return self.vehicle.automatic_window_heating
959
1248
 
960
1249
  async def turn_on(self):
961
- await self.vehicle.set_climatisation_settings(setting="automatic_window_heating", value=True)
1250
+ """Turn on."""
1251
+ await self.vehicle.set_climatisation_settings(
1252
+ setting="automatic_window_heating", value=True
1253
+ )
962
1254
  await self.vehicle.update()
963
1255
 
964
1256
  async def turn_off(self):
965
- await self.vehicle.set_climatisation_settings(setting="automatic_window_heating", value=False)
1257
+ """Turn off."""
1258
+ await self.vehicle.set_climatisation_settings(
1259
+ setting="automatic_window_heating", value=False
1260
+ )
966
1261
  await self.vehicle.update()
967
1262
 
968
1263
  @property
@@ -973,11 +1268,14 @@ class AutomaticWindowHeating(Switch):
973
1268
  @property
974
1269
  def attributes(self) -> dict:
975
1270
  """Return attributes."""
976
- return dict(last_result=self.vehicle.climater_action_status)
1271
+ return {"last_result": self.vehicle.climater_action_status}
977
1272
 
978
1273
 
979
1274
  class ZoneFrontLeft(Switch):
980
- def __init__(self):
1275
+ """Zone Front Left."""
1276
+
1277
+ def __init__(self) -> None:
1278
+ """Init."""
981
1279
  super().__init__(
982
1280
  attr="zone_front_left",
983
1281
  name="Zone Front Left",
@@ -987,14 +1285,21 @@ class ZoneFrontLeft(Switch):
987
1285
 
988
1286
  @property
989
1287
  def state(self):
1288
+ """Return current state."""
990
1289
  return self.vehicle.zone_front_left
991
1290
 
992
1291
  async def turn_on(self):
993
- await self.vehicle.set_climatisation_settings(setting="zone_front_left", value=True)
1292
+ """Turn on."""
1293
+ await self.vehicle.set_climatisation_settings(
1294
+ setting="zone_front_left", value=True
1295
+ )
994
1296
  await self.vehicle.update()
995
1297
 
996
1298
  async def turn_off(self):
997
- await self.vehicle.set_climatisation_settings(setting="zone_front_left", value=False)
1299
+ """Turn off."""
1300
+ await self.vehicle.set_climatisation_settings(
1301
+ setting="zone_front_left", value=False
1302
+ )
998
1303
  await self.vehicle.update()
999
1304
 
1000
1305
  @property
@@ -1005,11 +1310,14 @@ class ZoneFrontLeft(Switch):
1005
1310
  @property
1006
1311
  def attributes(self) -> dict:
1007
1312
  """Return attributes."""
1008
- return dict(last_result=self.vehicle.climater_action_status)
1313
+ return {"last_result": self.vehicle.climater_action_status}
1009
1314
 
1010
1315
 
1011
1316
  class ZoneFrontRight(Switch):
1012
- def __init__(self):
1317
+ """Zone Front Right."""
1318
+
1319
+ def __init__(self) -> None:
1320
+ """Init."""
1013
1321
  super().__init__(
1014
1322
  attr="zone_front_right",
1015
1323
  name="Zone Front Right",
@@ -1019,14 +1327,21 @@ class ZoneFrontRight(Switch):
1019
1327
 
1020
1328
  @property
1021
1329
  def state(self):
1330
+ """Return current state."""
1022
1331
  return self.vehicle.zone_front_right
1023
1332
 
1024
1333
  async def turn_on(self):
1025
- await self.vehicle.set_climatisation_settings(setting="zone_front_right", value=True)
1334
+ """Turn on."""
1335
+ await self.vehicle.set_climatisation_settings(
1336
+ setting="zone_front_right", value=True
1337
+ )
1026
1338
  await self.vehicle.update()
1027
1339
 
1028
1340
  async def turn_off(self):
1029
- await self.vehicle.set_climatisation_settings(setting="zone_front_right", value=False)
1341
+ """Turn off."""
1342
+ await self.vehicle.set_climatisation_settings(
1343
+ setting="zone_front_right", value=False
1344
+ )
1030
1345
  await self.vehicle.update()
1031
1346
 
1032
1347
  @property
@@ -1037,16 +1352,20 @@ class ZoneFrontRight(Switch):
1037
1352
  @property
1038
1353
  def attributes(self) -> dict:
1039
1354
  """Return attributes."""
1040
- return dict(last_result=self.vehicle.climater_action_status)
1355
+ return {"last_result": self.vehicle.climater_action_status}
1041
1356
 
1042
1357
 
1043
1358
  class RequestResults(Sensor):
1044
1359
  """Request results sensor class."""
1045
1360
 
1046
- def __init__(self):
1361
+ def __init__(self) -> None:
1047
1362
  """Init."""
1048
1363
  super().__init__(
1049
- attr="request_results", name="Request results", icon="mdi:chat-alert", unit="", entity_type="diag"
1364
+ attr="request_results",
1365
+ name="Request results",
1366
+ icon="mdi:chat-alert",
1367
+ unit="",
1368
+ entity_type="diag",
1050
1369
  )
1051
1370
 
1052
1371
  @property
@@ -1076,6 +1395,7 @@ def create_instruments():
1076
1395
  ClimatisationTargetTemperature(),
1077
1396
  DoorLock(),
1078
1397
  TrunkLock(),
1398
+ ChargeMaxACAmpere(),
1079
1399
  RequestUpdate(),
1080
1400
  WindowHeater(),
1081
1401
  BatteryClimatisation(),
@@ -1117,6 +1437,18 @@ def create_instruments():
1117
1437
  icon="mdi:battery-arrow-up",
1118
1438
  unit="%",
1119
1439
  ),
1440
+ Sensor(
1441
+ attr="hv_battery_min_temperature",
1442
+ name="HV battery min temperature",
1443
+ icon="mdi:thermometer-chevron-down",
1444
+ unit=TEMP_CELSIUS,
1445
+ ),
1446
+ Sensor(
1447
+ attr="hv_battery_max_temperature",
1448
+ name="HV battery max temperature",
1449
+ icon="mdi:thermometer-chevron-up",
1450
+ unit=TEMP_CELSIUS,
1451
+ ),
1120
1452
  Sensor(
1121
1453
  attr="adblue_level",
1122
1454
  name="Adblue level",
@@ -1129,6 +1461,12 @@ def create_instruments():
1129
1461
  icon="mdi:fuel",
1130
1462
  unit="%",
1131
1463
  ),
1464
+ Sensor(
1465
+ attr="gas_level",
1466
+ name="Gas level",
1467
+ icon="mdi:gas-cylinder",
1468
+ unit="%",
1469
+ ),
1132
1470
  Sensor(
1133
1471
  attr="service_inspection",
1134
1472
  name="Service inspection days",
@@ -1187,6 +1525,18 @@ def create_instruments():
1187
1525
  icon="mdi:car",
1188
1526
  unit="km",
1189
1527
  ),
1528
+ Sensor(
1529
+ attr="fuel_range",
1530
+ name="Fuel range",
1531
+ icon="mdi:car",
1532
+ unit="km",
1533
+ ),
1534
+ Sensor(
1535
+ attr="gas_range",
1536
+ name="Gas range",
1537
+ icon="mdi:car",
1538
+ unit="km",
1539
+ ),
1190
1540
  Sensor(
1191
1541
  attr="combined_range",
1192
1542
  name="Combined range",
@@ -1258,6 +1608,13 @@ def create_instruments():
1258
1608
  unit="l/100 km",
1259
1609
  state_class=VWStateClass.MEASUREMENT,
1260
1610
  ),
1611
+ Sensor(
1612
+ attr="trip_last_average_gas_consumption",
1613
+ name="Last trip average gas consumption",
1614
+ icon="mdi:gas-cylinder",
1615
+ unit="m3/100km",
1616
+ state_class=VWStateClass.MEASUREMENT,
1617
+ ),
1261
1618
  Sensor(
1262
1619
  attr="trip_last_duration",
1263
1620
  name="Last trip duration",
@@ -1381,14 +1738,31 @@ def create_instruments():
1381
1738
  device_class=VWDeviceClass.TIMESTAMP,
1382
1739
  entity_type="diag",
1383
1740
  ),
1384
- BinarySensor(attr="external_power", name="External power", device_class=VWDeviceClass.POWER),
1385
- BinarySensor(attr="energy_flow", name="Energy flow", device_class=VWDeviceClass.POWER),
1386
1741
  BinarySensor(
1387
- attr="parking_light", name="Parking light", device_class=VWDeviceClass.LIGHT, icon="mdi:car-parking-lights"
1742
+ attr="external_power",
1743
+ name="External power",
1744
+ device_class=VWDeviceClass.POWER,
1388
1745
  ),
1389
- BinarySensor(attr="door_locked", name="Doors locked", device_class=VWDeviceClass.LOCK, reverse_state=True),
1390
1746
  BinarySensor(
1391
- attr="door_locked_sensor", name="Doors locked", device_class=VWDeviceClass.LOCK, reverse_state=True
1747
+ attr="energy_flow", name="Energy flow", device_class=VWDeviceClass.POWER
1748
+ ),
1749
+ BinarySensor(
1750
+ attr="parking_light",
1751
+ name="Parking light",
1752
+ device_class=VWDeviceClass.LIGHT,
1753
+ icon="mdi:car-parking-lights",
1754
+ ),
1755
+ BinarySensor(
1756
+ attr="door_locked",
1757
+ name="Doors locked",
1758
+ device_class=VWDeviceClass.LOCK,
1759
+ reverse_state=True,
1760
+ ),
1761
+ BinarySensor(
1762
+ attr="door_locked_sensor",
1763
+ name="Doors locked",
1764
+ device_class=VWDeviceClass.LOCK,
1765
+ reverse_state=True,
1392
1766
  ),
1393
1767
  BinarySensor(
1394
1768
  attr="door_closed_left_front",
@@ -1418,12 +1792,30 @@ def create_instruments():
1418
1792
  reverse_state=True,
1419
1793
  icon="mdi:car-door",
1420
1794
  ),
1421
- BinarySensor(attr="trunk_locked", name="Trunk locked", device_class=VWDeviceClass.LOCK, reverse_state=True),
1422
1795
  BinarySensor(
1423
- attr="trunk_locked_sensor", name="Trunk locked", device_class=VWDeviceClass.LOCK, reverse_state=True
1796
+ attr="trunk_locked",
1797
+ name="Trunk locked",
1798
+ device_class=VWDeviceClass.LOCK,
1799
+ reverse_state=True,
1800
+ ),
1801
+ BinarySensor(
1802
+ attr="trunk_locked_sensor",
1803
+ name="Trunk locked",
1804
+ device_class=VWDeviceClass.LOCK,
1805
+ reverse_state=True,
1806
+ ),
1807
+ BinarySensor(
1808
+ attr="trunk_closed",
1809
+ name="Trunk closed",
1810
+ device_class=VWDeviceClass.DOOR,
1811
+ reverse_state=True,
1812
+ ),
1813
+ BinarySensor(
1814
+ attr="hood_closed",
1815
+ name="Hood closed",
1816
+ device_class=VWDeviceClass.DOOR,
1817
+ reverse_state=True,
1424
1818
  ),
1425
- BinarySensor(attr="trunk_closed", name="Trunk closed", device_class=VWDeviceClass.DOOR, reverse_state=True),
1426
- BinarySensor(attr="hood_closed", name="Hood closed", device_class=VWDeviceClass.DOOR, reverse_state=True),
1427
1819
  BinarySensor(
1428
1820
  attr="charging_cable_connected",
1429
1821
  name="Charging cable connected",
@@ -1437,7 +1829,10 @@ def create_instruments():
1437
1829
  reverse_state=True,
1438
1830
  ),
1439
1831
  BinarySensor(
1440
- attr="sunroof_closed", name="Sunroof closed", device_class=VWDeviceClass.WINDOW, reverse_state=True
1832
+ attr="sunroof_closed",
1833
+ name="Sunroof closed",
1834
+ device_class=VWDeviceClass.WINDOW,
1835
+ reverse_state=True,
1441
1836
  ),
1442
1837
  BinarySensor(
1443
1838
  attr="sunroof_rear_closed",
@@ -1446,10 +1841,16 @@ def create_instruments():
1446
1841
  reverse_state=True,
1447
1842
  ),
1448
1843
  BinarySensor(
1449
- attr="roof_cover_closed", name="Roof cover closed", device_class=VWDeviceClass.WINDOW, reverse_state=True
1844
+ attr="roof_cover_closed",
1845
+ name="Roof cover closed",
1846
+ device_class=VWDeviceClass.WINDOW,
1847
+ reverse_state=True,
1450
1848
  ),
1451
1849
  BinarySensor(
1452
- attr="windows_closed", name="Windows closed", device_class=VWDeviceClass.WINDOW, reverse_state=True
1850
+ attr="windows_closed",
1851
+ name="Windows closed",
1852
+ device_class=VWDeviceClass.WINDOW,
1853
+ reverse_state=True,
1453
1854
  ),
1454
1855
  BinarySensor(
1455
1856
  attr="window_closed_left_front",
@@ -1475,7 +1876,11 @@ def create_instruments():
1475
1876
  device_class=VWDeviceClass.WINDOW,
1476
1877
  reverse_state=True,
1477
1878
  ),
1478
- BinarySensor(attr="vehicle_moving", name="Vehicle Moving", device_class=VWDeviceClass.MOVING),
1879
+ BinarySensor(
1880
+ attr="vehicle_moving",
1881
+ name="Vehicle Moving",
1882
+ device_class=VWDeviceClass.MOVING,
1883
+ ),
1479
1884
  BinarySensor(
1480
1885
  attr="request_in_progress",
1481
1886
  name="Request in progress",
@@ -1488,7 +1893,11 @@ def create_instruments():
1488
1893
  class Dashboard:
1489
1894
  """Helper for accessing the instruments."""
1490
1895
 
1491
- def __init__(self, vehicle, **config):
1896
+ def __init__(self, vehicle, **config) -> None:
1492
1897
  """Initialize instruments."""
1493
1898
  _LOGGER.debug("Setting up dashboard with config :%s", config)
1494
- self.instruments = [instrument for instrument in create_instruments() if instrument.setup(vehicle, **config)]
1899
+ self.instruments = [
1900
+ instrument
1901
+ for instrument in create_instruments()
1902
+ if instrument.setup(vehicle, **config)
1903
+ ]