Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.19.1 #592

Merged
merged 29 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0c5837e
Dev version bump
fronzbot Mar 21, 2022
a342b2d
Merge pull request #560 from fronzbot/dev-bump-20
fronzbot Mar 21, 2022
e53e119
Bump black from 22.1.0 to 22.3.0
dependabot[bot] Mar 29, 2022
b301954
Delete debug_login.py
fronzbot Apr 12, 2022
c846953
Merge pull request #565 from fronzbot/dependabot/pip/black-22.3.0
fronzbot Apr 12, 2022
5702b8e
Merge branch 'dev' into fronzbot-patch-1
fronzbot Apr 12, 2022
9a62866
Merge pull request #573 from fronzbot/fronzbot-patch-1
fronzbot Apr 12, 2022
5f738c8
Fixed Contributing Guide
dwaltsch May 25, 2022
75132e3
Contributing Guide Align
dwaltsch May 25, 2022
53e4f99
.gitignore idea
dwaltsch May 25, 2022
713ff47
Merge pull request #579 from dwaltsch/docsupdate
fronzbot May 27, 2022
da59867
Bump coverage from 6.3.2 to 6.4.1
dependabot[bot] Jun 2, 2022
06165df
Adjust type_key_map and type to work with doorbells
uvjim Jun 10, 2022
f87cde7
Get the battery state for doorbells
uvjim Jun 10, 2022
4493963
Apply black formatting
uvjim Jun 14, 2022
c65f86e
Bump pylint from 2.10.2 to 2.14.3
dependabot[bot] Jun 20, 2022
74a6c1f
Merge pull request #584 from uvjim/fix_getting_doorbell_details
fronzbot Jun 23, 2022
cf0763d
Merge branch 'dev' into dependabot/pip/pylint-2.14.3
fronzbot Jun 23, 2022
07ca567
Merge pull request #588 from fronzbot/dependabot/pip/pylint-2.14.3
fronzbot Jun 23, 2022
3f8f9a1
Merge branch 'dev' into dependabot/pip/coverage-6.4.1
fronzbot Jun 23, 2022
9315c43
Merge pull request #582 from fronzbot/dependabot/pip/coverage-6.4.1
fronzbot Jun 23, 2022
4703c54
Expanded mini and lotus tests
fronzbot Jun 23, 2022
34a1d87
Add type param for regular cameras, add test to check for mixed camera
fronzbot Jun 26, 2022
e8af309
Added some useful but missing tests
fronzbot Jun 26, 2022
d87d960
Merge pull request #590 from fronzbot/fix-inclusion
fronzbot Jun 26, 2022
d00be22
Broke out tests into functional and behavioral
fronzbot Jun 26, 2022
8753c42
Merge pull request #591 from fronzbot/refactor-tests
fronzbot Jun 26, 2022
e6199f7
version bump
fronzbot Jun 26, 2022
43dfcff
Update CHANGES.rst
fronzbot Jun 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ Changelog

A list of changes between each release

0.19.1 (2022-06-26)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Bugfixes**

- Fix getting doorbell details (`@uvjim <https://github.com/fronzbot/blinkpy/pull/584>`__)
- Potential fix for mixed camera usage (`#590 <https://github.com/fronzbot/blinkpy/pull/590>`__)

**Other Changes**

- doc update (`@dwaltsch <https://github.com/fronzbot/blinkpy/pull/579>`__)
- Test re-factoring (`#591 <https://github.com/fronzbot/blinkpy/pull/591>`__)
- Bump pylint to 2.14.3
- Bump coverage to 6.41
- Bump black to 22.3.0


0.19.0 (2022-03-20)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ Start Developing
-----------------

1. Setup Local Repository

.. code:: bash

$ git clone https://github.com/<YOUR_GIT_USERNAME>/blinkpy.git
$ cd blinkpy
$ git remote add upstream https://github.com/fronzbot/blinkpy.git

2. Create virtualenv and install dependencies

.. code:: bash

$ python -m venv venv
Expand Down
2 changes: 1 addition & 1 deletion blinkpy/blinkpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def setup_camera_list(self):
all_cameras[camera_network] = []
for camera in network["cameras"]:
all_cameras[camera_network].append(
{"name": camera["name"], "id": camera["id"]}
{"name": camera["name"], "id": camera["id"], "type": "default"}
)
mini_cameras = self.setup_owls()
lotus_cameras = self.setup_lotus()
Expand Down
4 changes: 3 additions & 1 deletion blinkpy/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ def extract_config_info(self, config):
self.serial = config.get("serial", None)
self.motion_enabled = config.get("enabled", "unknown")
self.battery_voltage = config.get("battery_voltage", None)
self.battery_state = config.get("battery_state", None)
self.battery_state = config.get("battery_state", None) or config.get(
"battery", None
)
self.temperature = config.get("temperature", None)
self.wifi_strength = config.get("wifi_strength", None)
self.product_type = config.get("type", None)
Expand Down
2 changes: 1 addition & 1 deletion blinkpy/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MAJOR_VERSION = 0
MINOR_VERSION = 19
PATCH_VERSION = 0
PATCH_VERSION = 1

__version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}.{PATCH_VERSION}"

Expand Down
3 changes: 2 additions & 1 deletion blinkpy/sync_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, blink, network_name, network_id, camera_list):
self.available = False
self.type_key_map = {
"mini": "owls",
"lotus": "doorbell",
"lotus": "doorbells",
}

@property
Expand Down Expand Up @@ -125,6 +125,7 @@ def update_cameras(self, camera_type=BlinkCamera):
type_map = {
"mini": BlinkCameraMini,
"lotus": BlinkDoorbell,
"default": BlinkCamera,
}
try:
for camera_config in self.camera_list:
Expand Down
77 changes: 0 additions & 77 deletions debug_login.py

