Skip to content

Commit

Permalink
Change some comments, fixed some typo's (#204)
Browse files Browse the repository at this point in the history
* Change some comments, fixed some typo's

Change some comments, fixed some typo's

* Update navigation.py
  • Loading branch information
EddyK69 committed Oct 24, 2020
1 parent 9fe90a5 commit f0ce2e0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
12 changes: 6 additions & 6 deletions bimmer_connected/all_trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def user_total(self) -> float:
@property
@backend_parameter_statistic
def user_current_charge_cycle(self) -> float:
"""Get the users current change cycle."""
"""Get the users current charge cycle."""
return float(self._ccm_dict["userCurrentChargeCycle"])


Expand Down Expand Up @@ -104,31 +104,31 @@ def __getattr__(self, item):
@property
@backend_parameter
def reset_date(self) -> str:
"""Returns the average combined consumption."""
"""Returns the reset date."""
return self._state.attributes[SERVICE_ALL_TRIPS]['resetDate']

@property
@backend_parameter
def battery_size_max(self) -> int:
"""Maximal battery size, in Wh."""
"""Returns the maximal battery size, in Wh."""
return int(self._state.attributes[SERVICE_ALL_TRIPS]['batterySizeMax'])

@property
@backend_parameter
def saved_co2(self) -> int:
"""Maximal battery size, in Wh."""
"""Returns the saved CO2, in kg."""
return float(self._state.attributes[SERVICE_ALL_TRIPS]['savedCO2'])

@property
@backend_parameter
def saved_co2_green_energy(self) -> int:
"""Maximal battery size, in Wh."""
"""Returns the save CO2GreenEnergym in kg."""
return float(self._state.attributes[SERVICE_ALL_TRIPS]['savedCO2greenEnergy'])

@property
@backend_parameter
def total_saved_fuel(self) -> int:
"""Maximal battery size, in Wh."""
"""Returns the total saved fuel, in l."""
return float(self._state.attributes[SERVICE_ALL_TRIPS]['totalSavedFuel'])

@property
Expand Down
10 changes: 5 additions & 5 deletions bimmer_connected/efficiency.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ def __getattr__(self, item):
@property
@backend_parameter
def model_type(self) -> str:
"""Returns the average electric consumption."""
"""Returns the model type."""
return self._state.attributes[SERVICE_EFFICIENCY]['modelType']

@property
@backend_parameter
def efficiency_quotient(self) -> int:
"""Returns the average electric consumption."""
"""Returns the efficiency quotient."""
return int(self._state.attributes[SERVICE_EFFICIENCY]['efficiencyQuotient'])

