Skip to content

Add ClimaCell v4 API support#47575

Merged
raman325 merged 17 commits intohome-assistant:devfrom
raman325:climacell_v4
Apr 5, 2021
Merged

Add ClimaCell v4 API support#47575
raman325 merged 17 commits intohome-assistant:devfrom
raman325:climacell_v4

Conversation

@raman325
Copy link
Copy Markdown
Contributor

@raman325 raman325 commented Mar 7, 2021

Proposed change

When I first wrote the climacell integration, v3 was the only API version available and therefore the only one supported. By the time the integration released, v3 was deprecated and v4 is the only API version that new users can sign up for. This update adds v4 support to the integration (v4 is completely different from v3 so it's almost like writing a new integration). v3 is still active but will be retired in July, so I positioned the change such that it will be easy to remove support for v3 when that occurs

Summary of changes (this PR looks bigger than it is)

  • Bump pyclimacell. Effectively I just renamed the existing classes to V3 versions and then added V4 classes. I also added a new function for V4 that grabs all of the data in the format we expect to reduce the burden on the integration. Changelog: raman325/pyclimacell@v0.14.0...v0.18.0
  • Limit timesteps to four choices. Only four choices are supported by v4 so limiting both version required less code
  • Add a new api_version key to the config entry data.
  • Migrate config entries from V1 to V2 with the schema changes applied
  • Namespace all the v3 stuff so that we can create separate constants and an Entity class for v4.
  • In the config flow, entry setup, setting the update interval, and updating data via the data coordinator, conditionally handle what the API version is and the resulting change
  • Add new V4 entity
  • Add fixtures and test weather entity states
  • Reduce v3 payload by only grabbing specific fields

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

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:

@firstof9
Copy link
Copy Markdown
Contributor

Looks like there's a merge conflict.

@raman325
Copy link
Copy Markdown
Contributor Author

Looks like there's a merge conflict.

thanks!

@Joshndroid
Copy link
Copy Markdown

This is great. Thanks @raman325
Can we get this merged already lol

Comment thread homeassistant/components/climacell/__init__.py
Comment thread homeassistant/components/climacell/config_flow.py
Comment thread tests/components/climacell/test_init.py Outdated
Comment thread homeassistant/components/climacell/__init__.py Outdated
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.

Looks good!

@raman325 raman325 merged commit d0b3f76 into home-assistant:dev Apr 5, 2021
@raman325 raman325 deleted the climacell_v4 branch April 5, 2021 17:39
@frenck
Copy link
Copy Markdown
Member

frenck commented Apr 5, 2021

Opened missing documentation PR here: home-assistant/home-assistant.io#17291

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 6, 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.

Climacell API not being accepted

6 participants