From 4f10e2ad218604ded2305069d1348876677e01c0 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 28 Oct 2020 10:32:40 +0100 Subject: [PATCH 1/5] Add ha-blueprint --- .github/workflows/combined.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/combined.yaml diff --git a/.github/workflows/combined.yaml b/.github/workflows/combined.yaml new file mode 100644 index 0000000..5d4d046 --- /dev/null +++ b/.github/workflows/combined.yaml @@ -0,0 +1,30 @@ +name: "Validation And Formatting" +on: + push: + pull_request: + schedule: + - cron: '0 0 * * *' +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Download repo + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + name: Setup Python + - uses: actions/cache@v2 + name: Cache + with: + path: | + ~/.cache/pip + key: custom-component-ci + - uses: hacs/integration/action@main + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CATEGORY: integration + - uses: KTibow/ha-blueprint@stable + name: CI + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a3182f4910aa5769ad8188537f29c10d0967f6f5 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 28 Oct 2020 10:32:40 +0100 Subject: [PATCH 2/5] Add ha-blueprint --- .github/workflows/combined.yaml | 30 ++++++++++++++++++++ custom_components/xiaomi_miio_plug/switch.py | 21 +++++++------- 2 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/combined.yaml diff --git a/.github/workflows/combined.yaml b/.github/workflows/combined.yaml new file mode 100644 index 0000000..5d4d046 --- /dev/null +++ b/.github/workflows/combined.yaml @@ -0,0 +1,30 @@ +name: "Validation And Formatting" +on: + push: + pull_request: + schedule: + - cron: '0 0 * * *' +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Download repo + with: + fetch-depth: 0 + - uses: actions/setup-python@v2 + name: Setup Python + - uses: actions/cache@v2 + name: Cache + with: + path: | + ~/.cache/pip + key: custom-component-ci + - uses: hacs/integration/action@main + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CATEGORY: integration + - uses: KTibow/ha-blueprint@stable + name: CI + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/custom_components/xiaomi_miio_plug/switch.py b/custom_components/xiaomi_miio_plug/switch.py index d5f83ad..525b415 100644 --- a/custom_components/xiaomi_miio_plug/switch.py +++ b/custom_components/xiaomi_miio_plug/switch.py @@ -1,18 +1,10 @@ """Support for Xiaomi Smart WiFi Socket and Smart Power Strip.""" import asyncio -from functools import partial import logging +from functools import partial -from miio import ( # pylint: disable=import-error - AirConditioningCompanionV3, - ChuangmiPlug, - Device, - DeviceException, - PowerStrip, -) -from miio.powerstrip import PowerMode # pylint: disable=import-error +import homeassistant.helpers.config_validation as cv import voluptuous as vol - from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity from homeassistant.const import ( ATTR_ENTITY_ID, @@ -22,7 +14,14 @@ CONF_TOKEN, ) from homeassistant.exceptions import PlatformNotReady -import homeassistant.helpers.config_validation as cv +from miio import ( # pylint: disable=import-error + AirConditioningCompanionV3, + ChuangmiPlug, + Device, + DeviceException, + PowerStrip, +) +from miio.powerstrip import PowerMode # pylint: disable=import-error _LOGGER = logging.getLogger(__name__) From e0b7341fe7fe5b8e2ea90b59683ea511782bd6ba Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Wed, 28 Oct 2020 10:42:35 +0100 Subject: [PATCH 3/5] Add list of support devices --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 69e8c1e..3eb8bfd 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,27 @@ Please follow the instructions on [Retrieving the Access Token](https://home-ass Credits: Thanks to [Rytilahti](https://github.com/rytilahti/python-miio) for all the work. +## Supported devices + +| Name | Model | Model no. | +| --------------------------- | ---------------------- | --------- | +| Xiaomi Smart WiFi Socket | chuangmi.plug.m1 | | +| Xiaomi Smart WiFi Socket | chuangmi.plug.m3 | | +| Xiaomi Smart WiFi Socket | chuangmi.plug.v2 | | +| Xiaomi Smart WiFi Socket | chuangmi.plug.hmi205 | | +| Xiaomi Smart WiFi Socket | chuangmi.plug.hmi206 | | +| Xiaomi Chuangmi Plug V1 | chuangmi.plug.v1 | | +| Xiaomi Chuangmi Plug V3 | chuangmi.plug.v3 | | +| Xiaomi Chuangmi Plug HMI208 | chuangmi.plug.hmi208 | | +| Xiaomi Smart Power Strip | qmi.powerstrip.v1 | | +| Xiaomi Smart Power Strip | zimi.powerstrip.v2 | | +| Xiaomi Air Conditioning Companion V3 | lumi.acpartner.v3 | | + ## Features ### Xiaomi Smart WiFi Socket -Supported models: `chuangmi.plug.m1`, `chuangmi.plug.m3`, `chuangmi.plug.v2`, `chuangmi.plug.hmi205` +Supported models: `chuangmi.plug.m1`, `chuangmi.plug.m3`, `chuangmi.plug.v2`, `chuangmi.plug.hmi205`, `chuangmi.plug.hmi206` * Power (on, off) * Attributes @@ -18,7 +34,7 @@ Supported models: `chuangmi.plug.m1`, `chuangmi.plug.m3`, `chuangmi.plug.v2`, `c ### Xiaomi Chuangmi Plug V1 -Supported models: `chuangmi.plug.v1` +Supported models: `chuangmi.plug.v1`, `chuangmi.plug.hmi208` * Power (on, off) * USB (on, off) From 0f7b6e72c787c46383358db05f869f8e09965ecd Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sun, 28 Feb 2021 19:50:07 +0100 Subject: [PATCH 4/5] Fix CI --- .github/workflows/{combined.yaml => ci.yaml} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename .github/workflows/{combined.yaml => ci.yaml} (86%) diff --git a/.github/workflows/combined.yaml b/.github/workflows/ci.yaml similarity index 86% rename from .github/workflows/combined.yaml rename to .github/workflows/ci.yaml index 5d4d046..7e7784f 100644 --- a/.github/workflows/combined.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ on: pull_request: schedule: - cron: '0 0 * * *' + jobs: ci: runs-on: ubuntu-latest @@ -14,15 +15,16 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v2 name: Setup Python + with: + python-version: '3.8.x' - uses: actions/cache@v2 name: Cache with: path: | ~/.cache/pip key: custom-component-ci - - uses: hacs/integration/action@main + - uses: hacs/action@main with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CATEGORY: integration - uses: KTibow/ha-blueprint@stable name: CI From 45af6b88426a71d6bb5623f2ee9c541a80adb0c3 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sun, 28 Feb 2021 19:58:57 +0100 Subject: [PATCH 5/5] Add version to manifest --- custom_components/xiaomi_miio_plug/manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/xiaomi_miio_plug/manifest.json b/custom_components/xiaomi_miio_plug/manifest.json index 8cb4964..067facc 100644 --- a/custom_components/xiaomi_miio_plug/manifest.json +++ b/custom_components/xiaomi_miio_plug/manifest.json @@ -2,6 +2,7 @@ "domain": "xiaomi_miio_plug", "name": "Xiaomi Mi Smart WiFi Socket", "config_flow": false, + "version": "1.4.1", "documentation": "https://github.com/syssi/xiaomiplug", "issue_tracker": "https://github.com/syssi/xiaomiplug/issues", "requirements": [