Skip to content

Commit 9e48a72

Browse files
committed
Run poetry update
1 parent 65800d5 commit 9e48a72

File tree

4 files changed

+46
-42
lines changed

4 files changed

+46
-42
lines changed

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ classifiers = [
1616

1717
requires-python = '>=3.12,<4.0'
1818
dependencies = [
19-
"saic-ismart-client-ng (>=0.8.0,<0.9.0)",
19+
"saic-ismart-client-ng (>=0.8.1,<0.9.0)",
2020
'httpx (>=0.28.1,<0.29.0)',
2121
'gmqtt (>=0.7.0,<0.8.0)',
2222
'inflection (>=0.5.1,<0.6.0)',

src/integrations/abrp/api.py

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,29 @@ def __init__(self, msg: str) -> None:
2828
class AbrpApiListener(ABC):
2929
@abstractmethod
3030
async def on_request(
31-
self,
32-
path: str,
33-
body: str | None = None,
34-
headers: dict[str, str] | None = None,
31+
self,
32+
path: str,
33+
body: str | None = None,
34+
headers: dict[str, str] | None = None,
3535
) -> None:
3636
pass
3737

3838
@abstractmethod
3939
async def on_response(
40-
self,
41-
path: str,
42-
body: str | None = None,
43-
headers: dict[str, str] | None = None,
40+
self,
41+
path: str,
42+
body: str | None = None,
43+
headers: dict[str, str] | None = None,
4444
) -> None:
4545
pass
4646

4747

4848
class AbrpApi:
4949
def __init__(
50-
self,
51-
abrp_api_key: str | None,
52-
abrp_user_token: str | None,
53-
listener: AbrpApiListener | None = None,
50+
self,
51+
abrp_api_key: str | None,
52+
abrp_user_token: str | None,
53+
listener: AbrpApiListener | None = None,
5454
) -> None:
5555
self.abrp_api_key = abrp_api_key
5656
self.abrp_user_token = abrp_user_token
@@ -64,18 +64,18 @@ def __init__(
6464
)
6565

6666
async def update_abrp(
67-
self,
68-
vehicle_status: VehicleStatusResp | None,
69-
charge_info: ChrgMgmtDataResp | None,
67+
self,
68+
vehicle_status: VehicleStatusResp | None,
69+
charge_info: ChrgMgmtDataResp | None,
7070
) -> tuple[bool, str]:
7171
charge_mgmt_data = None if charge_info is None else charge_info.chrgMgmtData
7272
charge_status = None if charge_info is None else charge_info.rvsChargeStatus
7373

7474
if (
75-
self.abrp_api_key is not None
76-
and self.abrp_user_token is not None
77-
and vehicle_status is not None
78-
and charge_mgmt_data is not None
75+
self.abrp_api_key is not None
76+
and self.abrp_user_token is not None
77+
and vehicle_status is not None
78+
and charge_mgmt_data is not None
7979
):
8080
# Request
8181
tlm_send_url = f"{self.__base_uri}tlm/send"
@@ -91,19 +91,18 @@ async def update_abrp(
9191
)
9292

9393
# Skip invalid current values reported by the API
94+
decoded_current = charge_mgmt_data.decoded_current
9495
is_valid_current = (
95-
charge_mgmt_data.bmsPackCrntV != 1
96-
and (raw_current := charge_mgmt_data.bmsPackCrnt) is not None
97-
and value_in_range(raw_current, 0, 65535)
96+
charge_mgmt_data.bmsPackCrntV != 1
97+
and (raw_current := charge_mgmt_data.bmsPackCrnt) is not None
98+
and value_in_range(raw_current, 0, 65535)
99+
and decoded_current is not None
98100
)
99101
if is_valid_current:
100102
is_charging = (
101-
charge_status is not None
102-
and charge_status.chargingGunState
103-
and is_valid_current
104-
and (decoded_current := charge_mgmt_data.decoded_current)
105-
is not None
106-
and decoded_current < 0.0
103+
charge_status is not None
104+
and charge_status.chargingGunState
105+
and decoded_current < 0.0
107106
)
108107
data.update(
109108
{
@@ -154,15 +153,15 @@ async def update_abrp(
154153

155154
@staticmethod
156155
def __extract_basic_vehicle_status(
157-
basic_vehicle_status: BasicVehicleStatus,
156+
basic_vehicle_status: BasicVehicleStatus,
158157
) -> dict[str, Any]:
159158
data: dict[str, Any] = {
160159
"is_parked": basic_vehicle_status.is_parked,
161160
}
162161

163162
exterior_temperature = basic_vehicle_status.exteriorTemperature
164163
if exterior_temperature is not None and value_in_range(
165-
exterior_temperature, -127, 127
164+
exterior_temperature, -127, 127
166165
):
167166
data["ext_temp"] = exterior_temperature
168167
mileage = basic_vehicle_status.mileage
@@ -206,7 +205,7 @@ def __extract_gps_position(gps_position: GpsPosition) -> dict[str, Any]:
206205
data["elevation"] = altitude
207206

208207
if (raw_lat := position.latitude) is not None and (
209-
raw_lon := position.longitude
208+
raw_lon := position.longitude
210209
) is not None:
211210
lat_degrees = raw_lat / 1000000.0
212211
lon_degrees = raw_lon / 1000000.0
@@ -222,16 +221,16 @@ def __extract_gps_position(gps_position: GpsPosition) -> dict[str, Any]:
222221
return data
223222

224223
def __extract_electric_range(
225-
self,
226-
basic_vehicle_status: BasicVehicleStatus | None,
227-
charge_status: RvsChargeStatus | None,
224+
self,
225+
basic_vehicle_status: BasicVehicleStatus | None,
226+
charge_status: RvsChargeStatus | None,
228227
) -> dict[str, Any]:
229228
data = {}
230229

231230
range_elec_vehicle = 0.0
232231
if (
233-
basic_vehicle_status
234-
and (fuel_range := basic_vehicle_status.fuelRangeElec) is not None
232+
basic_vehicle_status
233+
and (fuel_range := basic_vehicle_status.fuelRangeElec) is not None
235234
):
236235
range_elec_vehicle = self.__parse_electric_range(raw_value=fuel_range)
237236

src/mqtt_gateway.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ async def run(self) -> None:
102102
name="Check for new messages",
103103
max_instances=1,
104104
)
105+
LOG.info("Connecting to MQTT Broker")
105106
await self.publisher.connect()
107+
108+
LOG.info("Starting scheduler")
106109
self.__scheduler.start()
110+
111+
LOG.info("Entering main loop")
107112
await self.__main_loop()
108113

109114
async def setup_vehicle(
@@ -225,7 +230,7 @@ def get_charging_station(self, vin: str) -> ChargingStation | None:
225230
async def __main_loop(self) -> None:
226231
tasks = []
227232
for key, vh in self.vehicle_handlers.items():
228-
LOG.debug(f"Starting process for car {key}")
233+
LOG.info(f"Starting process for car {key}")
229234
task = asyncio.create_task(
230235
vh.handle_vehicle(), name=f"handle_vehicle_{key}"
231236
)

0 commit comments

Comments
 (0)