pycupra 0.0.12__py3-none-any.whl → 0.0.13__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.12"
6
+ __version__ = "0.0.13"
pycupra/const.py CHANGED
@@ -125,6 +125,8 @@ AUTH_TOKENKEYS = 'https://identity.vwgroup.io/oidc/v1/keys'
125
125
  # API endpoints
126
126
  API_MBB_STATUSDATA = 'https://customer-profile.vwgroup.io/v3/customers/{self._user_id}/mbbStatusData'
127
127
  API_PERSONAL_DATA= 'https://customer-profile.vwgroup.io/v3/customers/{self._user_id}/personalData'
128
+ #Other option for personal data is '{baseurl}/v1/users/{self._user_id}'
129
+
128
130
  API_VEHICLES = '{APP_URI}/v2/users/{self._user_id}/garage/vehicles' # Garage info
129
131
  API_MYCAR = '{baseurl}/v5/users/{self._user_id}/vehicles/{vin}/mycar' # Vehicle status report
130
132
  API_CHARGING = '{baseurl}/v1/vehicles/{vin}/charging' # Vehicle charging information
pycupra/dashboard.py CHANGED
@@ -933,6 +933,31 @@ class RequestResults(Sensor):
933
933
  def attributes(self):
934
934
  return dict(self.vehicle.request_results)
935
935
 
936
+ class ChargingState(BinarySensor):
937
+ def __init__(self):
938
+ super().__init__(attr="charging_state", name="Charging state", icon="mdi:battery-charging", device_class='power')
939
+
940
+ @property
941
+ def state(self):
942
+ return self.vehicle.charging_state
943
+
944
+ @property
945
+ def assumed_state(self):
946
+ return False
947
+
948
+ @property
949
+ def attributes(self):
950
+ attr = {}
951
+ state = self.vehicle.attrs.get('charging', {}).get('status', {}).get('state', '')
952
+ type = self.vehicle.attrs.get('charging', {}).get('status', {}).get('charging', {}).get('type', '')
953
+ mode = self.vehicle.attrs.get('charging', {}).get('status', {}).get('charging', {}).get('mode', '')
954
+ if state in {'charging', 'conservation'}:
955
+ attr['state']=state
956
+ if type != '':
957
+ attr['type']=type
958
+ if mode != '':
959
+ attr['mode']=mode
960
+ return attr
936
961
 
937
962
  def create_instruments():
938
963
  return [
@@ -960,6 +985,7 @@ def create_instruments():
960
985
  DepartureProfile1(),
961
986
  DepartureProfile2(),
962
987
  DepartureProfile3(),
988
+ ChargingState(),
963
989
  Sensor(
964
990
  attr="distance",
965
991
  name="Odometer",
@@ -1284,11 +1310,11 @@ def create_instruments():
1284
1310
  name="Energy flow",
1285
1311
  device_class="power"
1286
1312
  ),
1287
- BinarySensor(
1288
- attr="charging_state",
1289
- name="Charging state",
1290
- device_class="power"
1291
- ),
1313
+ #BinarySensor(
1314
+ # attr="charging_state",
1315
+ # name="Charging state",
1316
+ # device_class="power"
1317
+ #),
1292
1318
  BinarySensor(
1293
1319
  attr="parking_light",
1294
1320
  name="Parking light",
pycupra/vehicle.py CHANGED
@@ -1644,8 +1644,6 @@ class Vehicle:
1644
1644
  return True
1645
1645
 
1646
1646
  @property
1647
- #def energy_flow(self):
1648
- # """Return true if energy is flowing through charging port."""
1649
1647
  def charging_state(self):
1650
1648
  """Return true if vehicle is charging."""
1651
1649
  check = self.attrs.get('charging', {}).get('status', {}).get('state', '')
@@ -1655,13 +1653,29 @@ class Vehicle:
1655
1653
  return False
1656
1654
 
1657
1655
  @property
1658
- #def is_energy_flow_supported(self):
1659
- # """Energy flow supported."""
1660
1656
  def is_charging_state_supported(self):
1661
1657
  """Charging state supported."""
1662
1658
  if self.attrs.get('charging', {}).get('status', {}).get('state', False):
1663
1659
  return True
1664
1660
 
1661
+ @property
1662
+ def energy_flow(self):
1663
+ """Return true if energy is flowing to (i.e. charging) or from (i.e. climating with battery power) the battery."""
1664
+ if self.charging_state:
1665
+ return True
1666
+ check = self.attrs.get('charging', {}).get('status', {}).get('state', '')
1667
+ if self.is_electric_climatisation_supported:
1668
+ if self.electric_climatisation and check not in {'charging', 'conservation'}:
1669
+ # electric climatisation is on and car is not charging or conserving power
1670
+ return True
1671
+ return False
1672
+
1673
+ @property
1674
+ def is_energy_flow_supported(self):
1675
+ """Energy flow supported."""
1676
+ if self.is_charging_state_supported:
1677
+ return True
1678
+
1665
1679
  # Vehicle location states
1666
1680
  @property
1667
1681
  def position(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycupra
3
- Version: 0.0.12
3
+ Version: 0.0.13
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=TaTBX6INREWajim6xVOUYCFZYeyoJA-OFOU2qeaT5nk,208
3
+ pycupra/connection.py,sha256=_bTo1sBsUUDEf6Q8-u4H079KT_IN5sW5vlYI26ZB9mc,82423
4
+ pycupra/const.py,sha256=mgl29DcZz_J5hSzxknteu0ocDOXmQAgP0x17kvVSSi0,10234
5
+ pycupra/dashboard.py,sha256=FYheQ_U_mJ6BpgGq0auzcL-MsGOzSIlRo9vPvjf2pGQ,42434
6
+ pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
7
+ pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
8
+ pycupra/vehicle.py,sha256=DTbUzd31lyXON77_6no1mCrw5uajx24K5qDKA70PL9M,132533
9
+ pycupra-0.0.13.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
10
+ pycupra-0.0.13.dist-info/METADATA,sha256=8xEMN1iXZC6Cc5sIOp_5dkzEpN9YXhdF_YoD07cFjLs,2579
11
+ pycupra-0.0.13.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
12
+ pycupra-0.0.13.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
13
+ pycupra-0.0.13.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- pycupra/__init__.py,sha256=VPzUfKd5mBFD1UERNV61FbGHih5dQPupLgIfYtmIUi4,230
2
- pycupra/__version__.py,sha256=CeTcAqS8UeO4S1S3J9MNxE_2uChpfnFBNT2cCLe83SM,208
3
- pycupra/connection.py,sha256=_bTo1sBsUUDEf6Q8-u4H079KT_IN5sW5vlYI26ZB9mc,82423
4
- pycupra/const.py,sha256=VEYH8TUsJGJwBwloaajwoElYd0qxE7oesvoagvDdE-4,10161
5
- pycupra/dashboard.py,sha256=4ORHlj-GqDLoz6l0iRMtbGSerSMwOU6NRtn0l8KynZ4,41464
6
- pycupra/exceptions.py,sha256=Nq_F79GP8wjHf5lpvPy9TbSIrRHAJrFMo0T1N9TcgSQ,2917
7
- pycupra/utilities.py,sha256=cH4MiIzT2WlHgmnl_E7rR0R5LvCXfDNvirJolct50V8,2563
8
- pycupra/vehicle.py,sha256=RwEPEZxgOqTqBaraN9xw0G_L5ZpHTGiA5s7uHY4COH0,131949
9
- pycupra-0.0.12.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
10
- pycupra-0.0.12.dist-info/METADATA,sha256=FcWVH_rgNOeDHzkyUqxdupB7q92EfS-HB72gKoShSN8,2579
11
- pycupra-0.0.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
12
- pycupra-0.0.12.dist-info/top_level.txt,sha256=9Lbj_jG4JvpGwt6K3AwhWFc0XieDnuHFOP4x44wSXSQ,8
13
- pycupra-0.0.12.dist-info/RECORD,,