Skip to content

Add dump service to MQTT integration#31370

Merged
balloob merged 2 commits into
devfrom
mqtt-dump-service
Feb 2, 2020
Merged

Add dump service to MQTT integration#31370
balloob merged 2 commits into
devfrom
mqtt-dump-service

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Feb 1, 2020

Breaking change

Proposed change

The new Z-Wave integration we're working on is based on MQTT. To help with debugging it's useful to be able to dump a whole OZW instance to a file.

I think that this can also be useful for debugging other integrations that are based on MQTT (zigbee2MQTT comes to mind).

To use the dumps in your Python code to replay them:

    with open(file_path, "rt") as fp:
        for line in fp:
            topic, payload = line.strip().split(",", 1)

What do people think of this feature?

Docs: https://github.com/home-assistant/home-assistant.io/pull/11955/files

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

@probot-home-assistant
Copy link
Copy Markdown

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (mqtt) you are listed as a codeowner for? Thanks!

Comment thread homeassistant/components/mqtt/__init__.py

async def async_dump_service(call: ServiceCall):
"""Handle MQTT dump service calls."""
messages = []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe the nonblock deque from collection they can limit the size and work as a ring buffer? So you have a third service option to limit the amount of messages?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since it's for debugging, we really want to have all the messages.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 1, 2020

Codecov Report

Merging #31370 into dev will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #31370      +/-   ##
==========================================
+ Coverage   94.60%   94.62%   +0.02%     
==========================================
  Files         743      748       +5     
  Lines       53913    54128     +215     
==========================================
+ Hits        51004    51221     +217     
+ Misses       2909     2907       -2     
Impacted Files Coverage Δ
homeassistant/components/hue/bridge.py 75.49% <0.00%> (ø) ⬆️
homeassistant/components/tplink/light.py 95.97% <0.00%> (-0.58%) ⬇️
homeassistant/helpers/entity.py 96.50% <0.00%> (-0.35%) ⬇️
homeassistant/helpers/service.py 92.47% <0.00%> (ø) ⬆️
homeassistant/components/zwave/light.py 99.00% <0.00%> (ø) ⬆️
homeassistant/helpers/script.py 98.12% <0.00%> (ø) ⬆️
homeassistant/components/hue/binary_sensor.py 100.00% <0.00%> (ø) ⬆️
homeassistant/components/emulated_hue/hue_api.py 90.51% <0.00%> (ø) ⬆️
homeassistant/components/mikrotik/const.py 100.00% <0.00%> (ø)
homeassistant/components/vizio/media_player.py 100.00% <0.00%> (ø)
... and 8 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 0c1acc5...d6f799c. Read the comment docs.

@balloob balloob added this to the 0.105.0 milestone Feb 2, 2020
@balloob
Copy link
Copy Markdown
Member Author

balloob commented Feb 2, 2020

Tagging this for the 105 so that it can help boost Z-Wave development.

@balloob balloob merged commit 81dbdc6 into dev Feb 2, 2020
@delete-merged-branch delete-merged-branch Bot deleted the mqtt-dump-service branch February 2, 2020 23:01
balloob added a commit that referenced this pull request Feb 2, 2020
* Add dump service to MQTT integration

* Lint
@lock lock Bot locked and limited conversation to collaborators Feb 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants