Skip to content

Commit c0fd6c7

Browse files
committed
Version 1.3.9
1 parent edbd605 commit c0fd6c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+6826
-3514
lines changed

.gitignore

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
*.pyc
1+
__pycache__/
22
.idea/
3-
TODO
3+
.pylintrc
4+
.vscode/
5+
*.pyc
46
build/
57
dist/
6-
tests/
7-
__pycache__/
8+
Notes.txt
9+
plantuml/
810
pyecobee_db*
11+
Pyecobee.code-workspace
912
pyecobee.egg-info
13+
tests/
14+
TODO

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
33
Release History
44
===============
5+
1.3.9 (2020-08-04)
6+
------------------
7+
* Migrate from PyCharm to VSCode
8+
* Code refactoring and cleanup using Autopep8 and Pylint
9+
* Add undocumented ecobee objects (Energy & TimeOfUse)
10+
511
1.3.8 (2020-08-01)
612
------------------
713
* Add fan_speed to Event object

pyecobee/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from pyecobee.objects.electricity import Electricity
4242
from pyecobee.objects.electricity_device import ElectricityDevice
4343
from pyecobee.objects.electricity_tier import ElectricityTier
44+
from pyecobee.objects.energy import Energy
4445
from pyecobee.objects.equipment_setting import EquipmentSetting
4546
from pyecobee.objects.event import Event
4647
from pyecobee.objects.extended_runtime import ExtendedRuntime
@@ -75,6 +76,7 @@
7576
from pyecobee.objects.status import Status
7677
from pyecobee.objects.technician import Technician
7778
from pyecobee.objects.thermostat import Thermostat
79+
from pyecobee.objects.time_of_use import TimeOfUse
7880
from pyecobee.objects.user import User
7981
from pyecobee.objects.utility import Utility
8082
from pyecobee.objects.version import Version

pyecobee/ecobee_object.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,42 @@ def __repr__(self):
1515

