From 804579cd547ee984deb5328db84517838d198bcc Mon Sep 17 00:00:00 2001
From: Guido Schmitz <Shutgun@users.noreply.github.com>
Date: Mon, 9 Nov 2020 12:17:35 +0100
Subject: [PATCH] Update devolo-home-control-api to 0.16.0 (#42944)

---
 .../components/devolo_home_control/__init__.py        |  9 +++------
 .../components/devolo_home_control/config_flow.py     | 11 +----------
 homeassistant/components/devolo_home_control/const.py |  2 --
 .../components/devolo_home_control/manifest.json      |  2 +-
 requirements_all.txt                                  |  2 +-
 requirements_test_all.txt                             |  2 +-
 .../devolo_home_control/test_config_flow.py           |  3 ---
 7 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/homeassistant/components/devolo_home_control/__init__.py b/homeassistant/components/devolo_home_control/__init__.py
index 7607a4a8f16..96d52b57e85 100644
--- a/homeassistant/components/devolo_home_control/__init__.py
+++ b/homeassistant/components/devolo_home_control/__init__.py
@@ -12,7 +12,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, EVENT_HOMEASSISTAN
 from homeassistant.exceptions import ConfigEntryNotReady
 from homeassistant.helpers.typing import HomeAssistantType
 
-from .const import CONF_HOMECONTROL, CONF_MYDEVOLO, DOMAIN, PLATFORMS
+from .const import CONF_MYDEVOLO, DOMAIN, PLATFORMS
 
 
 async def async_setup(hass, config):
@@ -24,11 +24,8 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
     """Set up the devolo account from a config entry."""
     conf = entry.data
     hass.data.setdefault(DOMAIN, {})
-    try:
-        mydevolo = Mydevolo.get_instance()
-    except SyntaxError:
-        mydevolo = Mydevolo()
 
+    mydevolo = Mydevolo()
     mydevolo.user = conf[CONF_USERNAME]
     mydevolo.password = conf[CONF_PASSWORD]
     mydevolo.url = conf[CONF_MYDEVOLO]
@@ -52,8 +49,8 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
                     partial(
                         HomeControl,
                         gateway_id=gateway_id,
+                        mydevolo_instance=mydevolo,
                         zeroconf_instance=zeroconf_instance,
-                        url=conf[CONF_HOMECONTROL],
                     )
                 )
             )
diff --git a/homeassistant/components/devolo_home_control/config_flow.py b/homeassistant/components/devolo_home_control/config_flow.py
index cde55ebb4bf..67803ec56be 100644
--- a/homeassistant/components/devolo_home_control/config_flow.py
+++ b/homeassistant/components/devolo_home_control/config_flow.py
@@ -9,9 +9,7 @@ from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
 from homeassistant.core import callback
 
 from .const import (  # pylint:disable=unused-import
-    CONF_HOMECONTROL,
     CONF_MYDEVOLO,
-    DEFAULT_MPRM,
     DEFAULT_MYDEVOLO,
     DOMAIN,
 )
@@ -39,24 +37,18 @@ class DevoloHomeControlFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
                 vol.Required(CONF_USERNAME): str,
                 vol.Required(CONF_PASSWORD): str,
                 vol.Required(CONF_MYDEVOLO, default=DEFAULT_MYDEVOLO): str,
-                vol.Required(CONF_HOMECONTROL, default=DEFAULT_MPRM): str,
             }
         if user_input is None:
             return self._show_form(user_input)
         user = user_input[CONF_USERNAME]
         password = user_input[CONF_PASSWORD]
-        try:
-            mydevolo = Mydevolo.get_instance()
-        except SyntaxError:
-            mydevolo = Mydevolo()
+        mydevolo = Mydevolo()
         mydevolo.user = user
         mydevolo.password = password
         if self.show_advanced_options:
             mydevolo.url = user_input[CONF_MYDEVOLO]
-            mprm = user_input[CONF_HOMECONTROL]
         else:
             mydevolo.url = DEFAULT_MYDEVOLO
