Skip to content

Add Twitch subscription and additional stats#31122

Merged
balloob merged 6 commits into
home-assistant:devfrom
Poeschl:twitch-sub
Feb 18, 2020
Merged

Add Twitch subscription and additional stats#31122
balloob merged 6 commits into
home-assistant:devfrom
Poeschl:twitch-sub

Conversation

@Poeschl
Copy link
Copy Markdown
Contributor

@Poeschl Poeschl commented Jan 23, 2020

Breaking change

Proposed change

This change adds more stats about the specified streamer as well as the opportunity to check follow and subscription status.
There are also tests for all functionalities

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
sensor:
  platform: twitch
  client_id: <client_id>
  oauth_token: <oauth_token>
  channels:
    - gronkh

To get the oauth_token take a look to the doc PR.

Additional information

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

@Poeschl Poeschl changed the title Twitch sub Twitch subscription and additional stats Jan 23, 2020
@Poeschl
Copy link
Copy Markdown
Contributor Author

Poeschl commented Jan 23, 2020

I wrote tests to ensure the integration is working correctly, but I can't get the mocks to work in the correct way.
It would be nice, to have some help with them.

They work if executed one by one but not when executed together.

@springstan springstan changed the title Twitch subscription and additional stats Add Twitch subscription and additional stats Feb 1, 2020
@springstan springstan added dependency Pull requests marked as a dependency upgrade and removed dependency Pull requests marked as a dependency upgrade labels Feb 1, 2020
Comment thread tests/components/twitch/test_twitch.py Outdated
@timmo001 timmo001 mentioned this pull request Feb 8, 2020
20 tasks
@Poeschl Poeschl requested a review from springstan February 17, 2020 09:35
Comment thread homeassistant/components/twitch/sensor.py Outdated
Comment thread tests/components/twitch/test_twitch.py
Comment thread tests/components/twitch/test_twitch.py
@Poeschl Poeschl requested a review from springstan February 18, 2020 08:06
Copy link
Copy Markdown
Member

@springstan springstan left a comment

Choose a reason for hiding this comment

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

LGTM ✌ just one small suggestion:

Comment thread homeassistant/components/twitch/sensor.py Outdated
@springstan
Copy link
Copy Markdown
Member

You will need to adjust the tests as well I think :)

Lets be consistent

Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com>
@Poeschl
Copy link
Copy Markdown
Contributor Author

Poeschl commented Feb 18, 2020

Done :D

@balloob balloob merged commit 245482d into home-assistant:dev Feb 18, 2020
def device_state_attributes(self):
"""Return the state attributes."""
attr = {
ATTR_FRIENDLY_NAME: self._channel.display_name,
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.

We don't set this state attribute. Setting the name property is enough.

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2020

I hope it's appropriate to comment here, I wanted to bring to light an issue I have posted that may be relevant to implement during this change. #32050 Thank you.

@lock lock Bot locked and limited conversation to collaborators Feb 22, 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.

5 participants