1616
def __str__(self):
1717
return '{0}('.format(self.__class__.__name__) + ', '.join(
18-
['{0}={1!s}'.format(type(self).attribute_name_map[attribute_name[1:]], getattr(self, attribute_name))
18+
['{0}={1!s}'.format(type(self).attribute_name_map[attribute_name[1:]],
19+
getattr(self, attribute_name))
1920
for attribute_name in self.slots()]) + ')'
2021

2122
def pretty_format(self, indent=2, level=0, sort_attributes=True):
2223
"""
2324
Pretty format a response object
2425
25-
:param indent: The amount of indentation added for each recursive level
26+
:param indent: The amount of indentation added for each
27+
recursive level
2628
:param level: The recursion level
2729
:param sort_attributes: Whether to sort the attributes or not
28-
:return: six.text_type (This is unicode() in Python 2 and str in Python 3)
30+
:return: six.text_type (This is unicode() in Python 2 and str in
31+
Python 3)
2932
"""
3033
pretty_formatted = ['{0}(\n'.format(self.__class__.__name__)]
3134
level = level + 1
3235

33-
for (i, attribute_name) in enumerate(sorted(self.slots()) if sort_attributes else self.slots()):
36+
for (i, attribute_name) in enumerate(
37+
sorted(self.slots()) if sort_attributes else self.slots()):
3438
if i:
3539
pretty_formatted.append(',\n')
3640

3741
if isinstance(getattr(self, attribute_name), list):
38-
pretty_formatted.append('{0}{1}=[\n'.format(' ' * (indent * level),
39-
self.attribute_name_map[attribute_name[1:]]))
42+
pretty_formatted.append('{0}{1}=[\n'.format(
43+
' ' * (indent * level), self.attribute_name_map[attribute_name[1:]]))
4044
level = level + 1
4145

4246
for (j, list_entry) in enumerate(getattr(self, attribute_name)):
4347
if j:
4448
pretty_formatted.append(',\n')
4549

4650
if hasattr(list_entry, 'pretty_format'):
47-
pretty_formatted.append('{0}{1}'.format(' ' * (indent * level),
48-
list_entry.pretty_format(indent,
49-
level,
50-
sort_attributes)))
51+
pretty_formatted.append('{0}{1}'.format(
52+
' ' * (indent * level),
53+
list_entry.pretty_format(indent, level, sort_attributes)))
5154
else:
5255
if isinstance(list_entry, list):
5356
pretty_formatted.append('{0}[\n'.format(' ' * (indent * level)))
@@ -58,15 +61,17 @@ def pretty_format(self, indent=2, level=0, sort_attributes=True):
5861
if k:
5962
pretty_formatted.append(',\n')
6063

61-
pretty_formatted.append('{0}{1}'.format(' ' * (indent * level), sub_list_entry))
64+
pretty_formatted.append('{0}{1}'.format(' ' * (indent * level),
65+
sub_list_entry))
6266

6367
if list_entry:
6468
pretty_formatted.append('\n')
6569

6670
level = level - 1
6771
pretty_formatted.append('{0}]'.format(' ' * (indent * level)))
6872
else:
69-
pretty_formatted.append('{0}{1}'.format(' ' * (indent * level), list_entry))
73+
pretty_formatted.append('{0}{1}'.format(' ' * (indent * level),
74+
list_entry))
7075

7176
if getattr(self, attribute_name):
7277
pretty_formatted.append('\n')
@@ -77,14 +82,15 @@ def pretty_format(self, indent=2, level=0, sort_attributes=True):
7782
pretty_formatted.append(' ' * (indent * level))
7883

7984
if hasattr(getattr(self, attribute_name), 'pretty_format'):
80-
pretty_formatted.append('{0}={1!s}'.format(self.attribute_name_map[attribute_name[1:]],
81-
getattr(self, attribute_name).pretty_format(
82-
indent,
83-
level,
84-
sort_attributes)))
85+
pretty_formatted.append('{0}={1!s}'.format(
86+
self.attribute_name_map[attribute_name[1:]],
87+
getattr(self, attribute_name).pretty_format(indent,
88+
level,
89+
sort_attributes)))
8590
else:
86-
pretty_formatted.append('{0}={1!s}'.format(self.attribute_name_map[attribute_name[1:]],
87-
getattr(self, attribute_name)))
91+
pretty_formatted.append('{0}={1!s}'.format(
92+
self.attribute_name_map[attribute_name[1:]],
93+
getattr(self, attribute_name)))
8894

8995
level = level - 1
9096
pretty_formatted.append('\n{0})'.format(' ' * (indent * level)))

pyecobee/exceptions.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ class EcobeeException(Exception):
33

44

55
class EcobeeApiException(EcobeeException):
6-
attribute_type_map = {'status_code': 'six.text_type', 'status_message': 'six.text_type'}
6+
attribute_type_map = {
7+
'status_code': 'six.text_type',
8+
'status_message': 'six.text_type'}
79

810
def __init__(self, message, status_code, status_message):
911
super(EcobeeApiException, self).__init__(message)
12+
1013
self._status_code = status_code
1114
self._status_message = status_message
1215

@@ -20,11 +23,14 @@ def status_message(self):
2023

2124

2225
class EcobeeAuthorizationException(EcobeeException):
23-
attribute_type_map = {'error': 'six.text_type', 'error_description': 'six.text_type',
24-
'error_uri': 'six.text_type'}
26+
attribute_type_map = {
27+
'error': 'six.text_type',
28+
'error_description': 'six.text_type',
29+
'error_uri': 'six.text_type'}
2530

2631
def __init__(self, message, error, error_description, error_uri):
2732
super(EcobeeAuthorizationException, self).__init__(message)
33+
2834
self._error = error
2935
self._error_description = error_description
3036
self._error_uri = error_uri

pyecobee/objects/action.py

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,70 @@ class Action(EcobeeObject):
99
This class has been auto generated by scraping
1010
https://www.ecobee.com/home/developer/api/documentation/v1/objects/Action.shtml
1111
12-
Attribute names have been generated by converting ecobee property names from camelCase to snake_case.
12+
Attribute names have been generated by converting ecobee property
13+
names from camelCase to snake_case.
1314
1415
A getter property has been generated for each attribute.
15-
A setter property has been generated for each attribute whose value of READONLY is "no".
16-
17-
An __init__ argument without a default value has been generated if the value of REQUIRED is "yes".
18-
An __init__ argument with a default value of None has been generated if the value of REQUIRED is "no".
19-
"""
20-
__slots__ = ['_type', '_send_alert', '_send_update', '_activation_delay', '_deactivation_delay',
21-
'_min_action_duration', '_heat_adjust_temp', '_cool_adjust_temp', '_activate_relay',
22-
'_activate_relay_open']
23-
24-
attribute_name_map = {'type': 'type', 'send_alert': 'sendAlert', 'sendAlert': 'send_alert',
25-
'send_update': 'sendUpdate', 'sendUpdate': 'send_update',
26-
'activation_delay': 'activationDelay', 'activationDelay': 'activation_delay',
27-
'deactivation_delay': 'deactivationDelay', 'deactivationDelay': 'deactivation_delay',
28-
'min_action_duration': 'minActionDuration', 'minActionDuration': 'min_action_duration',
29-
'heat_adjust_temp': 'heatAdjustTemp', 'heatAdjustTemp': 'heat_adjust_temp',
30-
'cool_adjust_temp': 'coolAdjustTemp', 'coolAdjustTemp': 'cool_adjust_temp',
31-
'activate_relay': 'activateRelay', 'activateRelay': 'activate_relay',
32-
'activate_relay_open': 'activateRelayOpen', 'activateRelayOpen': 'activate_relay_open'}
33-
34-
attribute_type_map = {'type': 'six.text_type', 'send_alert': 'bool', 'send_update': 'bool',
35-
'activation_delay': 'int', 'deactivation_delay': 'int', 'min_action_duration': 'int',
36-
'heat_adjust_temp': 'int', 'cool_adjust_temp': 'int', 'activate_relay': 'six.text_type',
37-
'activate_relay_open': 'bool'}
38-
39-
def __init__(self, type=None, send_alert=None, send_update=None, activation_delay=None, deactivation_delay=None,
40-
min_action_duration=None, heat_adjust_temp=None, cool_adjust_temp=None, activate_relay=None,
41-
activate_relay_open=None):
16+
A setter property has been generated for each attribute whose value
17+
of READONLY is "no".
18+
19+
An __init__ argument without a default value has been generated if
20+
the value of REQUIRED is "yes".
21+
An __init__ argument with a default value of None has been generated
22+
if the value of REQUIRED is "no".
23+
"""
24+
__slots__ = [
25+
'_type',
26+
'_send_alert',
27+
'_send_update',
28+
'_activation_delay',
29+
'_deactivation_delay',
30+
'_min_action_duration',
31+
'_heat_adjust_temp',
32+
'_cool_adjust_temp',
33+
'_activate_relay',
34+
'_activate_relay_open']
35+
36+
attribute_name_map = {
37+
'type': 'type',
38+
'send_alert': 'sendAlert',
39+
'sendAlert': 'send_alert',
40+
'send_update': 'sendUpdate',
41+
'sendUpdate': 'send_update',
42+
'activation_delay': 'activationDelay',
43+
'activationDelay': 'activation_delay',
44+
'deactivation_delay': 'deactivationDelay',
45+
'deactivationDelay': 'deactivation_delay',
46+
'min_action_duration': 'minActionDuration',
47+
'minActionDuration': 'min_action_duration',
48+
'heat_adjust_temp': 'heatAdjustTemp',
49+
'heatAdjustTemp': 'heat_adjust_temp',
50+
'cool_adjust_temp': 'coolAdjustTemp',
51+
'coolAdjustTemp': 'cool_adjust_temp',
52+
'activate_relay': 'activateRelay',
53+
'activateRelay': 'activate_relay',
54+
'activate_relay_open': 'activateRelayOpen',
55+
'activateRelayOpen': 'activate_relay_open'}
56+
57+
attribute_type_map = {
58+
'type': 'six.text_type',
59+
'send_alert': 'bool',
60+
'send_update': 'bool',
61+
'activation_delay': 'int',
62+
'deactivation_delay': 'int',
63+
'min_action_duration': 'int',
64+
'heat_adjust_temp': 'int',
65+
'cool_adjust_temp': 'int',
66+
'activate_relay': 'six.text_type',
67+
'activate_relay_open': 'bool'}
68+
69+
def __init__(self, type_=None, send_alert=None, send_update=None, activation_delay=None,
70+
deactivation_delay=None, min_action_duration=None, heat_adjust_temp=None,
71+
cool_adjust_temp=None, activate_relay=None, activate_relay_open=None):
4272
"""
4373
Construct an Action instance
4474
"""
45-
self._type = type
75+
self._type = type_
4676
self._send_alert = send_alert
4777
self._send_update = send_update
4878
self._activation_delay = activation_delay
@@ -58,7 +88,8 @@ def type(self):
5888
"""
5989
Gets the type attribute of this Action instance.
6090
61-
:return: The value of the type attribute of this Action instance.
91+
:return: The value of the type attribute of this Action
92+
instance.
6293
:rtype: six.text_type
6394
"""
6495

@@ -69,7 +100,8 @@ def send_alert(self):
69100
"""
70101
Gets the send_alert attribute of this Action instance.
71102
72-
:return: The value of the send_alert attribute of this Action instance.
103+
:return: The value of the send_alert attribute of this Action
104+
instance.
73105
:rtype: bool
74106
"""
75107

@@ -80,7 +112,8 @@ def send_update(self):
80112
"""
81113
Gets the send_update attribute of this Action instance.
82114
83-
:return: The value of the send_update attribute of this Action instance.
115+
:return: The value of the send_update attribute of this Action
116+
instance.
84117
:rtype: bool
85118
"""
86119

@@ -91,7 +124,8 @@ def activation_delay(self):
91124
"""
92125
Gets the activation_delay attribute of this Action instance.
93126
94-
:return: The value of the activation_delay attribute of this Action instance.
127+
:return: The value of the activation_delay attribute of this
128+
Action instance.
95129
:rtype: int
96130
"""
97131

@@ -102,7 +136,8 @@ def deactivation_delay(self):
102136
"""
103137
Gets the deactivation_delay attribute of this Action instance.
104138
105-
:return: The value of the deactivation_delay attribute of this Action instance.
139+
:return: The value of the deactivation_delay attribute of this
140+
Action instance.
106141
:rtype: int
107142
"""
108143

@@ -113,7 +148,8 @@ def min_action_duration(self):
113148
"""
114149
Gets the min_action_duration attribute of this Action instance.
115150
116-
:return: The value of the min_action_duration attribute of this Action instance.
151+
:return: The value of the min_action_duration attribute of this
152+
Action instance.
117153
:rtype: int
118154
"""
119155

@@ -124,7 +160,8 @@ def heat_adjust_temp(self):
124160
"""
125161
Gets the heat_adjust_temp attribute of this Action instance.
126162
127-
:return: The value of the heat_adjust_temp attribute of this Action instance.
163+
:return: The value of the heat_adjust_temp attribute of this
164+
Action instance.
128165
:rtype: int
129166
"""
130167

@@ -135,7 +172,8 @@ def cool_adjust_temp(self):
135172
"""
136173
Gets the cool_adjust_temp attribute of this Action instance.
137174
138-
:return: The value of the cool_adjust_temp attribute of this Action instance.
175+
:return: The value of the cool_adjust_temp attribute of this
176+
Action instance.
139177
:rtype: int
140178
"""
141179

@@ -146,7 +184,8 @@ def activate_relay(self):
146184
"""
147185
Gets the activate_relay attribute of this Action instance.
148186
149-
:return: The value of the activate_relay attribute of this Action instance.
187+
:return: The value of the activate_relay attribute of this
188+
Action instance.
150189
:rtype: six.text_type
151190
"""
152191

@@ -157,7 +196,8 @@ def activate_relay_open(self):
157196
"""
158197
Gets the activate_relay_open attribute of this Action instance.
159198
160-
:return: The value of the activate_relay_open attribute of this Action instance.
199+
:return: The value of the activate_relay_open attribute of this
200+
Action instance.
161201
:rtype: bool
162202
"""
163203

0 commit comments

Comments
 (0)