Skip to content

Add an HTTP view to dump the Z-Wave JS state#45452

Merged
bramkragten merged 9 commits intodevfrom
zwavejs-dump-view
Jan 26, 2021
Merged

Add an HTTP view to dump the Z-Wave JS state#45452
bramkragten merged 9 commits intodevfrom
zwavejs-dump-view

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Jan 23, 2021

Breaking change

Proposed change

Adds an HTTP view to download a dump of the Z-Wave JS server state. This will help people provide data for debugging.

Note, this is an HTTP POST endpoint that requires authentication and triggers a download. To make this work in the frontend, create a form that has as URL a signed path.

@bramkragten have we done an HTTP POST to download before, any code examples you can link?

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

To help with the load of incoming pull requests:

@elupus
Copy link
Copy Markdown
Contributor

elupus commented Jan 23, 2021

Since I just literally thought about the need for something similar. Could we perhaps generalize it a bit. Allowing asking for debug data for any config entry?

@MartinHjelmare MartinHjelmare self-assigned this Jan 25, 2021
@balloob
Copy link
Copy Markdown
Member Author

balloob commented Jan 25, 2021

@elupus not sure what part we can generalize, since the implementation is integration specific. I guess some "Support dump for debugging" feature could be added to a config entry as an option

@MartinHjelmare MartinHjelmare removed their assignment Jan 25, 2021
@MartinHjelmare
Copy link
Copy Markdown
Member

We need to rebase after the library bump.

@balloob balloob requested review from bramkragten and removed request for bramkragten January 25, 2021 12:04
@elupus
Copy link
Copy Markdown
Contributor

elupus commented Jan 25, 2021

That was the idea. Just making a hooking function same as async_setup_entry(entry), like async_dump_debug_info(entry) with a way to trigger from gui and get it's output.

Keeping frontend code agnostic to which integration is dumping debug data.

@balloob
Copy link
Copy Markdown
Member Author

balloob commented Jan 25, 2021

@elupus I like that idea. Let's do that in a new PR. I think that we should start allowing some flags to be set during async_setup_entry. We shouldn't persist that we can debug, as downgrade could happen or functionality could be removed.

async_setup_entry(hass, entry):
    # Maybe something like this?
    entry.set_features(entry.FEATURE_DEBUG_DUMP)
    # Or maybe even just pass the function
    entry.set_debug_dump_creator(async_create_dump)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Copy link
Copy Markdown
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.

@bramkragten go ahead and merge here when you're happy. 👍

@bramkragten bramkragten merged commit b9a525a into dev Jan 26, 2021
@bramkragten bramkragten deleted the zwavejs-dump-view branch January 26, 2021 09:27
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2021
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.

6 participants