@property
@backend_parameter
def last_trip_list(self) -> List[LastTrip]:
"""Returns the average electric consumption."""
"""Returns the list of last trips."""
ret_list = []
last_trip_list = self._state.attributes[SERVICE_EFFICIENCY].get('lastTripList', [])
for trip in last_trip_list:
Expand All @@ -158,7 +158,7 @@ def last_trip_list(self) -> List[LastTrip]:
@property
@backend_parameter
def life_time_list(self) -> List[LifeTime]:
"""Returns the average electric consumption."""
"""Returns the life time list."""
ret_list = []
last_time_list = self._state.attributes[SERVICE_EFFICIENCY].get('lifeTimeList', [])
for time in last_time_list:
Expand All @@ -168,7 +168,7 @@ def life_time_list(self) -> List[LifeTime]:
@property
@backend_parameter
def characteristic_list(self) -> List[Characteristic]:
"""Returns the average electric consumption."""
"""Returns the characteristic list."""
ret_list = []
characteristic_list = self._state.attributes[SERVICE_EFFICIENCY].get('characteristicList', [])
for characteristic in characteristic_list:
Expand Down
10 changes: 5 additions & 5 deletions bimmer_connected/last_trip.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Models the charging profiles of a vehicle."""
"""Models the last trip of a vehicle."""

import logging

Expand Down Expand Up @@ -64,13 +64,13 @@ def electric_distance(self) -> float:

@property
@backend_parameter
def averege_electric_consumption(self) -> float:
def average_electric_consumption(self) -> float:
"""Returns the average electric consumption."""
return float(self._state.attributes[SERVICE_LAST_TRIP]['avgElectricConsumption'])

@property
@backend_parameter
def averege_recuperation(self) -> float:
def average_recuperation(self) -> float:
"""Returns the average recuperation."""
return float(self._state.attributes[SERVICE_LAST_TRIP]['avgRecuperation'])

Expand Down Expand Up @@ -106,8 +106,8 @@ def auxiliary_consumption_value(self) -> float:

@property
@backend_parameter
def averege_combined_consumption(self) -> float:
"""Returns the averege combined consumption."""
def average_combined_consumption(self) -> float:
"""Returns the average combined consumption."""
return float(self._state.attributes[SERVICE_LAST_TRIP]['avgCombinedConsumption'])

@property
Expand Down
44 changes: 22 additions & 22 deletions bimmer_connected/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,49 @@ def __getattr__(self, item):
@property
@backend_parameter
def latitude(self) -> float:
"""Returns the average electric consumption."""
"""Returns the latitude."""
return float(self._state.attributes[SERVICE_NAVIGATION]['latitude'])

@property
@backend_parameter
def longitude(self) -> float:
"""Returns the average electric consumption."""
"""Returns the longitude."""
return float(self._state.attributes[SERVICE_NAVIGATION]['longitude'])

@property
@backend_parameter
def iso_country_code(self) -> str:
"""Returns the average electric consumption."""
"""Returns the iso country code."""
return self._state.attributes[SERVICE_NAVIGATION]['isoCountryCode']

@property
@backend_parameter
def aux_power_regular(self) -> float:
"""Returns the average electric consumption."""
"""Returns the aux power regular consumption."""
return float(self._state.attributes[SERVICE_NAVIGATION]['auxPowerRegular'])

@property
@backend_parameter
def aux_power_eco_pro(self) -> float:
"""Returns the average electric consumption."""
"""Returns the aux power eco pro consumption."""
return float(self._state.attributes[SERVICE_NAVIGATION]['auxPowerEcoPro'])

@property
@backend_parameter
def aux_power_eco_pro_plus(self) -> float:
"""Returns the average electric consumption."""
"""Returns the aux power eco pro plus consumption."""
return float(self._state.attributes[SERVICE_NAVIGATION]['auxPowerEcoProPlus'])

@property
@backend_parameter
def soc(self) -> float:
"""Returns the average electric consumption."""
"""Returns the soc."""
return float(self._state.attributes[SERVICE_NAVIGATION]['soc'])

@property
@backend_parameter
def soc_max(self) -> float:
"""Returns the average electric consumption."""
"""Returns the soc max."""
try:
return float(self._state.attributes[SERVICE_NAVIGATION]['socMax'])
except KeyError:
Expand All @@ -98,83 +98,83 @@ def soc_max(self) -> float:
@property
@backend_parameter
def eco(self) -> str:
"""Returns the average electric consumption."""
"""Returns the eco."""
return self._state.attributes[SERVICE_NAVIGATION]['eco']

@property
@backend_parameter
def norm(self) -> str:
"""Returns the average electric consumption."""
"""Returns the norm."""
return self._state.attributes[SERVICE_NAVIGATION]['norm']

@property
@backend_parameter
def eco_ev(self) -> str:
"""Returns the average electric consumption."""
"""Returns the eco ev."""
return self._state.attributes[SERVICE_NAVIGATION]['ecoEv']

@property
@backend_parameter
def norm_ev(self) -> str:
"""Returns the average electric consumption."""
"""Returns the norm ev."""
return self._state.attributes[SERVICE_NAVIGATION]['normEv']

@property
@backend_parameter
def vehicle_mass(self) -> int:
"""Returns the average electric consumption."""
"""Returns the vehicle mass."""
return int(self._state.attributes[SERVICE_NAVIGATION]['vehicleMass'])

@property
@backend_parameter
def k_acc_reg(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k acc reg."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kAccReg'])

@property
@backend_parameter
def k_dec_reg(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k dec reg."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kDecReg'])

@property
@backend_parameter
def k_acc_eco(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k acc eco."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kAccEco'])

@property
@backend_parameter
def k_dec_eco(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k dec eco."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kDecEco'])

@property
@backend_parameter
def k_up(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k up."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kUp'])

@property
@backend_parameter
def k_down(self) -> int:
"""Returns the average electric consumption."""
"""Returns the k down."""
return int(self._state.attributes[SERVICE_NAVIGATION]['kDown'])

@property
@backend_parameter
def drive_train(self) -> str:
"""Returns the average electric consumption."""
"""Returns the drive_train."""
return self._state.attributes[SERVICE_NAVIGATION]['driveTrain']

@property
@backend_parameter
def pending_update(self) -> bool:
"""Returns the average electric consumption."""
"""Returns the pending update state."""
return bool(self._state.attributes[SERVICE_NAVIGATION]['pendingUpdate'])

@property
@backend_parameter
def vehicle_tracking(self) -> bool:
"""Returns the average electric consumption."""
"""Returns the vehicle tracking state."""
return bool(self._state.attributes[SERVICE_NAVIGATION]['vehicleTracking'])
6 changes: 3 additions & 3 deletions test/test_last_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ def test_parse_i01(self):
self.assertEqual(0.53, state.last_trip.efficiencyValue)
self.assertEqual(141, state.last_trip.total_distance)
self.assertEqual(100.1, state.last_trip.electric_distance)
self.assertEqual(16.6, state.last_trip.averege_electric_consumption)
self.assertEqual(2, state.last_trip.averege_recuperation)
self.assertEqual(16.6, state.last_trip.average_electric_consumption)
self.assertEqual(2, state.last_trip.average_recuperation)
self.assertEqual(0, state.last_trip.driving_mode_value)
self.assertEqual(0.39, state.last_trip.acceleration_value)
self.assertEqual(0.81, state.last_trip.anticipation_value)
self.assertEqual(0.79, state.last_trip.total_consumption_value)
self.assertEqual(0.66, state.last_trip.auxiliary_consumption_value)
self.assertEqual(1.9, state.last_trip.averege_combined_consumption)
self.assertEqual(1.9, state.last_trip.average_combined_consumption)
self.assertEqual(71, state.last_trip.electric_distance_ratio)
self.assertEqual(0, state.last_trip.saved_fuel)
self.assertEqual('2015-12-01T20:44:00+0100', state.last_trip.date)
Expand Down
2 changes: 1 addition & 1 deletion test/test_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Test for old deprecate state api."""
"""Test for old deprecated state api."""

import unittest
from unittest import mock
Expand Down

0 comments on commit f0ce2e0

Please sign in to comment.