From 8e2f5d9f9ccb4ddf6de443fa5649577f5bdb1761 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Thu, 20 May 2021 13:04:00 +0100
Subject: [PATCH] python3-homeassistant: Fix met component

The old API was deprecated and the met component fails. Update the
component to use the new API. This also has a dependency on
python3-pymetno 0.7.0 and that is brought in by meta-python-dunfellplus
layer.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../0001-components-met-Use-API-v2.patch      | 41 +++++++++++++++++++
 .../python3-homeassistant_%.bbappend          |  4 ++
 2 files changed, 45 insertions(+)
 create mode 100644 meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant/0001-components-met-Use-API-v2.patch

diff --git a/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant/0001-components-met-Use-API-v2.patch b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant/0001-components-met-Use-API-v2.patch
new file mode 100644
index 00000000..60d919f9
--- /dev/null
+++ b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant/0001-components-met-Use-API-v2.patch
@@ -0,0 +1,41 @@
+From 115abd1bc0d801528f2d4ef270962a171aed1b22 Mon Sep 17 00:00:00 2001
+From: Andrei Gherzan <andrei@gherzan.com>
+Date: Thu, 20 May 2021 11:38:43 +0100
+Subject: [PATCH] components/met: Use API v2
+
+Signed-off-by: Andrei Gherzan <andrei@gherzan.com>
+Upstream-status: Pending
+---
+ homeassistant/components/met/manifest.json | 2 +-
+ homeassistant/components/met/weather.py    | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/homeassistant/components/met/manifest.json b/homeassistant/components/met/manifest.json
+index 62aeaf2..4e908e3 100644
+--- a/homeassistant/components/met/manifest.json
++++ b/homeassistant/components/met/manifest.json
+@@ -3,7 +3,7 @@
+   "name": "Meteorologisk institutt (Met.no)",
+   "config_flow": true,
+   "documentation": "https://www.home-assistant.io/integrations/met",
+-  "requirements": ["pyMetno==0.4.6"],
++  "requirements": ["pyMetno==0.7.0"],
+   "dependencies": [],
+   "codeowners": ["@danielhiversen"]
+ }
+diff --git a/homeassistant/components/met/weather.py b/homeassistant/components/met/weather.py
+index 1315009..048a0aa 100644
+--- a/homeassistant/components/met/weather.py
++++ b/homeassistant/components/met/weather.py
+@@ -30,7 +30,7 @@ ATTRIBUTION = (
+ )
+ DEFAULT_NAME = "Met.no"
+ 
+-URL = "https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/1.9/"
++URL = "https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/classic"
+ 
+ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
+     {
+-- 
+2.31.1
+
diff --git a/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant_%.bbappend b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant_%.bbappend
index 2a43bd78..bef7d4e2 100644
--- a/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant_%.bbappend
+++ b/meta-ohos-blueprints/recipes-homeassistant/homeassistant/python3-homeassistant_%.bbappend
@@ -2,4 +2,8 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://0001-components-met-Use-API-v2.patch"
+
 RRECOMMENDS_${PN} += "smart-home-homeassistant-plugin"
-- 
GitLab