This file was deleted.

6 changes: 3 additions & 3 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
black==22.1.0
coverage==6.3.2
black==22.3.0
coverage==6.4.1
flake8==3.9.1
flake8-docstrings==1.6.0
pre-commit==2.17.0
pylint==2.10.2
pylint==2.14.3
pydocstyle==6.0.0
pytest==7.1.1
pytest-cov==3.0.0
Expand Down
181 changes: 150 additions & 31 deletions tests/test_blinkpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,11 @@ def test_setup_cameras(self, mock_home, mock_req):
self.assertEqual(
result,
{
"1234": [{"name": "foo", "id": 5678}, {"name": "bar", "id": 5679}],
"4321": [{"name": "test", "id": 0000}],
"1234": [
{"name": "foo", "id": 5678, "type": "default"},
{"name": "bar", "id": 5679, "type": "default"},
],
"4321": [{"name": "test", "id": 0000, "type": "default"}],
},
)

Expand Down Expand Up @@ -327,35 +330,6 @@ def test_initialize_blink_doorbells(self, mock_start):
self.assertEqual(self.blink.sync["foo"].name, "foo")
self.assertEqual(self.blink.sync["bar"].name, "bar")

# def test_blink_doorbell_cameras_returned(self):
# """Test that blink doorbell cameras are found if attached to sync module."""
# self.blink.network_ids = ["1234"]
# self.blink.homescreen = {
# "doorbells": [
# {
# "id": 1,
# "name": "foo",
# "network_id": 1234,
# "onboarded": True,
# "enabled": True,
# "status": "online",
# "thumbnail": "/foo/bar",
# "serial": "abc123",
# }
# ]
# }
# result = self.blink.setup_lotus()
# self.assertEqual(self.blink.network_ids, ["1234"])
# self.assertEqual(
# result, [{"1234": {"name": "foo", "id": "1234", "type": "doorbell"}}]
# )

# self.blink.network_ids = []
# self.blink.get_homescreen()
# result = self.blink.setup_lotus()
# self.assertEqual(self.blink.network_ids, [])
# self.assertEqual(result, [])

@mock.patch("blinkpy.api.request_camera_usage")
def test_blink_doorbell_attached_to_sync(self, mock_usage):
"""Test that blink doorbell cameras are properly attached to sync module."""
Expand All @@ -380,6 +354,151 @@ def test_blink_doorbell_attached_to_sync(self, mock_usage):
result, {"1234": [{"name": "foo", "id": "1234", "type": "doorbell"}]}
)

@mock.patch("blinkpy.api.request_camera_usage")
def test_blink_multi_doorbell(self, mock_usage):
"""Test that multiple doorbells are properly attached to sync module."""
self.blink.network_ids = ["1234"]
self.blink.homescreen = {
"doorbells": [
{
"id": 1,
"name": "foo",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/foo/bar",
"serial": "abc123",
},
{
"id": 2,
"name": "bar",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/bar/foo",
"serial": "zxc456",
},
]
}
expected = {
"1234": [
{"name": "foo", "id": "1234", "type": "doorbell"},
{"name": "bar", "id": "1234", "type": "doorbell"},
]
}
mock_usage.return_value = {"networks": [{"cameras": [], "network_id": 1234}]}
result = self.blink.setup_camera_list()
self.assertEqual(result, expected)

@mock.patch("blinkpy.api.request_camera_usage")
def test_blink_multi_mini(self, mock_usage):
"""Test that multiple minis are properly attached to sync module."""
self.blink.network_ids = ["1234"]
self.blink.homescreen = {
"owls": [
{
"id": 1,
"name": "foo",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/foo/bar",
"serial": "abc123",
},
{
"id": 2,
"name": "bar",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/bar/foo",
"serial": "zxc456",
},
]
}
expected = {
"1234": [
{"name": "foo", "id": "1234", "type": "mini"},
{"name": "bar", "id": "1234", "type": "mini"},
]
}
mock_usage.return_value = {"networks": [{"cameras": [], "network_id": 1234}]}
result = self.blink.setup_camera_list()
self.assertEqual(result, expected)

@mock.patch("blinkpy.api.request_camera_usage")
def test_blink_camera_mix(self, mock_usage):
"""Test that a mix of cameras are properly attached to sync module."""
self.blink.network_ids = ["1234"]
self.blink.homescreen = {
"doorbells": [
{
"id": 1,
"name": "foo",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/foo/bar",
"serial": "abc123",
},
{
"id": 2,
"name": "bar",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/bar/foo",
"serial": "zxc456",
},
],
"owls": [
{
"id": 3,
"name": "dead",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/dead/beef",
"serial": "qwerty",
},
{
"id": 4,
"name": "beef",
"network_id": 1234,
"onboarded": True,
"enabled": True,
"status": "online",
"thumbnail": "/beef/dead",
"serial": "dvorak",
},
],
}
expected = {
"1234": [
{"name": "foo", "id": "1234", "type": "doorbell"},
{"name": "bar", "id": "1234", "type": "doorbell"},
{"name": "dead", "id": "1234", "type": "mini"},
{"name": "beef", "id": "1234", "type": "mini"},
{"name": "normal", "id": "1234", "type": "default"},
]
}
mock_usage.return_value = {
"networks": [
{"cameras": [{"name": "normal", "id": "1234"}], "network_id": 1234}
]
}
result = self.blink.setup_camera_list()
self.assertTrue("1234" in result)
for element in result["1234"]:
self.assertTrue(element in expected["1234"])


class MockSync:
"""Mock sync module class."""
Expand Down
Loading