From 84e6b49a8ccbcdcc5fa23f7c715e613d9460cb98 Mon Sep 17 00:00:00 2001 From: Dmitrii Mamontov Date: Tue, 14 Mar 2023 00:16:44 +0300 Subject: [PATCH 1/4] Many bugs --- README.md | 85 +++++++++++---------- custom_components/miwifi/__init__.py | 2 +- custom_components/miwifi/button.py | 1 + custom_components/miwifi/const.py | 5 -- custom_components/miwifi/device_tracker.py | 5 +- custom_components/miwifi/enum.py | 13 +++- custom_components/miwifi/light.py | 1 + custom_components/miwifi/manifest.json | 2 +- custom_components/miwifi/select.py | 9 +-- custom_components/miwifi/sensor.py | 4 +- custom_components/miwifi/services.py | 10 ++- custom_components/miwifi/switch.py | 1 + custom_components/miwifi/update.py | 1 + hacs.json | 2 +- images/CB0401.png | Bin 0 -> 3507 bytes images/R4AV2.png | Bin 0 -> 1394 bytes images/RB02.png | Bin 0 -> 6130 bytes tests/test_update.py | 8 +- tests/test_updater_main.py | 2 - 19 files changed, 80 insertions(+), 71 deletions(-) create mode 100644 images/CB0401.png create mode 100644 images/R4AV2.png create mode 100644 images/RB02.png diff --git a/README.md b/README.md index b675a9f..72ad086 100644 --- a/README.md +++ b/README.md @@ -77,44 +77,47 @@ Many more Xiaomi and Redmi routers supported by MiWiFi - 🔴 - Not supported - ⚪ - Not tested -| Image | Router | Code | Required | Additional | Action | -|------------------------|--------------------------------------|:------:|:-------------------:|:-----------------------------------:|:---------------------:| -| ![](images/RB08.png) | **Xiaomi Home WiFi** | RB08 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RB06.png) | **Redmi Router AX6000** | RB06 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA74.png) | **Redmi Router AX5400** | RA74 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RB04.png) | **Redmi Gaming Router AX5400** | RB04 | 🟢🟢🟢🟢 | 🟢🟢⚪🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢⚪🟢🟢🟢 | -| ![](images/CR8808.png) | **Xiaomi Router CR8808** | CR8808 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA82.png) | **Xiaomi Mesh System AX3000** | RA82 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RB01.png) | **Xiaomi Router AX3200** | RB01 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA71.png) | **Redmi Router AX1800** | RA71 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RB03.png) | **Redmi Router AX6S** | RB03 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA80.png) | **Xiaomi Router AX3000** | RA80 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA81.png) | **Redmi Router AX3000** | RA81 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/CR6606.png) | **Xiaomi China Unicom WiFi 6 Router** | CR6606 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA70.png) | **Xiaomi Router AX9000** | RA70 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA50.png) | **Redmi Router AX5** | RA50 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA72.png) | **Xiaomi Router AX6000** | RA72 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA69.png) | **Redmi Router AX6** | RA69 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/R1350.png) | **Mi Router 4 Pro** | R1350 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/R2350.png) | **Mi AIoT Router AC2350** | R2350 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RA67.png) | **Redmi Router AX5** | RA67 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RM1800.png) | **Mi Router AX1800** | RM1800 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/R3600.png) | **Xiaomi AIoT Router AX3600** | R3600 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/RM2100.png) | **Redmi Router AC2100** | RM2100 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/R2100.png) | **Mi Router AC2100** | R2100 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | -| ![](images/D01.png) | **Mi Router Mesh** | D01 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R4AC.png) | **Mi Router 4A** | R4AC | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R4A.png) | **Mi Router 4A Gigabit** | R4A | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R4CM.png) | **Mi Router 4C** | R4CM | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R4C.png) | **Mi Router 4Q** | R4C | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R4.png) | **Mi Router 4** | R4 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3A.png) | **Mi Router 3A** | R3A | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3L.png) | **Mi Router 3C** | R3L | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3D.png) | **Mi Router HD** | R3D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3P.png) | **Mi Router Pro** | R3P | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3G.png) | **Mi Router 3G** | R3G | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R3.png) | **Mi Router 3** | R3 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R2D.png) | **Mi Router R2D** | R2D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R1CL.png) | **Mi Router Lite** | R1CL | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R1C.png) | **Mi Router Mini** | R1CM | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | -| ![](images/R1D.png) | **Mi Router R1D** | R1D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| Image | Router | Code | Required | Additional | Action | +|------------------------|---------------------------------------|:------:|:-------------------:|:-----------------------------------:|:-----------------------:| +| ![](images/CB0401.png) | **Xiaomi 5G CPE Pro** | CB0401 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/R4AV2.png) | **Mi Router 4A Gigabit V2** | R4AV2 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RB08.png) | **Xiaomi Home WiFi** | RB08 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RB06.png) | **Redmi Router AX6000** | RB06 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA74.png) | **Redmi Router AX5400** | RA74 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RB04.png) | **Redmi Gaming Router AX5400** | RB04 | 🟢🟢🟢🟢 | 🟢🟢⚪🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢⚪🟢🟢🟢 | +| ![](images/RB02.png) | **Xiaomi Router AC1200** | RB02 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/CR8808.png) | **Xiaomi Router CR8808** | CR8808 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA82.png) | **Xiaomi Mesh System AX3000** | RA82 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RB01.png) | **Xiaomi Router AX3200** | RB01 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA71.png) | **Redmi Router AX1800** | RA71 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RB03.png) | **Redmi Router AX6S** | RB03 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA80.png) | **Xiaomi Router AX3000** | RA80 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA81.png) | **Redmi Router AX3000** | RA81 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/CR6606.png) | **Xiaomi China Unicom WiFi 6 Router** | CR6606 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA70.png) | **Xiaomi Router AX9000** | RA70 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA50.png) | **Redmi Router AX5** | RA50 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA72.png) | **Xiaomi Router AX6000** | RA72 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA69.png) | **Redmi Router AX6** | RA69 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/R1350.png) | **Mi Router 4 Pro** | R1350 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/R2350.png) | **Mi AIoT Router AC2350** | R2350 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RA67.png) | **Redmi Router AX5** | RA67 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RM1800.png) | **Mi Router AX1800** | RM1800 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/R3600.png) | **Xiaomi AIoT Router AX3600** | R3600 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/RM2100.png) | **Redmi Router AC2100** | RM2100 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/R2100.png) | **Mi Router AC2100** | R2100 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢 | +| ![](images/D01.png) | **Mi Router Mesh** | D01 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R4AC.png) | **Mi Router 4A** | R4AC | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R4A.png) | **Mi Router 4A Gigabit** | R4A | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R4CM.png) | **Mi Router 4C** | R4CM | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R4C.png) | **Mi Router 4Q** | R4C | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R4.png) | **Mi Router 4** | R4 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3A.png) | **Mi Router 3A** | R3A | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3L.png) | **Mi Router 3C** | R3L | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3D.png) | **Mi Router HD** | R3D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3P.png) | **Mi Router Pro** | R3P | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3G.png) | **Mi Router 3G** | R3G | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R3.png) | **Mi Router 3** | R3 | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R2D.png) | **Mi Router R2D** | R2D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R1CL.png) | **Mi Router Lite** | R1CL | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R1C.png) | **Mi Router Mini** | R1CM | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | +| ![](images/R1D.png) | **Mi Router R1D** | R1D | 🟢🟢🟢🟢 | 🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢🔴 | 🟢🟢🟢🟢🟢 | diff --git a/custom_components/miwifi/__init__.py b/custom_components/miwifi/__init__.py index 5b61f58..b3f0de0 100644 --- a/custom_components/miwifi/__init__.py +++ b/custom_components/miwifi/__init__.py @@ -97,7 +97,7 @@ async def async_start(with_sleep: bool = False) -> None: if with_sleep: await asyncio.sleep(DEFAULT_SLEEP) - hass.config_entries.async_setup_platforms(entry, PLATFORMS) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) if is_new: await async_start() diff --git a/custom_components/miwifi/button.py b/custom_components/miwifi/button.py index 9128c7c..8c1112d 100644 --- a/custom_components/miwifi/button.py +++ b/custom_components/miwifi/button.py @@ -60,6 +60,7 @@ async def async_setup_entry( async_add_entities(entities) +# pylint: disable=too-many-ancestors class MiWifiButton(MiWifiEntity, ButtonEntity): """MiWifi button entry.""" diff --git a/custom_components/miwifi/const.py b/custom_components/miwifi/const.py index 8a08b46..c876121 100644 --- a/custom_components/miwifi/const.py +++ b/custom_components/miwifi/const.py @@ -71,11 +71,6 @@ CLIENT_NONCE_TYPE: Final = 0 CLIENT_PUBLIC_KEY: Final = "a2ffa5c9be07488bbb04a3a47d3c5f6a" -"""Device classes""" -DEVICE_CLASS_MIWIFI_SIGNAL_STRENGTH: Final = "miwifi__signal_strength" -DEVICE_CLASS_MIWIFI_DEVICE_TRACKER: Final = "miwifi__device_tracker" -DEVICE_CLASS_MIWIFI_MODE: Final = "miwifi__mode" - """Services""" SERVICE_CALC_PASSWD: Final = "calc_passwd" SERVICE_REQUEST: Final = "request" diff --git a/custom_components/miwifi/device_tracker.py b/custom_components/miwifi/device_tracker.py index ba75144..64ba1dc 100644 --- a/custom_components/miwifi/device_tracker.py +++ b/custom_components/miwifi/device_tracker.py @@ -45,12 +45,11 @@ CONF_STAY_ONLINE, DEFAULT_CALL_DELAY, DEFAULT_STAY_ONLINE, - DEVICE_CLASS_MIWIFI_DEVICE_TRACKER, DOMAIN, SIGNAL_NEW_DEVICE, UPDATER, ) -from .enum import Connection +from .enum import Connection, DeviceClass from .helper import ( detect_manufacturer, generate_entity_id, @@ -147,7 +146,7 @@ class MiWifiDeviceTracker(ScannerEntity, CoordinatorEntity): """MiWifi device tracker entry.""" _attr_attribution: str = ATTRIBUTION - _attr_device_class: str = DEVICE_CLASS_MIWIFI_DEVICE_TRACKER + _attr_device_class: str = DeviceClass.DEVICE_TRACKER _configuration_port: int | None = None _is_connected: bool = False diff --git a/custom_components/miwifi/enum.py b/custom_components/miwifi/enum.py index 620a69d..5c36888 100644 --- a/custom_components/miwifi/enum.py +++ b/custom_components/miwifi/enum.py @@ -2,7 +2,7 @@ from __future__ import annotations -from enum import Enum, IntEnum +from enum import Enum, IntEnum # type: ignore from homeassistant.backports.enum import StrEnum @@ -180,6 +180,14 @@ class EncryptionAlgorithm(StrEnum): SHA256 = "sha256" +class DeviceClass(StrEnum): + """DeviceClass enum""" + + MODE = "miwifi__mode" + SIGNAL_STRENGTH = "miwifi__signal_strength" + DEVICE_TRACKER = "miwifi__device_tracker" + + class Model(str, Enum): """Model enum""" @@ -239,7 +247,10 @@ def __str__(self) -> str: RB01 = "rb01" # 2021.10.28 RA82 = "ra82" # 2021.11.01 CR8808 = "cr8808" # 2021.11.26 + RB02 = "rb02" # 2022.01.18 RB04 = "rb04" # 2022.02.17 RA74 = "ra74" # 2022.03.18 RB06 = "rb06" # 2022.04.02 RB08 = "rb08" # 2022.07.04 + R4AV2 = "r4av2" # 2022 + CB0401 = "cb0401" # 2022 diff --git a/custom_components/miwifi/light.py b/custom_components/miwifi/light.py index 3133e2e..a585907 100644 --- a/custom_components/miwifi/light.py +++ b/custom_components/miwifi/light.py @@ -68,6 +68,7 @@ async def async_setup_entry( async_add_entities(entities) +# pylint: disable=too-many-ancestors class MiWifiLight(MiWifiEntity, LightEntity): """MiWifi light entry.""" diff --git a/custom_components/miwifi/manifest.json b/custom_components/miwifi/manifest.json index 3fa5ab0..00e89bd 100644 --- a/custom_components/miwifi/manifest.json +++ b/custom_components/miwifi/manifest.json @@ -1,7 +1,7 @@ { "domain": "miwifi", "name": "MiWiFi", - "version": "2.9.0", + "version": "3.0.0", "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", "config_flow": true, diff --git a/custom_components/miwifi/select.py b/custom_components/miwifi/select.py index 92c7634..4941757 100644 --- a/custom_components/miwifi/select.py +++ b/custom_components/miwifi/select.py @@ -40,10 +40,9 @@ ATTR_WIFI_5_0_DATA, ATTR_WIFI_5_0_GAME_DATA, ATTR_WIFI_ADAPTER_LENGTH, - DEVICE_CLASS_MIWIFI_SIGNAL_STRENGTH, ) from .entity import MiWifiEntity -from .enum import Wifi +from .enum import Wifi, DeviceClass from .exceptions import LuciError from .updater import LuciUpdater, async_get_updater @@ -111,7 +110,7 @@ key=ATTR_SELECT_WIFI_2_4_SIGNAL_STRENGTH, name=ATTR_SELECT_WIFI_2_4_SIGNAL_STRENGTH_NAME, icon=ICONS[f"{ATTR_SELECT_WIFI_2_4_SIGNAL_STRENGTH}_max"], - device_class=DEVICE_CLASS_MIWIFI_SIGNAL_STRENGTH, + device_class=DeviceClass.SIGNAL_STRENGTH, entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, ), @@ -119,7 +118,7 @@ key=ATTR_SELECT_WIFI_5_0_SIGNAL_STRENGTH, name=ATTR_SELECT_WIFI_5_0_SIGNAL_STRENGTH_NAME, icon=ICONS[f"{ATTR_SELECT_WIFI_5_0_SIGNAL_STRENGTH}_max"], - device_class=DEVICE_CLASS_MIWIFI_SIGNAL_STRENGTH, + device_class=DeviceClass.SIGNAL_STRENGTH, entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, ), @@ -127,7 +126,7 @@ key=ATTR_SELECT_WIFI_5_0_GAME_SIGNAL_STRENGTH, name=ATTR_SELECT_WIFI_5_0_GAME_SIGNAL_STRENGTH_NAME, icon=ICONS[f"{ATTR_SELECT_WIFI_5_0_GAME_SIGNAL_STRENGTH}_max"], - device_class=DEVICE_CLASS_MIWIFI_SIGNAL_STRENGTH, + device_class=DeviceClass.SIGNAL_STRENGTH, entity_category=EntityCategory.CONFIG, entity_registry_enabled_default=False, ), diff --git a/custom_components/miwifi/sensor.py b/custom_components/miwifi/sensor.py index 7165a4c..416551b 100644 --- a/custom_components/miwifi/sensor.py +++ b/custom_components/miwifi/sensor.py @@ -51,9 +51,9 @@ ATTR_SENSOR_WAN_UPLOAD_SPEED, ATTR_SENSOR_WAN_UPLOAD_SPEED_NAME, ATTR_STATE, - DEVICE_CLASS_MIWIFI_MODE, ) from .entity import MiWifiEntity +from .enum import DeviceClass from .updater import LuciUpdater, async_get_updater PARALLEL_UPDATES = 0 @@ -118,7 +118,7 @@ key=ATTR_SENSOR_MODE, name=ATTR_SENSOR_MODE_NAME, icon="mdi:transit-connection-variant", - device_class=DEVICE_CLASS_MIWIFI_MODE, + device_class=DeviceClass.MODE, entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=True, ), diff --git a/custom_components/miwifi/services.py b/custom_components/miwifi/services.py index 164ed97..b3daf30 100644 --- a/custom_components/miwifi/services.py +++ b/custom_components/miwifi/services.py @@ -26,6 +26,7 @@ SERVICE_CALC_PASSWD, SERVICE_REQUEST, ) +from .exceptions import LuciError from .updater import LuciUpdater, async_get_updater _LOGGER = logging.getLogger(__name__) @@ -132,9 +133,12 @@ async def async_call_service(self, service: ServiceCallType) -> None: _data: dict = dict(service.data) - response: dict = await updater.luci.get( - uri := _data.get(CONF_URI), body := _data.get(CONF_BODY, {}) # type: ignore - ) + try: + response: dict = await updater.luci.get( + uri := _data.get(CONF_URI), body := _data.get(CONF_BODY, {}) # type: ignore + ) + except LuciError: + return device: dr.DeviceEntry | None = dr.async_get(self.hass).async_get_device( set(), diff --git a/custom_components/miwifi/switch.py b/custom_components/miwifi/switch.py index cd02314..3549f86 100644 --- a/custom_components/miwifi/switch.py +++ b/custom_components/miwifi/switch.py @@ -124,6 +124,7 @@ async def async_setup_entry( async_add_entities(entities) +# pylint: disable=too-many-ancestors class MiWifiSwitch(MiWifiEntity, SwitchEntity): """MiWifi switch entry.""" diff --git a/custom_components/miwifi/update.py b/custom_components/miwifi/update.py index 1405895..5bbd481 100644 --- a/custom_components/miwifi/update.py +++ b/custom_components/miwifi/update.py @@ -104,6 +104,7 @@ async def async_setup_entry( async_add_entities(entities) +# pylint: disable=too-many-ancestors class MiWifiUpdate(MiWifiEntity, UpdateEntity): """MiWifi update entry.""" diff --git a/hacs.json b/hacs.json index 7354b7d..69beacd 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { "name": "MiWiFi", "render_readme": true, - "homeassistant": "2022.4.0" + "homeassistant": "2023.3.0" } diff --git a/images/CB0401.png b/images/CB0401.png new file mode 100644 index 0000000000000000000000000000000000000000..04a3b4a7b6e5244243907bfa75a1be6a57389647 GIT binary patch literal 3507 zcmV;k4NUThP)Px?ZAnByRCr$Pom*^E_Z`Q7Cw5}zN-nTaShEml6tO|$Hnh_uP}NRq3t6jaQzuR1 zWl!v3F9>N*oz`kRta}-cnNSr{`YD=QaaQ26|g?;$+GfS>`80Cb={ALrs2=V8O~?Ch+Jj*iNO3l}6F zkB@BIw(aE6qeqY7c_Vj1^~mf>3bXl9JOXCAwx^fo;|DJhC(6S$Itru z`UY29TS^9GU|`^UXJ_Z$W5eF11~6l>n0)^E=kn1_R3HEdTIEGniyA>qgAkz=G;076iA0np;a)!d^i$FMd={{H^*0@B^xy%$1*U?4;sr;fdC4lDTcUun2VR7Xcaephwq_%5H{cd473Fx@i%ZxxB!b+EEXF+apFYz zXvoQvC(nmMA*CU7%+wMHl0u^Mh7g!b&;io~VGjW5{y_H$IEGNM@ffBLLI((J_zoHh z0C*3;*!Z63;hqwSM0sflfWTzwFfsul2pvqmKp0s87=)S)2+jcnzyL5p!ycdG!HCD> z!vg~Y<)tB|1_F(MK=TDc-@!dK!~pTiCWUH9AwXclXvP49VXc}F?*Y(69(r>++c>AX{}Bd+a8 zGPRKOB|MV_!D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+PN=9&oCrVs&!J6$m>va2PZ*b!O=t(pHvE zeLWTzGXcT)5cc&oK(rNhR?-b1QixOM;$8+w_8ca!GtfYV#1M zAY2`R!=SmcXEA}W{9blpZy`QJ=bXu@(}&a^!Hc^&dI??<0>R~TKVk`uS^$Mv)y2)B{z)lVt z0wB~7W3sevKuZDPd|5D6-fC(^*AV<|Xh>N$;pUqd=ITQTV>L{c0pd+SldH*smT;zq z<)(>UYI>&hY#lup_1=pn%E}W6*2)DGyr6+xdn!H3$`y#ds4?0_43Ip5a3W=xE4=h2 zR|#dgHuZE3F+jWpis4PJSf=^1mIDGa2<>ZaZ5=vs;>1t$Y6L3aAA~Am6+%DH#y$&a6X+ z4*lYlS6&%-{PD+q&CSh=U{E>-B+e?AEf3LG*I}f^>BR{v+a#Erg%tCkaGLQ*BqEVW zBz67z^efxK6YHH5;e7-%KHf@sKyLU?{6q1gP4%xVI zqqMZNsGK5GS0F}JoOVf{Zk%R}zC+g@R)e|rZ8#j3si`Tojg5`TXP!qowN$P6r zq`skEea283=jsy#AeZ2V#1Z9neYR?71FnJT^cHLxtF5iQGC4WBo>b;fkN1L@?o+# z#}(c)QA8&S+qP$e!QhvXNaQP@&-Z0AnLHkiMyHd>2=XUJa5qSCK zmm6Hyt-N{jX4U1(mr*ydT-WvEV#~6SDLQ_?Ki=5bI5ROZft9@$YAfsf^{oW5&Skoy h+cQ8`B);Nb{6D230An<%B4Pjl002ovPDHLkV1hGupDX|X literal 0 HcmV?d00001 diff --git a/images/R4AV2.png b/images/R4AV2.png new file mode 100644 index 0000000000000000000000000000000000000000..d6ce009b3a51710f11210f491164ccc22746c45d GIT binary patch literal 1394 zcmZ`%4N%f&7=Lw`W!fz5%etFI&B`ov%QosF3{oo0(5%^NT4A~DETeT+CbO=Ya%nEN zT5T@LtE~XPz%LY~R8;%|Ol1NV_=TwWMaWF|BzN0wcYE&s&-;6y_xU}~?|t6?t)M`E zCkHnNgpd;@fJB4!#2jKm;(<5QQoFY<*2<4{EpNg=9z59s(8Wo|-A0x!Pfsh44 z%szxJ;tU_h_e_xJbr_VzNF%!!E!v)TN1)&Q7HCV=3rU}k0p0OWwp#{R+o3Bu{f$cVKL zbpJaU1b`9{1|Bc~D-pz4k6;TyE4I>s`|{;Wl}ZJgL2zGRpH8RKXfz!i9qsMy;PdnI z^YZd?XN}9{@_0P()z#JA-8!gd)em=>oSe+b$;ryfVzb#LB_$~-DbS^`u&}(m94Y`S zBO?P^!!)|PyFolCgjs2|TI-;oJIo3O1p<0{dO$;0R~HCqXlMX=N~ID8_~y-<&dyGd z)YjJa>eZ{()>ef=A(zW#GFeMYOH)%*eSLjxZLLHisi~;}g)d&bsI084sHhMMg{7sX z#l^(}fq>8F7Zem&Zv+?Na5&A)&5ezXQmM4Au1+i#i$tQbva+J0B6toN-GK)$9m=2u z1|uphfp@Q--IWcZ-<$28B=N+%KjlxqA=uF5O~I)TsfVSqt@uY-i_E5lu`w#ePW-b> z7mInpg($VsY?-noPo;WYZZEYp@@U3>X``igG;voPpjb9}EqY2`x<(H=JT3<{NO z-($DX)fZDN%fE<_tp|lf3^}bHRM-c*5M3)q!pU|A3`q`4FdN%<=FV@w^4iyaL-eL) zj%g^FV#sCM*e=@Wx|pz`urxCLewpgRg}x-=4812(E$obmt*z=#bf25}Dz|glsU*y%L{^c_LehVOK0#b~%$s0=v`gVQG(@1qWb|-(i~BZmcaULy~|`jWsR_nt0{^bF#UXaDTe5bX^56L|iFzEObv2<9F56;KO3%A9~duxaf4!`A7JkG}xhr{D=r$Z!u|00}?IT;lh_y2_D R^Uh5J0a3_-B(7h0;$I}5C`JGP literal 0 HcmV?d00001 diff --git a/images/RB02.png b/images/RB02.png new file mode 100644 index 0000000000000000000000000000000000000000..2c24225d34037e7fe0f27aa495a0e9b6e65bf65c GIT binary patch literal 6130 zcmX|lc|4SF)cy>E$vPy-lEGk#5Wb9TV~fcWF+x$w*s{y6tXab}w(OCpv4n`olD#Iz zlBKc5*mv2t{2uS;_r8D3^ZfJNXU=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), patch( "custom_components.miwifi.update.asyncio.sleep", return_value=None - ) as mock_asyncio_sleep, patch( + ), patch( "custom_components.miwifi.device_tracker.socket.socket" ) as mock_socket: mock_socket.return_value.recv.return_value = AsyncMock(return_value=None) @@ -390,8 +390,6 @@ def _on() -> dict: limit=None, ) - assert len(mock_asyncio_sleep.mock_calls) == 739 - @pytest.mark.asyncio async def test_install_flash_error(hass: HomeAssistant) -> None: @@ -408,7 +406,7 @@ async def test_install_flash_error(hass: HomeAssistant) -> None: "custom_components.miwifi.async_start_discovery", return_value=None ), patch( "custom_components.miwifi.update.asyncio.sleep", return_value=None - ) as mock_asyncio_sleep, patch( + ), patch( "custom_components.miwifi.device_tracker.socket.socket" ) as mock_socket: mock_socket.return_value.recv.return_value = AsyncMock(return_value=None) @@ -463,8 +461,6 @@ def _on() -> dict: limit=None, ) - assert len(mock_asyncio_sleep.mock_calls) == 18 - @pytest.mark.asyncio async def test_install_error(hass: HomeAssistant) -> None: diff --git a/tests/test_updater_main.py b/tests/test_updater_main.py index 5cbe951..0c2368d 100644 --- a/tests/test_updater_main.py +++ b/tests/test_updater_main.py @@ -150,8 +150,6 @@ async def test_updater_login_fail(hass: HomeAssistant) -> None: await hass.async_block_till_done() assert updater.code == codes.FORBIDDEN - assert len(mock_asyncio_sleep.mock_calls) == 14 - assert len(mock_luci_client.mock_calls) == 13 @pytest.mark.asyncio From 6c440cd78a4817835800a21ffc8067e21a1daa64 Mon Sep 17 00:00:00 2001 From: Dmitrii Mamontov Date: Tue, 14 Mar 2023 00:21:34 +0300 Subject: [PATCH 2/4] Fix sort --- custom_components/miwifi/manifest.json | 146 +++++++++++++++++++------ hacs.json | 6 +- 2 files changed, 114 insertions(+), 38 deletions(-) diff --git a/custom_components/miwifi/manifest.json b/custom_components/miwifi/manifest.json index 00e89bd..48c96f3 100644 --- a/custom_components/miwifi/manifest.json +++ b/custom_components/miwifi/manifest.json @@ -1,15 +1,116 @@ { - "domain": "miwifi", - "name": "MiWiFi", - "version": "3.0.0", - "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", - "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", + "codeowners": [ + "@dmamontov" + ], "config_flow": true, - "requirements": [], - "dependencies": ["http"], - "codeowners": ["@dmamontov"], + "dependencies": [ + "http" + ], + "dhcp": [ + { + "hostname": "miwifi-*", + "macaddress": "C85CCC*" + }, + { + "hostname": "miwifi-*", + "macaddress": "D43538*" + }, + { + "hostname": "miwifi-*", + "macaddress": "649E31*" + }, + { + "hostname": "miwifi-*", + "macaddress": "5C0214*" + }, + { + "hostname": "miwifi-*", + "macaddress": "CCB5D1*" + }, + { + "hostname": "miwifi-*", + "macaddress": "68ABBC*" + }, + { + "hostname": "miwifi-*", + "macaddress": "8CDEF9*" + }, + { + "hostname": "miwifi-*", + "macaddress": "DCED83*" + }, + { + "hostname": "miwifi-*", + "macaddress": "3CCD57*" + }, + { + "hostname": "miwifi-*", + "macaddress": "64644A*" + }, + { + "hostname": "miwifi-*", + "macaddress": "5448E6*" + }, + { + "hostname": "miwifi-*", + "macaddress": "6490C1*" + }, + { + "hostname": "miwifi-*", + "macaddress": "44237C*" + }, + { + "hostname": "miwifi-*", + "macaddress": "5CE50C*" + }, + { + "hostname": "miwifi-*", + "macaddress": "50D2F5*" + }, + { + "hostname": "miwifi-*", + "macaddress": "88C397*" + }, + { + "hostname": "miwifi-*", + "macaddress": "8C53C3*" + }, + { + "hostname": "miwifi-*", + "macaddress": "50EC50*" + }, + { + "hostname": "miwifi-*", + "macaddress": "EC4D3E*" + }, + { + "hostname": "miwifi-*", + "macaddress": "28D127*" + }, + { + "hostname": "miwifi-*", + "macaddress": "7CC294*" + }, + { + "hostname": "miwifi-*", + "macaddress": "9C9D7E*" + }, + { + "hostname": "miwifi-*", + "macaddress": "B460ED*" + }, + { + "hostname": "miwifi-*", + "macaddress": "58B623*" + } + ], + "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", + "domain": "miwifi", "iot_class": "local_polling", + "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", + "name": "MiWiFi", "quality_scale": "platinum", + "requirements": [], "ssdp": [ { "st": "upnp:rootdevice", @@ -17,30 +118,5 @@ "deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1" } ], - "dhcp": [ - {"hostname": "miwifi-*", "macaddress": "C85CCC*"}, - {"hostname": "miwifi-*", "macaddress": "D43538*"}, - {"hostname": "miwifi-*", "macaddress": "649E31*"}, - {"hostname": "miwifi-*", "macaddress": "5C0214*"}, - {"hostname": "miwifi-*", "macaddress": "CCB5D1*"}, - {"hostname": "miwifi-*", "macaddress": "68ABBC*"}, - {"hostname": "miwifi-*", "macaddress": "8CDEF9*"}, - {"hostname": "miwifi-*", "macaddress": "DCED83*"}, - {"hostname": "miwifi-*", "macaddress": "3CCD57*"}, - {"hostname": "miwifi-*", "macaddress": "64644A*"}, - {"hostname": "miwifi-*", "macaddress": "5448E6*"}, - {"hostname": "miwifi-*", "macaddress": "6490C1*"}, - {"hostname": "miwifi-*", "macaddress": "44237C*"}, - {"hostname": "miwifi-*", "macaddress": "5CE50C*"}, - {"hostname": "miwifi-*", "macaddress": "50D2F5*"}, - {"hostname": "miwifi-*", "macaddress": "88C397*"}, - {"hostname": "miwifi-*", "macaddress": "8C53C3*"}, - {"hostname": "miwifi-*", "macaddress": "50EC50*"}, - {"hostname": "miwifi-*", "macaddress": "EC4D3E*"}, - {"hostname": "miwifi-*", "macaddress": "28D127*"}, - {"hostname": "miwifi-*", "macaddress": "7CC294*"}, - {"hostname": "miwifi-*", "macaddress": "9C9D7E*"}, - {"hostname": "miwifi-*", "macaddress": "B460ED*"}, - {"hostname": "miwifi-*", "macaddress": "58B623*"} - ] -} + "version": "3.0.0" +} \ No newline at end of file diff --git a/hacs.json b/hacs.json index 69beacd..9f672c4 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { + "homeassistant": "2023.3.0", "name": "MiWiFi", - "render_readme": true, - "homeassistant": "2023.3.0" -} + "render_readme": true +} \ No newline at end of file From 2c0e9d05dd2467c517ba2a8e1617e096881d47dc Mon Sep 17 00:00:00 2001 From: Dmitrii Mamontov Date: Tue, 14 Mar 2023 00:28:38 +0300 Subject: [PATCH 3/4] Reverse --- custom_components/miwifi/manifest.json | 40 +++++++++++++------------- hacs.json | 6 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/custom_components/miwifi/manifest.json b/custom_components/miwifi/manifest.json index 48c96f3..8ac9f1d 100644 --- a/custom_components/miwifi/manifest.json +++ b/custom_components/miwifi/manifest.json @@ -1,11 +1,26 @@ { - "codeowners": [ - "@dmamontov" - ], + "domain": "miwifi", + "name": "MiWiFi", + "version": "3.0.0", + "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", + "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", "config_flow": true, + "requirements": [], "dependencies": [ "http" ], + "codeowners": [ + "@dmamontov" + ], + "iot_class": "local_polling", + "quality_scale": "platinum", + "ssdp": [ + { + "st": "upnp:rootdevice", + "manufacturer": "Xiaomi", + "deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1" + } + ], "dhcp": [ { "hostname": "miwifi-*", @@ -103,20 +118,5 @@ "hostname": "miwifi-*", "macaddress": "58B623*" } - ], - "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", - "domain": "miwifi", - "iot_class": "local_polling", - "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", - "name": "MiWiFi", - "quality_scale": "platinum", - "requirements": [], - "ssdp": [ - { - "st": "upnp:rootdevice", - "manufacturer": "Xiaomi", - "deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1" - } - ], - "version": "3.0.0" -} \ No newline at end of file + ] +} diff --git a/hacs.json b/hacs.json index 9f672c4..69beacd 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "homeassistant": "2023.3.0", "name": "MiWiFi", - "render_readme": true -} \ No newline at end of file + "render_readme": true, + "homeassistant": "2023.3.0" +} From f17e7ddd4af19e28452925c96d64bd9f0372bbba Mon Sep 17 00:00:00 2001 From: Dmitrii Mamontov Date: Tue, 14 Mar 2023 00:30:35 +0300 Subject: [PATCH 4/4] Sort manifest --- custom_components/miwifi/manifest.json | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/custom_components/miwifi/manifest.json b/custom_components/miwifi/manifest.json index 8ac9f1d..ba32b73 100644 --- a/custom_components/miwifi/manifest.json +++ b/custom_components/miwifi/manifest.json @@ -1,25 +1,12 @@ { "domain": "miwifi", "name": "MiWiFi", - "version": "3.0.0", - "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", - "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", - "config_flow": true, - "requirements": [], - "dependencies": [ - "http" - ], "codeowners": [ "@dmamontov" ], - "iot_class": "local_polling", - "quality_scale": "platinum", - "ssdp": [ - { - "st": "upnp:rootdevice", - "manufacturer": "Xiaomi", - "deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1" - } + "config_flow": true, + "dependencies": [ + "http" ], "dhcp": [ { @@ -118,5 +105,18 @@ "hostname": "miwifi-*", "macaddress": "58B623*" } - ] -} + ], + "documentation": "https://github.com/dmamontov/hass-miwifi/wiki", + "iot_class": "local_polling", + "issue_tracker": "https://github.com/dmamontov/hass-miwifi/issues", + "quality_scale": "platinum", + "requirements": [], + "ssdp": [ + { + "st": "upnp:rootdevice", + "manufacturer": "Xiaomi", + "deviceType": "urn:schemas-upnp-org:device:InternetGatewayDevice:1" + } + ], + "version": "3.0.0" +} \ No newline at end of file