-            mprm = DEFAULT_MPRM
         credentials_valid = await self.hass.async_add_executor_job(
             mydevolo.credentials_valid
         )
@@ -73,7 +65,6 @@ class DevoloHomeControlFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
                 CONF_PASSWORD: password,
                 CONF_USERNAME: user,
                 CONF_MYDEVOLO: mydevolo.url,
-                CONF_HOMECONTROL: mprm,
             },
         )
 
diff --git a/homeassistant/components/devolo_home_control/const.py b/homeassistant/components/devolo_home_control/const.py
index 08f9f99079e..ea46ea44846 100644
--- a/homeassistant/components/devolo_home_control/const.py
+++ b/homeassistant/components/devolo_home_control/const.py
@@ -2,7 +2,5 @@
 
 DOMAIN = "devolo_home_control"
 DEFAULT_MYDEVOLO = "https://www.mydevolo.com"
-DEFAULT_MPRM = "https://homecontrol.mydevolo.com"
 PLATFORMS = ["binary_sensor", "climate", "cover", "light", "sensor", "switch"]
 CONF_MYDEVOLO = "mydevolo_url"
-CONF_HOMECONTROL = "home_control_url"
diff --git a/homeassistant/components/devolo_home_control/manifest.json b/homeassistant/components/devolo_home_control/manifest.json
index ce61fa121a4..0ffa991493c 100644
--- a/homeassistant/components/devolo_home_control/manifest.json
+++ b/homeassistant/components/devolo_home_control/manifest.json
@@ -2,7 +2,7 @@
   "domain": "devolo_home_control",
   "name": "devolo Home Control",
   "documentation": "https://www.home-assistant.io/integrations/devolo_home_control",
-  "requirements": ["devolo-home-control-api==0.15.1"],
+  "requirements": ["devolo-home-control-api==0.16.0"],
   "after_dependencies": ["zeroconf"],
   "config_flow": true,
   "codeowners": ["@2Fake", "@Shutgun"],
diff --git a/requirements_all.txt b/requirements_all.txt
index 621ba2b8d41..5ec9c9b6d72 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -484,7 +484,7 @@ deluge-client==1.7.1
 denonavr==0.9.5
 
 # homeassistant.components.devolo_home_control
-devolo-home-control-api==0.15.1
+devolo-home-control-api==0.16.0
 
 # homeassistant.components.directv
 directv==0.3.0
diff --git a/requirements_test_all.txt b/requirements_test_all.txt
index 763dc77be22..1553395980b 100644
--- a/requirements_test_all.txt
+++ b/requirements_test_all.txt
@@ -257,7 +257,7 @@ defusedxml==0.6.0
 denonavr==0.9.5
 
 # homeassistant.components.devolo_home_control
-devolo-home-control-api==0.15.1
+devolo-home-control-api==0.16.0
 
 # homeassistant.components.directv
 directv==0.3.0
diff --git a/tests/components/devolo_home_control/test_config_flow.py b/tests/components/devolo_home_control/test_config_flow.py
index 25d42a266dc..ad99f13e8f6 100644
--- a/tests/components/devolo_home_control/test_config_flow.py
+++ b/tests/components/devolo_home_control/test_config_flow.py
@@ -40,7 +40,6 @@ async def test_form(hass):
     assert result2["data"] == {
         "username": "test-username",
         "password": "test-password",
-        "home_control_url": "https://homecontrol.mydevolo.com",
         "mydevolo_url": "https://www.mydevolo.com",
     }
 
@@ -114,7 +113,6 @@ async def test_form_advanced_options(hass):
             {
                 "username": "test-username",
                 "password": "test-password",
-                "home_control_url": "https://test_url.test",
                 "mydevolo_url": "https://test_mydevolo_url.test",
             },
         )
@@ -125,7 +123,6 @@ async def test_form_advanced_options(hass):
     assert result2["data"] == {
         "username": "test-username",
         "password": "test-password",
-        "home_control_url": "https://test_url.test",
         "mydevolo_url": "https://test_mydevolo_url.test",
     }
 
-- 
GitLab