-
-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Bump pyisy to 3.6.1 and modernize TLS handling for isy994 #170136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eb523d7
598cbc9
06f4a46
7089b6b
b41568b
89883bc
663b360
afb3c16
c6dfe8f
b87474e
85c3a64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| CONF_PASSWORD, | ||
| CONF_USERNAME, | ||
| CONF_VARIABLES, | ||
| CONF_VERIFY_SSL, | ||
| EVENT_HOMEASSISTANT_STOP, | ||
| Platform, | ||
| ) | ||
|
|
@@ -31,9 +32,9 @@ | |
| CONF_IGNORE_STRING, | ||
| CONF_NETWORK, | ||
| CONF_SENSOR_STRING, | ||
| CONF_TLS_VER, | ||
| DEFAULT_IGNORE_STRING, | ||
| DEFAULT_SENSOR_STRING, | ||
| DEFAULT_VERIFY_SSL, | ||
| DOMAIN, | ||
| ISY_CONF_FIRMWARE, | ||
| ISY_CONF_MODEL, | ||
|
|
@@ -62,6 +63,16 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: | |
| return True | ||
|
|
||
|
|
||
| async def async_migrate_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool: | ||
| """Migrate old config entries.""" | ||
| if entry.version == 1 and entry.minor_version == 1: | ||
| new_data = {key: value for key, value in entry.data.items() if key != "tls"} | ||
| new_data.setdefault(CONF_VERIFY_SSL, DEFAULT_VERIFY_SSL) | ||
| hass.config_entries.async_update_entry(entry, data=new_data, minor_version=2) | ||
|
|
||
| return True | ||
|
Comment on lines
+66
to
+73
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So in a way I am like, by bumping the major version and removing the value, we kinda eliminate the ability to rollback for people, so I'd almost just avoid migrating
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will re-work it to just add the new config option and silently ignore the old
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reworked in b41568b to use
Comment on lines
+66
to
+73
|
||
|
|
||
|
|
||
| async def async_setup_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool: | ||
| """Set up the ISY 994 integration.""" | ||
| isy_config = entry.data | ||
|
|
@@ -71,9 +82,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool: | |
| user = isy_config[CONF_USERNAME] | ||
| password = isy_config[CONF_PASSWORD] | ||
| host = urlparse(isy_config[CONF_HOST]) | ||
|
|
||
| # Optional | ||
| tls_version = isy_config.get(CONF_TLS_VER) | ||
| verify_ssl = isy_config[CONF_VERIFY_SSL] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is contrary to reviewer's original suggestion to NOT use .get(). Holding for @joostlek's preference. |
||
| ignore_identifier = isy_options.get(CONF_IGNORE_STRING, DEFAULT_IGNORE_STRING) | ||
| sensor_identifier = isy_options.get(CONF_SENSOR_STRING, DEFAULT_SENSOR_STRING) | ||
|
|
||
|
|
@@ -86,7 +95,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool: | |
| elif host.scheme == SCHEME_HTTPS: | ||
| https = True | ||
| port = host.port or 443 | ||
| session = aiohttp_client.async_get_clientsession(hass) | ||
| session = aiohttp_client.async_get_clientsession(hass, verify_ssl=verify_ssl) | ||
| else: | ||
| _LOGGER.error("The ISY/IoX host value in configuration is invalid") | ||
| return False | ||
|
|
@@ -98,7 +107,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: IsyConfigEntry) -> bool: | |
| username=user, | ||
| password=password, | ||
| use_https=https, | ||
| tls_ver=tls_version, | ||
| verify_ssl=verify_ssl, | ||
|
shbatm marked this conversation as resolved.
|
||
| webroot=host.path, | ||
| websession=session, | ||
| use_websocket=True, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", | ||
| "invalid_host": "The host entry was not in full URL format, e.g., {sample_ip}", | ||
| "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]", | ||
| "ssl_error": "TLS handshake failed. The controller may require a newer TLS version, or SSL verification may be failing due to a self-signed certificate.", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copilot doesn't like it's own suggested change... |
||
| "unknown": "[%key:common::config_flow::error::unknown%]" | ||
| }, | ||
| "flow_title": "{name} ({host})", | ||
|
|
@@ -25,8 +26,11 @@ | |
| "data": { | ||
| "host": "[%key:common::config_flow::data::url%]", | ||
| "password": "[%key:common::config_flow::data::password%]", | ||
| "tls": "The TLS version of the ISY controller.", | ||
| "username": "[%key:common::config_flow::data::username%]" | ||
| "username": "[%key:common::config_flow::data::username%]", | ||
| "verify_ssl": "[%key:common::config_flow::data::verify_ssl%]" | ||
| }, | ||
| "data_description": { | ||
| "verify_ssl": "Verify the controller's TLS certificate. Leave disabled for ISY-994/eisy/Polisy controllers using their default self-signed certificate." | ||
| }, | ||
| "description": "The host entry must be in full URL format, e.g., {sample_ip}", | ||
| "title": "Connect to your ISY" | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.