Skip to content

Commit

Permalink
feat: add "Wiper Health" sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
philippwaller committed Oct 2, 2024
1 parent 9052eab commit 5da117d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ Depends on your own car or purchased Mercedes Benz licenses.

- chargeFlapACStatus

- wiperHealth

```
attributes:
wiperLifetimeExceeded [EXPERIMENTAL, user feedback wanted]
```

### Device Tracker

```
Expand Down
8 changes: 8 additions & 0 deletions custom_components/mbapi2020/car.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
"auxheattime3",
]

WIPER_OPTIONS = ["wiperLifetimeExceeded", "wiperHealthPercent"]

PRE_COND_OPTIONS = ["preconditionState", "precondimmediate"]

RemoteStart_OPTIONS = ["remoteEngine", "remoteStartEndtime", "remoteStartTemperature"]
Expand Down Expand Up @@ -217,6 +219,7 @@ def __init__(self, vin: str):

self.binarysensors = None
self.tires = None
self.wipers = None
self.odometer = None
self.doors = None
self.location = None
Expand Down Expand Up @@ -287,6 +290,11 @@ class Tires:

name: str = "Tires"

@dataclass(init=False)
class Wipers:
"""Stores the Wiper values at runtime."""

name: str = "Wipers"

@dataclass(init=False)
class Odometer:
Expand Down
10 changes: 10 additions & 0 deletions custom_components/mbapi2020/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
ODOMETER_OPTIONS,
TIRE_OPTIONS,
WINDOW_OPTIONS,
WIPER_OPTIONS,
Auxheat,
BinarySensors,
Car,
Expand All @@ -42,6 +43,7 @@
Odometer,
Tires,
Windows,
Wipers,
)
from .const import (
CONF_DEBUG_FILE_SAVE,
Expand Down Expand Up @@ -301,6 +303,14 @@ def _build_car(self, received_car_data, update_mode):
update_mode,
)

car.wipers = self._get_car_values(
received_car_data,
car.finorvin,
Wipers() if not car.wipers else car.wipers,
WIPER_OPTIONS,
update_mode,
)

car.doors = self._get_car_values(
received_car_data,
car.finorvin,
Expand Down
17 changes: 17 additions & 0 deletions custom_components/mbapi2020/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,23 @@
None,
None,
],
"wiperHealthPercent": [
"Wiper Health",
None, # Deprecated: DO NOT USE
"wipers",
"wiperHealthPercent",
"value",
None,
{
"wiperLifetimeExceeded",
},
"mdi:wiper",
None,
False,
None,
None,
None,
],
}

LOCKS = {
Expand Down

0 comments on commit 5da117d

Please # to comment.