Skip to content

Commit eaaedc8

Browse files
v3.1.0 (#116)
* Creation of Account class and putting devices for the account within that account class * Account class * Change account_id to id * Updated due to account_id to id change * Update README for new MyQAccount class * Moved logic of device update into MyQDevice class * Fix for sending commands * Updating devices failed * Fix authentication by re-adding User Agent logic (#85) * Update development requirements * Fix development requirements * Create requirements_test * Add pytest-cov * Add pytest-timeout * Fix User Agent issue again * Update version * Changed logger items back to lazy % formatting * Move useragent into Request and pre-commit fixes * pre-commit fixes * pre-commit fixes * Updated example to use account object * More pre-commit * Empty out user agent * If .USERAGENT file is empty then don't set it in header * Add unknown devices * Fixed race condition when opening/closing in rapid fashion. * Update to v3.1.0b6 * Changed back to no intermediate state * Only need to lock once we send, not before * Set version to 3.1.0 * Bump isort from 5.7.0 to 5.9.3 (#114) Bumps [isort](https://github.com/pycqa/isort) from 5.7.0 to 5.9.3. - [Release notes](https://github.com/pycqa/isort/releases) - [Changelog](https://github.com/PyCQA/isort/blob/main/CHANGELOG.md) - [Commits](PyCQA/isort@5.7.0...5.9.3) --- updated-dependencies: - dependency-name: isort dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pre-commit from 2.10.1 to 2.14.0 (#115) Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 2.10.1 to 2.14.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/master/CHANGELOG.md) - [Commits](pre-commit/pre-commit@v2.10.1...v2.14.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump black from 20.8b1 to 21.7b0 (#113) Bumps [black](https://github.com/psf/black) from 20.8b1 to 21.7b0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/commits) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 1799f04 commit eaaedc8

File tree

14 files changed

+1041
-676
lines changed

14 files changed

+1041
-676
lines changed

.USER_AGENT

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
#RANDOM:5

README.md

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ This is a Python 3.8+ module aiming to interact with the Chamberlain MyQ API.
55
Code is licensed under the MIT license.
66

77
# [Homeassistant](https://home-assistant.io)
8+
89
[Homeassistant](https://home-assistant.io) has a [core myQ component](https://www.home-assistant.io/integrations/myq/) leveraging this package.
9-
In addition, there is also a [HACS myQ component](https://github.com/ehendrix23/hass_myq) available that can be added into HACS as a custom repository.
10+
In addition, there is also a [HACS myQ component](https://github.com/ehendrix23/hass_myq) available that can be added into HACS as a custom repository.
1011

1112
# Getting Started
1213

@@ -62,82 +63,98 @@ async def main() -> None:
6263
# Return only gateway devices:
6364
devices = myq.gateways
6465
# >>> {"serial_number123": <Device>}
65-
66+
6667
# Return *all* devices:
6768
devices = myq.devices
6869
# >>> {"serial_number123": <Device>, "serial_number456": <Device>}
6970

7071

7172
asyncio.get_event_loop().run_until_complete(main())
7273
```
73-
## API Properties
7474

75-
* `accounts`: dictionary with all accounts
76-
* `covers`: dictionary with all covers
77-
* `devices`: dictionary with all devices
78-
* `gateways`: dictionary with all gateways
79-
* `lamps`: dictionary with all lamps
80-
* `last_state_update`: datetime (in UTC) last state update was retrieved
81-
* `password`: password used for authentication. Can only be set, not retrieved
82-
* `username`: username for authentication.
83-
84-
## Account Properties
75+
## API Properties
8576

86-
* `id`: ID for the account
87-
* `name`: Name of the account
77+
- `accounts`: dictionary with all accounts (MyQAccount)
78+
- `covers`: dictionary with all covers (MyQGarageDoor)
79+
- `devices`: dictionary with all devices (MyQDevice)
80+
- `gateways`: dictionary with all gateways (MyQDevice)
81+
- `lamps`: dictionary with all lamps (MyQLamp)
82+
- `last_state_update`: datetime (in UTC) last state update was retrieved for all items
83+
- `password`: password used for authentication. Can only be set, not retrieved
84+
- `username`: username for authentication.
85+
86+
## Account Properties (MyQAccount)
87+
88+
- `api`: Associated API object
89+
- `id`: ID for the account
90+
- `name`: Name of the account
91+
- `covers`: dictionary with all covers for account (MyQGarageDoor)
92+
- `devices`: dictionary with all devices for account (MyQDevice)
93+
- `gateways`: dictionary with all gateways for account (MyQDevice)
94+
- `lamps`: dictionary with all lamps for account (MyQLamp)
95+
- `account_json`: Dictionary containing all account information as retrieved from MyQ
96+
- `last_state_update`: datetime (in UTC) last state update was retrieved for all devices within this account
8897

8998
## Device Properties
9099

91-
* `account`: Return account associated with device
92-
* `close_allowed`: Return whether the device can be closed unattended.
93-
* `device_family`: Return the family in which this device lives.
94-
* `device_id`: Return the device ID (serial number).
95-
* `device_platform`: Return the device platform.
96-
* `device_type`: Return the device type.
97-
* `firmware_version`: Return the family in which this device lives.
98-
* `href`: URI for device
99-
* `name`: Return the device name.
100-
* `online`: Return whether the device is online.
101-
* `open_allowed`: Return whether the device can be opened unattended.
102-
* `parent_device_id`: Return the device ID (serial number) of this device's parent.
103-
* `state`: Return the current state of the device.
104-
* `state_update`: Returns datetime when device was last updated
100+
- `account`: Return account associated with device (MyQAccount)
101+
- `close_allowed`: Return whether the device can be closed unattended.
102+
- `device_family`: Return the family in which this device lives.
103+
- `device_id`: Return the device ID (serial number).
104+
- `device_json`: Dictionary containing all device information as retrieved from MyQ
105+
- `device_platform`: Return the device platform.
106+
- `device_type`: Return the device type.
107+
- `firmware_version`: Return the family in which this device lives.
108+
- `href`: URI for device
109+
- `name`: Return the device name.
110+
- `online`: Return whether the device is online.
111+
- `open_allowed`: Return whether the device can be opened unattended.
112+
- `parent_device_id`: Return the device ID (serial number) of this device's parent.
113+
- `state`: Return the current state of the device.
114+
- `state_update`: Returns datetime when device was last updated
105115

106116
## API Methods
107117

108118
These are coroutines and need to be `await`ed – see `example.py` for examples.
109119

110-
* `authenticate`: Authenticate (or re-authenticate) to MyQ. Call this to
120+
- `authenticate`: Authenticate (or re-authenticate) to MyQ. Call this to
111121
re-authenticate immediately after changing username and/or password otherwise
112122
new username/password will only be used when token has to be refreshed.
113-
* `update_device_info`: Retrieve info and status for accounts and devices
123+
- `update_device_info`: Retrieve info and status for all accounts and devices
114124

125+
## Account Methods
126+
127+
All of the routines on the `MyQAccount` class are coroutines and need to be
128+
`await`ed – see `example.py` for examples.
129+
130+
- `update`: get the latest device info (state, etc.) for all devices associated with this account.
115131

116132
## Device Methods
117133

118134
All of the routines on the `MyQDevice` class are coroutines and need to be
119135
`await`ed – see `example.py` for examples.
120136

121-
* `update`: get the latest device info (state, etc.). Note that
122-
this runs api.update_device_info and thus all accounts/devices will be updated
137+
- `update`: get the latest device info (state, etc.). Note that
138+
this runs MyQAccount.update and thus all devices within account will be updated
123139

124140
## Cover Methods
125141

126142
All Device methods in addition to:
127-
* `close`: close the cover
128-
* `open`: open the cover
143+
144+
- `close`: close the cover
145+
- `open`: open the cover
129146

130147
## Lamp Methods
131148

132149
All Device methods in addition to:
133-
* `turnon`: turn lamp on
134-
* `turnoff`: turn lamp off
135150

151+
- `turnon`: turn lamp on
152+
- `turnoff`: turn lamp off
136153

137154
# Acknowledgement
138155

139-
Huge thank you to [hjdhjd](https://github.com/hjdhjd) for figuring out the updated V6 API and
140-
sharing his work with us.
156+
Huge thank you to [hjdhjd](https://github.com/hjdhjd) for figuring out the updated V6 API and
157+
sharing his work with us.
141158

142159
# Disclaimer
143160

0 commit comments

Comments
 (0)