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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce August doorbell detail updates #32193

Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Feb 25, 2020

Breaking change

Proposed change

Reduce August doorbell detail updates

  • Doorbell images now get updates from the activity feed

  • Tests for activity updates

  • py-august now provides bridge_is_online for available state

  • py-august now provides is_standby for available state

  • py-august now provides get_doorbell_image (eliminate requests)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

* Doorbell images now get updates from the activity feed

* Tests for activity updates

* py-august now provides bridge_is_online for available state

* py-august now provides is_standby for available state

* py-august now provides get_doorbell_image (eliminate requests)
@project-bot project-bot bot added this to Needs review in Dev Feb 25, 2020
@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev Feb 25, 2020
@bdraco
Copy link
Member Author

bdraco commented Feb 25, 2020

@MartinHjelmare This resolves the camera image fetch issue happening outside of py-august noted in #32044

@codecov
Copy link

codecov bot commented Feb 25, 2020

Codecov Report

Merging #32193 into dev will increase coverage by <.01%.
The diff coverage is 95.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #32193      +/-   ##
==========================================
+ Coverage   94.74%   94.75%   +<.01%     
==========================================
  Files         772      772              
  Lines       55885    55885              
==========================================
+ Hits        52951    52952       +1     
+ Misses       2934     2933       -1
Impacted Files Coverage 螖
homeassistant/helpers/aiohttp_client.py 95.29% <酶> (酶) 猬嗭笍
setup.py 88.02% <酶> (酶) 猬嗭笍
homeassistant/components/recorder/models.py 93.87% <酶> (酶) 猬嗭笍
...meassistant/components/homekit_controller/const.py 100% <酶> (酶) 猬嗭笍
homeassistant/generated/config_flows.py 100% <酶> (酶) 猬嗭笍
homeassistant/util/json.py 85.5% <100%> (酶) 猬嗭笍
...ant/components/homekit_controller/binary_sensor.py 100% <100%> (酶) 猬嗭笍
...eassistant/components/websocket_api/permissions.py 100% <100%> (酶) 猬嗭笍
homeassistant/helpers/config_validation.py 96.01% <100%> (酶) 猬嗭笍
homeassistant/components/lovelace/const.py 100% <100%> (酶) 猬嗭笍
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update daa0dd4...7e29506. Read the comment docs.

@bdraco bdraco mentioned this pull request Feb 26, 2020
20 tasks
Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

Dev automation moved this from By Code Owner to Reviewer approved Feb 26, 2020
@MartinHjelmare MartinHjelmare merged commit 638a302 into home-assistant:dev Feb 26, 2020
Dev automation moved this from Reviewer approved to Done Feb 26, 2020
@balloob
Copy link
Member

balloob commented Feb 27, 2020

I think that this PR (or one of the other recent August PRs) have introduced a flaky test:

___________________ test_create_doorbell_with_motion[pyloop] ___________________
[gw1] linux -- Python 3.7.0 /__w/1/s/venv/bin/python

hass = <homeassistant.core.HomeAssistant object at 0x7f201113bac8>

    async def test_create_doorbell_with_motion(hass):
        """Test creation of a doorbell."""
        doorbell_one = await _mock_doorbell_from_fixture(hass, "get_doorbell.json")
        doorbell_details = [doorbell_one]
        activities = await _mock_activities_from_fixture(
            hass, "get_activity.doorbell_motion.json"
        )
        await _create_august_with_devices(hass, doorbell_details, activities=activities)
    
        binary_sensor_k98gidt45gul_name_motion = hass.states.get(
            "binary_sensor.k98gidt45gul_name_motion"
        )
>       assert binary_sensor_k98gidt45gul_name_motion.state == STATE_ON
E       AssertionError: assert 'off' == 'on'
E         - off
E         + on

tests/components/august/test_binary_sensor.py:110: AssertionError

https://dev.azure.com/home-assistant/Core/_build/results?buildId=29261&view=logs&j=67510a0b-4400-5e74-cb95-9572caf5ca54&t=f8fe93fb-5ebb-59cc-455e-c0f2d9ad3a42&l=233

@bdraco
Copy link
Member Author

bdraco commented Feb 27, 2020

I think that this PR (or one of the other recent August PRs) have introduced a flaky test:

___________________ test_create_doorbell_with_motion[pyloop] ___________________
[gw1] linux -- Python 3.7.0 /__w/1/s/venv/bin/python

hass = <homeassistant.core.HomeAssistant object at 0x7f201113bac8>

    async def test_create_doorbell_with_motion(hass):
        """Test creation of a doorbell."""
        doorbell_one = await _mock_doorbell_from_fixture(hass, "get_doorbell.json")
        doorbell_details = [doorbell_one]
        activities = await _mock_activities_from_fixture(
            hass, "get_activity.doorbell_motion.json"
        )
        await _create_august_with_devices(hass, doorbell_details, activities=activities)
    
        binary_sensor_k98gidt45gul_name_motion = hass.states.get(
            "binary_sensor.k98gidt45gul_name_motion"
        )
>       assert binary_sensor_k98gidt45gul_name_motion.state == STATE_ON
E       AssertionError: assert 'off' == 'on'
E         - off
E         + on

tests/components/august/test_binary_sensor.py:110: AssertionError

https://dev.azure.com/home-assistant/Core/_build/results?buildId=29261&view=logs&j=67510a0b-4400-5e74-cb95-9572caf5ca54&t=f8fe93fb-5ebb-59cc-455e-c0f2d9ad3a42&l=233

@balloob There is a race condition here where the activity doesn't get streamed in soon enough. I think this should be fixed in #32197

Ideally this would block until the activity update is done, but I鈥檓 not exactly sure how to instrument that without mocking the internals

@lock lock bot locked and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants