pycupra 0.0.2__py3-none-any.whl → 0.0.3__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.
pycupra/__version__.py CHANGED
@@ -3,4 +3,4 @@ pycupra - A Python 3 library for interacting with the My Cupra/My Seat portal.
3
3
 
4
4
  For more details and documentation, visit the github page at https://github.com/WulfgarW/pycupra
5
5
  """
6
- __version__ = "0.0.2"
6
+ __version__ = "0.0.3"
pycupra/dashboard.py CHANGED
@@ -86,10 +86,10 @@ class Sensor(Instrument):
86
86
  elif "km/h" == self.unit:
87
87
  self.unit = "mi/h"
88
88
  self.convert = True
89
- elif "l/100 km" == self.unit:
89
+ elif "l/100km" == self.unit:
90
90
  self.unit = "l/100 mi"
91
91
  self.convert = True
92
- elif "kWh/100 km" == self.unit:
92
+ elif "kWh/100km" == self.unit:
93
93
  self.unit = "kWh/100 mi"
94
94
  self.convert = True
95
95
  elif self.unit and config.get('scandinavian_miles', False) is True:
@@ -97,9 +97,9 @@ class Sensor(Instrument):
97
97
  self.unit = "mil"
98
98
  elif "km/h" == self.unit:
99
99
  self.unit = "mil/h"
100
- elif "l/100 km" == self.unit:
100
+ elif "l/100km" == self.unit:
101
101
  self.unit = "l/100 mil"
102
- elif "kWh/100 km" == self.unit:
102
+ elif "kWh/100km" == self.unit:
103
103
  self.unit = "kWh/100 mil"
104
104
 
105
105
  # Init placeholder for parking heater duration
@@ -843,6 +843,7 @@ def create_instruments():
843
843
  name="Odometer",
844
844
  icon="mdi:speedometer",
845
845
  unit="km",
846
+ device_class="distance"
846
847
  ),
847
848
  Sensor(
848
849
  attr="battery_level",
@@ -863,6 +864,7 @@ def create_instruments():
863
864
  name="Adblue level",
864
865
  icon="mdi:fuel",
865
866
  unit="km",
867
+ device_class="distance"
866
868
  ),
867
869
  Sensor(
868
870
  attr="fuel_level",
@@ -881,6 +883,7 @@ def create_instruments():
881
883
  name="Service inspection distance",
882
884
  icon="mdi:garage",
883
885
  unit="km",
886
+ device_class="distance"
884
887
  ),
885
888
  Sensor(
886
889
  attr="oil_inspection",
@@ -893,6 +896,7 @@ def create_instruments():
893
896
  name="Oil inspection distance",
894
897
  icon="mdi:oil",
895
898
  unit="km",
899
+ device_class="distance"
896
900
  ),
897
901
  Sensor(
898
902
  attr="last_connected",
@@ -910,7 +914,8 @@ def create_instruments():
910
914
  attr="charging_time_left",
911
915
  name="Charging time left",
912
916
  icon="mdi:battery-charging-100",
913
- unit="h",
917
+ unit="min",
918
+ device_class="duration"
914
919
  ),
915
920
  Sensor(
916
921
  attr="charging_power",
@@ -923,25 +928,29 @@ def create_instruments():
923
928
  attr="charge_rate",
924
929
  name="Charging rate",
925
930
  icon="mdi:battery-heart",
926
- unit="km/h"
931
+ unit="km/h",
932
+ device_class="speed"
927
933
  ),
928
934
  Sensor(
929
935
  attr="electric_range",
930
936
  name="Electric range",
931
937
  icon="mdi:car-electric",
932
938
  unit="km",
939
+ device_class="distance"
933
940
  ),
934
941
  Sensor(
935
942
  attr="combustion_range",
936
943
  name="Combustion range",
937
944
  icon="mdi:car",
938
945
  unit="km",
946
+ device_class="distance"
939
947
  ),
940
948
  Sensor(
941
949
  attr="combined_range",
942
950
  name="Combined range",
943
951
  icon="mdi:car",
944
952
  unit="km",
953
+ device_class="distance"
945
954
  ),
946
955
  Sensor(
947
956
  attr="charge_max_ampere",
@@ -962,126 +971,145 @@ def create_instruments():
962
971
  name="Climatisation time left",
963
972
  icon="mdi:clock",
964
973
  unit="h",
974
+ device_class="duration"
965
975
  ),
966
976
  Sensor(
967
977
  attr="trip_last_average_speed",
968
978
  name="Last trip average speed",
969
979
  icon="mdi:speedometer",
970
980
  unit="km/h",
981
+ device_class="speed"
971
982
  ),
972
983
  Sensor(
973
984
  attr="trip_last_average_electric_consumption",
974
985
  name="Last trip average electric consumption",
975
986
  icon="mdi:car-battery",
976
- unit="kWh/100 km",
987
+ unit="kWh/100km",
988
+ device_class="energy_distance"
977
989
  ),
978
990
  Sensor(
979
991
  attr="trip_last_average_fuel_consumption",
980
992
  name="Last trip average fuel consumption",
981
993
  icon="mdi:fuel",
982
- unit="l/100 km",
994
+ unit="l/100km",
983
995
  ),
984
996
  Sensor(
985
997
  attr="trip_last_duration",
986
998
  name="Last trip duration",
987
999
  icon="mdi:clock",
988
1000
  unit="min",
1001
+ device_class="duration"
989
1002
  ),
990
1003
  Sensor(
991
1004
  attr="trip_last_length",
992
1005
  name="Last trip length",
993
1006
  icon="mdi:map-marker-distance",
994
1007
  unit="km",
1008
+ device_class="distance"
995
1009
  ),
996
1010
  Sensor(
997
1011
  attr="trip_last_recuperation",
998
1012
  name="Last trip recuperation",
999
1013
  icon="mdi:battery-plus",
1000
- unit="kWh/100 km",
1014
+ unit="kWh/100km",
1015
+ device_class="energy_distance"
1001
1016
  ),
1002
1017
  Sensor(
1003
1018
  attr="trip_last_average_recuperation",
1004
1019
  name="Last trip average recuperation",
1005
1020
  icon="mdi:battery-plus",
1006
- unit="kWh/100 km",
1021
+ unit="kWh/100km",
1022
+ device_class="energy_distance"
1007
1023
  ),
1008
1024
  Sensor(
1009
1025
  attr="trip_last_average_auxillary_consumption",
1010
1026
  name="Last trip average auxillary consumption",
1011
1027
  icon="mdi:flash",
1012
- unit="kWh/100 km",
1028
+ unit="kWh/100km",
1029
+ device_class="energy_distance"
1013
1030
  ),
1014
1031
  Sensor(
1015
1032
  attr="trip_last_average_aux_consumer_consumption",
1016
1033
  name="Last trip average auxillary consumer consumption",
1017
1034
  icon="mdi:flash",
1018
- unit="kWh/100 km",
1035
+ unit="kWh/100km",
1036
+ device_class="energy_distance"
1019
1037
  ),
1020
1038
  Sensor(
1021
1039
  attr="trip_last_total_electric_consumption",
1022
1040
  name="Last trip total electric consumption",
1023
1041
  icon="mdi:car-battery",
1024
- unit="kWh/100 km",
1042
+ unit="kWh/100km",
1043
+ device_class="energy_distance"
1025
1044
  ),
1026
1045
  Sensor(
1027
1046
  attr="trip_last_cycle_average_speed",
1028
1047
  name="Last cycle average speed",
1029
1048
  icon="mdi:speedometer",
1030
1049
  unit="km/h",
1050
+ device_class="speed"
1031
1051
  ),
1032
1052
  Sensor(
1033
1053
  attr="trip_last_cycle_average_electric_consumption",
1034
1054
  name="Last cycle_average electric consumption",
1035
1055
  icon="mdi:car-battery",
1036
- unit="kWh/100 km",
1056
+ unit="kWh/100km",
1057
+ device_class="energy_distance"
1037
1058
  ),
1038
1059
  Sensor(
1039
1060
  attr="trip_last_cycle_average_fuel_consumption",
1040
1061
  name="Last cycle average fuel consumption",
1041
1062
  icon="mdi:fuel",
1042
- unit="l/100 km",
1063
+ unit="l/100km",
1043
1064
  ),
1044
1065
  Sensor(
1045
1066
  attr="trip_last_cycle_average_auxillary_consumption",
1046
1067
  name="Last cycle average auxillary consumption",
1047
1068
  icon="mdi:flash",
1048
- unit="kWh/100 km",
1069
+ unit="kWh/100km",
1070
+ device_class="energy_distance"
1049
1071
  ),
1050
1072
  Sensor(
1051
1073
  attr="trip_last_cycle_duration",
1052
1074
  name="Last cycle duration",
1053
1075
  icon="mdi:clock",
1054
1076
  unit="min",
1077
+ device_class="duration"
1055
1078
  ),
1056
1079
  Sensor(
1057
1080
  attr="trip_last_cycle_length",
1058
1081
  name="Last cycle length",
1059
1082
  icon="mdi:map-marker-distance",
1060
1083
  unit="km",
1084
+ device_class="distance"
1061
1085
  ),
1062
1086
  Sensor(
1063
1087
  attr="trip_last_cycle_recuperation",
1064
1088
  name="Last cycle recuperation",
1065
1089
  icon="mdi:battery-plus",
1066
- unit="kWh/100 km",
1090
+ unit="kWh/100km",
1091
+ device_class="energy_distance"
1067
1092
  ),
1068
1093
  Sensor(
1069
1094
  attr="trip_last_cycle_average_recuperation",
1070
1095
  name="Last cycle average recuperation",
1071
1096
  icon="mdi:battery-plus",
1072
- unit="kWh/100 km",
1097
+ unit="kWh/100km",
1098
+ device_class="energy_distance"
1073
1099
  ),
1074
1100
  Sensor(
1075
1101
  attr="trip_last_cycle_average_aux_consumer_consumption",
1076
1102
  name="Last cycle average auxillary consumer consumption",
1077
1103
  icon="mdi:flash",
1078
- unit="kWh/100 km",
1104
+ unit="kWh/100km",
1105
+ device_class="energy_distance"
1079
1106
  ),
1080
1107
  Sensor(
1081
1108
  attr="trip_last_cycle_total_electric_consumption",
1082
1109
  name="Last cycle total electric consumption",
1083
1110
  icon="mdi:car-battery",
1084
- unit="kWh/100 km",
1111
+ unit="kWh/100km",
1112
+ device_class="energy_distance"
1085
1113
  ),
1086
1114
  Sensor(
1087
1115
  attr="model_image_large",
@@ -1103,6 +1131,7 @@ def create_instruments():
1103
1131
  name="Parking Heater heating/ventilation duration",
1104
1132
  icon="mdi:timer",
1105
1133
  unit="minutes",
1134
+ device_class="duration"
1106
1135
  ),
1107
1136
  Sensor(
1108
1137
  attr="outside_temperature",
pycupra/vehicle.py CHANGED
@@ -1075,7 +1075,7 @@ class Vehicle:
1075
1075
  last_connected = last_connected_utc.replace(tzinfo=timezone.utc).astimezone(tz=None)
1076
1076
  else:
1077
1077
  last_connected = datetime.strptime(last_connected_utc,'%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc).astimezone(tz=None)
1078
- return last_connected.strftime('%Y-%m-%d %H:%M:%S')
1078
+ return last_connected #.strftime('%Y-%m-%d %H:%M:%S')
1079
1079
 
1080
1080
  @property
1081
1081
  def is_last_connected_supported(self):
@@ -1282,13 +1282,15 @@ class Vehicle:
1282
1282
  minutes = int(self.attrs.get('charging', {}).get('status', {}).get('charging', {}).get('remainingTimeInMinutes', 0))
1283
1283
  else:
1284
1284
  minutes = 0
1285
- try:
1286
- if minutes == -1: return '00:00'
1287
- if minutes == 65535: return '00:00'
1288
- return "%02d:%02d" % divmod(minutes, 60)
1289
- except Exception:
1290
- pass
1291
- return '00:00'
1285
+ return minutes
1286
+ #try:
1287
+ # if minutes == -1: return '00:00'
1288
+ # if minutes == 65535: return '00:00'
1289
+ # return "%02d:%02d" % divmod(minutes, 60)
1290
+ #except Exception:
1291
+ # pass
1292
+ #return '00:00'
1293
+ return 0
1292
1294
 
1293
1295
  @property
1294
1296
  def is_charging_time_left_supported(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycupra
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: A library to read and send vehicle data via Cupra/Seat portal using the same API calls as the MyCupra/MySeat mobile app.
5
5
  Home-page: https://github.com/WulfgarW/pycupra
6
6
  Author: WulfgarW
@@ -0,0 +1,13 @@
1
+ pycupra/__init__.py,sha256=VPzUfKd5mBFD1UERNV61FbGHih5dQPupLgIfYtmIUi4,230
2
+ pycupra/__version__.py,sha256=vOTajmv3IRptr-g9nG6y6xUN06JYKI_30Dty1N88ekk,207
3
+ pycupra/connection.py,sha256=9EXvTbBZJTcCAef5mYuvldAxBcNnxxxCdPZfi2_TtdM,76264
4
+ pycupra/const.py,sha256=Mx9pPZifQBpn9lTsLH8R7xkUHrXRvul8w_b6LLLD7gE,10038
5
+ pycupra/dashboard.py,sha256=a62F3Zsw2UyBUjYFOrhnqdSk2o2cSkSvmj67FwO8taw,37726
6
+ pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
7
+ pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
8
+ pycupra/vehicle.py,sha256=v9U_cBQGXwa8dsmqyfQZm2WGOZ9uKqWW7FoiO4JsAw0,108436
9
+ pycupra-0.0.3.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
10
+ pycupra-0.0.3.dist-info/METADATA,sha256=scTdNoBQznv8WlxbYmU0MDLOEpYkyp_j9EFaeLr8tkM,2578
11
+ pycupra-0.0.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
12
+ pycupra-0.0.3.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
13
+ pycupra-0.0.3.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- pycupra/__init__.py,sha256=VPzUfKd5mBFD1UERNV61FbGHih5dQPupLgIfYtmIUi4,230
2
- pycupra/__version__.py,sha256=dvx24AtfGPI2pu0OBXAx9Why1tiptwNt5QAjyrYGOQk,207
3
- pycupra/connection.py,sha256=9EXvTbBZJTcCAef5mYuvldAxBcNnxxxCdPZfi2_TtdM,76264
4
- pycupra/const.py,sha256=Mx9pPZifQBpn9lTsLH8R7xkUHrXRvul8w_b6LLLD7gE,10038
5
- pycupra/dashboard.py,sha256=GpkGEYZQpU1B8_QEtCXJC6U8o4lDFmAK6U6FNnd1J4g,36593
6
- pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
7
- pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
8
- pycupra/vehicle.py,sha256=Xk0uK0ivV1-jsZOZqw9xKxFU19bBBe1va274V1Ee_xs,108383
9
- pycupra-0.0.2.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
10
- pycupra-0.0.2.dist-info/METADATA,sha256=nbyEz1wra5P0AvppO4z2-nFQb7-U-xWVv_wekxL24j4,2578
11
- pycupra-0.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
12
- pycupra-0.0.2.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
13
- pycupra-0.0.2.dist-info/RECORD,,