Skip to content

Add opentherm_gw config flow#27148

Merged
balloob merged 4 commits into
home-assistant:devfrom
mvn23:opentherm_gw_config_flow
Oct 5, 2019
Merged

Add opentherm_gw config flow#27148
balloob merged 4 commits into
home-assistant:devfrom
mvn23:opentherm_gw_config_flow

Conversation

@mvn23
Copy link
Copy Markdown
Contributor

@mvn23 mvn23 commented Oct 3, 2019

Description:

Add support for config entries in opentherm_gw.
Existing configurations in configuration.yaml will be converted on first start and then ignored.

Related issue (if applicable): N/A

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10584

Example entry for configuration.yaml (if applicable):

N/A

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

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. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:
N/A

mvn23 added 2 commits October 3, 2019 03:57
Bump pyotgw to 0.5b0 (required for connection testing)
Existing entries in configuration.yaml will be converted to config entries and ignored in future runs.
Comment thread homeassistant/components/opentherm_gw/config_flow.py Outdated
Comment thread homeassistant/components/opentherm_gw/config_flow.py Outdated
Copy link
Copy Markdown
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

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

Please include a test for your config flow.

If you use python3 -m script.scaffold config_flow, it generates tests that are pretty much ready to use.

Remove non-essential options from config flow.
Restructure config entry data.
@mvn23
Copy link
Copy Markdown
Contributor Author

mvn23 commented Oct 4, 2019

All requested changes have been made.
With this PR we will lose the ability to configure the climate platform's precision and floor_temperature settings, this will be added back via an options flow later on.
In the mean time, precision will default to 0.5 for unit Celsius and 1.0 for unit Fahrenheit. floor_temperature will default to False.

@balloob
Copy link
Copy Markdown
Member

balloob commented Oct 5, 2019

🎉 awesome 🐬

@balloob balloob merged commit 6ae908b into home-assistant:dev Oct 5, 2019
entries = [e.data for e in self.hass.config_entries.async_entries(DOMAIN)]

if gw_id in [e[CONF_ID] for e in entries]:
return self._show_form({"base": "id_exists"})
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.

If we use the CONF_ID key instead of "base" the form will show the error message next to the corresponding form item.

"name": "Name",
"device": "Path or URL",
"id": "ID",
"precision": "Climate temperature precision",
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.

This key doesn't seem used.

"device": "Path or URL",
"id": "ID",
"precision": "Climate temperature precision",
"floor_temperature": "Floor climate temperature"
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.

As above.

except SerialException:
return self._show_form({"base": "serial_error"})

if res:
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.

When is this not true?

@@ -0,0 +1,23 @@
{
"config": {
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 add other translations in the config flow PR. Just the default English translation.

Translations are handled separately via Lokalise and synced regularly to github.

https://developers.home-assistant.io/docs/en/internationalization_backend_localization.html#translation-strings

@lock lock Bot locked and limited conversation to collaborators Oct 6, 2019
@mvn23 mvn23 deleted the opentherm_gw_config_flow branch October 18, 2019 12:04
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