Skip to content

Commit

Permalink
v3.1.0 (#116)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ehendrix23 and dependabot[bot] authored Aug 9, 2021
1 parent 1799f04 commit eaaedc8
Show file tree
Hide file tree
Showing 14 changed files with 1,041 additions and 676 deletions.
1 change: 0 additions & 1 deletion .USER_AGENT
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
#RANDOM:5
95 changes: 56 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ This is a Python 3.8+ module aiming to interact with the Chamberlain MyQ API.
Code is licensed under the MIT license.

# [Homeassistant](https://home-assistant.io)

[Homeassistant](https://home-assistant.io) has a [core myQ component](https://www.home-assistant.io/integrations/myq/) leveraging this package.
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.
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.

# Getting Started

Expand Down Expand Up @@ -62,82 +63,98 @@ async def main() -> None:
# Return only gateway devices:
devices = myq.gateways
# >>> {"serial_number123": <Device>}

# Return *all* devices:
devices = myq.devices
# >>> {"serial_number123": <Device>, "serial_number456": <Device>}


asyncio.get_event_loop().run_until_complete(main())
```
## API Properties

* `accounts`: dictionary with all accounts
* `covers`: dictionary with all covers
* `devices`: dictionary with all devices
* `gateways`: dictionary with all gateways
* `lamps`: dictionary with all lamps
* `last_state_update`: datetime (in UTC) last state update was retrieved
* `password`: password used for authentication. Can only be set, not retrieved
* `username`: username for authentication.

## Account Properties
## API Properties

* `id`: ID for the account
* `name`: Name of the account
- `accounts`: dictionary with all accounts (MyQAccount)
- `covers`: dictionary with all covers (MyQGarageDoor)
- `devices`: dictionary with all devices (MyQDevice)
- `gateways`: dictionary with all gateways (MyQDevice)
- `lamps`: dictionary with all lamps (MyQLamp)
- `last_state_update`: datetime (in UTC) last state update was retrieved for all items
- `password`: password used for authentication. Can only be set, not retrieved
- `username`: username for authentication.

## Account Properties (MyQAccount)

- `api`: Associated API object
- `id`: ID for the account
- `name`: Name of the account
- `covers`: dictionary with all covers for account (MyQGarageDoor)
- `devices`: dictionary with all devices for account (MyQDevice)
- `gateways`: dictionary with all gateways for account (MyQDevice)
- `lamps`: dictionary with all lamps for account (MyQLamp)
- `account_json`: Dictionary containing all account information as retrieved from MyQ
- `last_state_update`: datetime (in UTC) last state update was retrieved for all devices within this account

## Device Properties

* `account`: Return account associated with device
* `close_allowed`: Return whether the device can be closed unattended.
* `device_family`: Return the family in which this device lives.
* `device_id`: Return the device ID (serial number).
* `device_platform`: Return the device platform.
* `device_type`: Return the device type.
* `firmware_version`: Return the family in which this device lives.
* `href`: URI for device
* `name`: Return the device name.
* `online`: Return whether the device is online.
* `open_allowed`: Return whether the device can be opened unattended.
* `parent_device_id`: Return the device ID (serial number) of this device's parent.
* `state`: Return the current state of the device.
* `state_update`: Returns datetime when device was last updated
- `account`: Return account associated with device (MyQAccount)
- `close_allowed`: Return whether the device can be closed unattended.
- `device_family`: Return the family in which this device lives.
- `device_id`: Return the device ID (serial number).
- `device_json`: Dictionary containing all device information as retrieved from MyQ
- `device_platform`: Return the device platform.
- `device_type`: Return the device type.
- `firmware_version`: Return the family in which this device lives.
- `href`: URI for device
- `name`: Return the device name.
- `online`: Return whether the device is online.
- `open_allowed`: Return whether the device can be opened unattended.
- `parent_device_id`: Return the device ID (serial number) of this device's parent.
- `state`: Return the current state of the device.
- `state_update`: Returns datetime when device was last updated

## API Methods

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

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

## Account Methods

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

- `update`: get the latest device info (state, etc.) for all devices associated with this account.

## Device Methods

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

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

## Cover Methods

All Device methods in addition to:
* `close`: close the cover
* `open`: open the cover

- `close`: close the cover
- `open`: open the cover

## Lamp Methods

All Device methods in addition to:
* `turnon`: turn lamp on
* `turnoff`: turn lamp off

- `turnon`: turn lamp on
- `turnoff`: turn lamp off

# Acknowledgement

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

# Disclaimer

Expand Down
Loading

0 comments on commit eaaedc8

Please sign in to comment.