carconnectivity-connector-skoda 0.1a14__py3-none-any.whl → 0.1a16__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 carconnectivity-connector-skoda might be problematic. Click here for more details.
- {carconnectivity_connector_skoda-0.1a14.dist-info → carconnectivity_connector_skoda-0.1a16.dist-info}/METADATA +1 -1
- {carconnectivity_connector_skoda-0.1a14.dist-info → carconnectivity_connector_skoda-0.1a16.dist-info}/RECORD +7 -7
- carconnectivity_connectors/skoda/_version.py +1 -1
- carconnectivity_connectors/skoda/mqtt_client.py +23 -15
- {carconnectivity_connector_skoda-0.1a14.dist-info → carconnectivity_connector_skoda-0.1a16.dist-info}/LICENSE +0 -0
- {carconnectivity_connector_skoda-0.1a14.dist-info → carconnectivity_connector_skoda-0.1a16.dist-info}/WHEEL +0 -0
- {carconnectivity_connector_skoda-0.1a14.dist-info → carconnectivity_connector_skoda-0.1a16.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
carconnectivity_connectors/skoda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
carconnectivity_connectors/skoda/_version.py,sha256=
|
|
2
|
+
carconnectivity_connectors/skoda/_version.py,sha256=LeuZd6pXKHm5v3Vw2uukD5XI4CMyRN-RUKKU0F28l_o,409
|
|
3
3
|
carconnectivity_connectors/skoda/capability.py,sha256=JlNEaisVYF8qWv0wNDHTaas36uIpTIQ3NVR69wesiYQ,4513
|
|
4
4
|
carconnectivity_connectors/skoda/charging.py,sha256=oDHxZxrfTMvtYCJxmGfKFeWVMH4ceQ5HTKRAspnsunU,3312
|
|
5
5
|
carconnectivity_connectors/skoda/connector.py,sha256=Z7CZclSC8lg0Rc5Zf2Vp9ATgXxACq_aTpxJxfe2EEsw,69140
|
|
6
|
-
carconnectivity_connectors/skoda/mqtt_client.py,sha256=
|
|
6
|
+
carconnectivity_connectors/skoda/mqtt_client.py,sha256=PagzfwuNzokoxAQRsTR5VG81PecfCqmXUvwzVjKq6ps,32827
|
|
7
7
|
carconnectivity_connectors/skoda/vehicle.py,sha256=H3GRDNimMghFwFi--y9BsgoSK3pMibNf_l6SsDN6gvQ,2759
|
|
8
8
|
carconnectivity_connectors/skoda/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
carconnectivity_connectors/skoda/auth/auth_util.py,sha256=dGLUbUre0HBsTg_Ii5vW34f8DLrCykYJYCyzEvUBBEE,4434
|
|
@@ -12,8 +12,8 @@ carconnectivity_connectors/skoda/auth/openid_session.py,sha256=LusWi2FZZIL3buodG
|
|
|
12
12
|
carconnectivity_connectors/skoda/auth/session_manager.py,sha256=Uf1vujuDBYUCAXhYToOsZkgbTtfmY3Qe0ICTfwomBpI,2899
|
|
13
13
|
carconnectivity_connectors/skoda/auth/skoda_web_session.py,sha256=cjzMkzx473Sh-4RgZAQULeRRcxB1MboddldCVM_y5LE,10640
|
|
14
14
|
carconnectivity_connectors/skoda/auth/helpers/blacklist_retry.py,sha256=f3wsiY5bpHDBxp7Va1Mv9nKJ4u3qnCHZZmDu78_AhMk,1251
|
|
15
|
-
carconnectivity_connector_skoda-0.
|
|
16
|
-
carconnectivity_connector_skoda-0.
|
|
17
|
-
carconnectivity_connector_skoda-0.
|
|
18
|
-
carconnectivity_connector_skoda-0.
|
|
19
|
-
carconnectivity_connector_skoda-0.
|
|
15
|
+
carconnectivity_connector_skoda-0.1a16.dist-info/LICENSE,sha256=PIwI1alwDyOfvEQHdGCm2u9uf_mGE8030xZDfun0xTo,1071
|
|
16
|
+
carconnectivity_connector_skoda-0.1a16.dist-info/METADATA,sha256=t59NIBY3db87uD_rdDN7DYKgG0eudYsAmA1n0t4j6SY,5327
|
|
17
|
+
carconnectivity_connector_skoda-0.1a16.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
18
|
+
carconnectivity_connector_skoda-0.1a16.dist-info/top_level.txt,sha256=KqA8GviZsDH4PtmnwSQsz0HB_w-TWkeEHLIRNo5dTaI,27
|
|
19
|
+
carconnectivity_connector_skoda-0.1a16.dist-info/RECORD,,
|
|
@@ -21,18 +21,26 @@ from carconnectivity.drive import ElectricDrive
|
|
|
21
21
|
from carconnectivity.util import robust_time_parse, log_extra_keys
|
|
22
22
|
from carconnectivity.charging import Charging
|
|
23
23
|
from carconnectivity.climatization import Climatization
|
|
24
|
+
from carconnectivity.units import Speed, Power
|
|
24
25
|
|
|
25
26
|
from carconnectivity_connectors.skoda.vehicle import SkodaVehicle, SkodaElectricVehicle
|
|
26
27
|
from carconnectivity_connectors.skoda.charging import SkodaCharging, mapping_skoda_charging_state
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
if TYPE_CHECKING:
|
|
30
|
-
from typing import Set, Dict, Any, Optional
|
|
31
|
+
from typing import Set, Dict, Any, Optional, List
|
|
31
32
|
from datetime import datetime
|
|
32
33
|
|
|
34
|
+
from paho.mqtt.client import MQTTMessage, DisconnectFlags, ConnectFlags
|
|
35
|
+
from paho.mqtt.reasoncodes import ReasonCode
|
|
36
|
+
from paho.mqtt.properties import Properties
|
|
37
|
+
|
|
38
|
+
from carconnectivity.attributes import GenericAttribute
|
|
39
|
+
|
|
33
40
|
from carconnectivity_connectors.skoda.connector import Connector
|
|
34
41
|
|
|
35
42
|
|
|
43
|
+
|
|
36
44
|
LOG: logging.Logger = logging.getLogger("carconnectivity.connectors.skoda.mqtt")
|
|
37
45
|
LOG_API: logging.Logger = logging.getLogger("carconnectivity.connectors.skoda-api-debug")
|
|
38
46
|
|
|
@@ -72,7 +80,7 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
72
80
|
"""
|
|
73
81
|
return super().connect(*args, host='mqtt.messagehub.de', port=8883, keepalive=60, **kwargs)
|
|
74
82
|
|
|
75
|
-
def _on_pre_connect_callback(self, client, userdata) -> None:
|
|
83
|
+
def _on_pre_connect_callback(self, client: Client, userdata: Any) -> None:
|
|
76
84
|
"""
|
|
77
85
|
Callback function that is called before the MQTT client connects to the broker.
|
|
78
86
|
|
|
@@ -94,7 +102,7 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
94
102
|
# pylint: disable-next=attribute-defined-outside-init # this is a false positive, password has a setter in super class
|
|
95
103
|
self._password = self._skoda_connector.session.access_token # This is a bit hacky but if password attribute is used here there is an Exception
|
|
96
104
|
|
|
97
|
-
def _on_carconnectivity_vehicle_enabled(self, element, flags):
|
|
105
|
+
def _on_carconnectivity_vehicle_enabled(self, element: GenericAttribute, flags: Observable.ObserverEvent) -> None:
|
|
98
106
|
"""
|
|
99
107
|
Handles the event when a vehicle is enabled or disabled in the car connectivity system.
|
|
100
108
|
|
|
@@ -252,7 +260,7 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
252
260
|
self.subscribed_topics.remove(topic)
|
|
253
261
|
LOG.debug('Unsubscribed from topic %s', topic)
|
|
254
262
|
|
|
255
|
-
def _on_connect_callback(self,
|
|
263
|
+
def _on_connect_callback(self, client: Client, obj: Any, flags: ConnectFlags, reason_code: ReasonCode, properties: Optional[Properties]) -> None:
|
|
256
264
|
"""
|
|
257
265
|
Callback function that is called when the MQTT client connects to the broker.
|
|
258
266
|
|
|
@@ -293,7 +301,7 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
293
301
|
- 159: Connection rate exceeded.
|
|
294
302
|
- Other: Generic connection error.
|
|
295
303
|
"""
|
|
296
|
-
del
|
|
304
|
+
del client # unused
|
|
297
305
|
del obj # unused
|
|
298
306
|
del flags # unused
|
|
299
307
|
del properties
|
|
@@ -351,8 +359,8 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
351
359
|
else:
|
|
352
360
|
LOG.error('Could not connect (%s)', reason_code)
|
|
353
361
|
|
|
354
|
-
def _on_disconnect_callback(self, client, userdata, flags, reason_code, properties) -> None:
|
|
355
|
-
"""
|
|
362
|
+
def _on_disconnect_callback(self, client: Client, userdata, flags: DisconnectFlags, reason_code: ReasonCode, properties: Optional[Properties]) -> None:
|
|
363
|
+
"""["Client", Any, DisconnectFlags, ReasonCode, Union[Properties, None]
|
|
356
364
|
Callback function that is called when the MQTT client disconnects.
|
|
357
365
|
|
|
358
366
|
This function handles the disconnection of the MQTT client and logs the appropriate
|
|
@@ -391,9 +399,9 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
391
399
|
elif reason_code == 160:
|
|
392
400
|
LOG.error('Client disconnected: Maximum connect time')
|
|
393
401
|
else:
|
|
394
|
-
LOG.error('Client unexpectedly disconnected (%d: %s), trying to reconnect', reason_code, reason_code)
|
|
402
|
+
LOG.error('Client unexpectedly disconnected (%d: %s), trying to reconnect', reason_code.value, reason_code.getName())
|
|
395
403
|
|
|
396
|
-
def _on_subscribe_callback(self,
|
|
404
|
+
def _on_subscribe_callback(self, client: Client, obj: Any, mid: int, reason_codes: List[ReasonCode], properties: Optional[Properties]) -> None:
|
|
397
405
|
"""
|
|
398
406
|
Callback function for MQTT subscription.
|
|
399
407
|
|
|
@@ -410,15 +418,15 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
410
418
|
Returns:
|
|
411
419
|
None
|
|
412
420
|
"""
|
|
413
|
-
del
|
|
421
|
+
del client # unused
|
|
414
422
|
del obj # unused
|
|
415
423
|
del properties # unused
|
|
416
424
|
if any(x in [0, 1, 2] for x in reason_codes):
|
|
417
425
|
LOG.debug('sucessfully subscribed to topic of mid %d', mid)
|
|
418
426
|
else:
|
|
419
|
-
LOG.error('Subscribe was not successfull (%s)', ', '.join(reason_codes))
|
|
427
|
+
LOG.error('Subscribe was not successfull (%s)', ', '.join([reason_code.getName() for reason_code in reason_codes]))
|
|
420
428
|
|
|
421
|
-
def _on_message_callback(self,
|
|
429
|
+
def _on_message_callback(self, client: Client, obj: Any, msg: MQTTMessage) -> None: # noqa: C901
|
|
422
430
|
"""
|
|
423
431
|
Callback function for handling incoming MQTT messages.
|
|
424
432
|
|
|
@@ -434,7 +442,7 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
434
442
|
Returns:
|
|
435
443
|
None
|
|
436
444
|
"""
|
|
437
|
-
del
|
|
445
|
+
del client # unused
|
|
438
446
|
del obj # unused
|
|
439
447
|
if len(msg.payload) == 0:
|
|
440
448
|
LOG_API.debug('MQTT topic %s: ignoring empty message', msg.topic)
|
|
@@ -474,9 +482,9 @@ class SkodaMQTTClient(Client): # pylint: disable=too-many-instance-attributes
|
|
|
474
482
|
# pylint: disable-next=protected-access
|
|
475
483
|
vehicle.charging.type._set_value(value=Charging.ChargingType.OFF, measured=measured_at)
|
|
476
484
|
# pylint: disable-next=protected-access
|
|
477
|
-
vehicle.charging.rate._set_value(value=0, measured=measured_at)
|
|
485
|
+
vehicle.charging.rate._set_value(value=0, measured=measured_at, unit=Speed.KMH)
|
|
478
486
|
# pylint: disable-next=protected-access
|
|
479
|
-
vehicle.charging.power._set_value(value=0, measured=measured_at)
|
|
487
|
+
vehicle.charging.power._set_value(value=0, measured=measured_at, unit=Power.KW)
|
|
480
488
|
if 'soc' in data['data'] and data['data']['soc'] is not None:
|
|
481
489
|
electric_drive.level._set_value(measured=measured_at, value=data['data']['soc']) # pylint: disable=protected-access
|
|
482
490
|
if 'chargedRange' in data['data'] and data['data']['chargedRange'] is not None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|