Skip to content

Commit

Permalink
Merge branch 'release/1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Oct 28, 2020
2 parents 2e0970d + b220980 commit aa1c784
Show file tree
Hide file tree
Showing 11 changed files with 697 additions and 397 deletions.
5 changes: 5 additions & 0 deletions .flake8.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
exclude = .git,.tox,__pycache__
max-line-length = 100
select = C,E,F,W,B,B950
ignore = E501,W503,E203
3 changes: 3 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python:
enabled: true
config_file: .flake8.ini
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3
92 changes: 83 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Xiaomi WiFi Plug
# Xiaomi Smart WiFi Sockets and Power Strips

This is a custom component for Home Assistant to integrate the Xiaomi Smart WiFi Socket (called Plug), Xiaomi Smart Power Strip and Xiaomi Chuangmi Plug V1.

Expand All @@ -7,23 +7,72 @@ 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.

## Features
* On, Off
* USB on, off (Chuangmi Plug V1 only)
* Current state

### Xiaomi Smart WiFi Socket

Supported models: `chuangmi.plug.m1`, `chuangmi.plug.m3`, `chuangmi.plug.v2`, `chuangmi.plug.hmi205`

* Power (on, off)
* Attributes
- Temperature
- Load (Power Strip only)

### Xiaomi Chuangmi Plug V1

Supported models: `chuangmi.plug.v1`

* Power (on, off)
* USB (on, off)
* Attributes
- Temperature

### Xiaomi Chuangmi Plug V3

Supported models: `chuangmi.plug.v3`

* Power (on, off)
* USB (on, off)
* Wifi LED (on, off)
* Attributes
- Temperature
- Load power
- Wifi LED

### Xiaomi Smart Power Strip

Supported models: `qmi.powerstrip.v1`, `zimi.powerstrip.v2`

* Power (on, off)
* Wifi LED (on, off)
* Power Price (0...999)
* Power Mode (green, normal) (Power Strip V1 only)
* Attributes
- Temperature
- Current
- Load power
- Wifi LED
- Mode (Power Strip V1 only)

### Xiaomi Air Conditioning Companion V3

Supported models: `lumi.acpartner.v3` (the socket of the acpartner.v1 and v2 isn't switchable!)

* Power (on, off)
* Attributes
- Load power


# Setup

```
# configuration.yaml
switch:
- platform: xiaomi_miio
- platform: xiaomi_miio_plug
name: Original Xiaomi Mi Smart WiFi Socket
host: 192.168.130.59
token: b7c4a758c251955d2c24b1d9e41ce47d
model: chuangmi.plug.m1
- platform: xiaomi_miio
- platform: xiaomi_miio_plug
name: Xiaomi Mi Smart Power Strip
host: 192.168.130.60
token: 0ed0fdccb2d0cd718108f18a447726a6
Expand All @@ -34,11 +83,36 @@ Configuration variables:
- **host** (*Required*): The IP of your light.
- **token** (*Required*): The API token of your light.
- **name** (*Optional*): The name of your light.
- **model** (*Optional*): The model of your device. Valid values are `chuangmi.plug.v1`, `qmi.powerstrip.v1`, `zimi.powerstrip.v2`, `chuangmi.plug.m1` and `chuangmi.plug.v2`. This setting can be used to bypass the device model detection and is recommended if your device isn't always available.
- **model** (*Optional*): The model of your device. Valid values are `chuangmi.plug.v1`, `chuangmi.plug.v3`, `qmi.powerstrip.v1`, `zimi.powerstrip.v2`, `chuangmi.plug.m1`, `chuangmi.plug.m3`, `chuangmi.plug.v2`, `chuangmi.plug.hmi205` and `lumi.acpartner.v3`. This setting can be used to bypass the device model detection and is recommended if your device isn't always available.

## Platform services

#### Service switch/xiaomi_miio_set_power_mode (Power Strip only)
#### Service `xiaomi_miio_plug.switch_set_wifi_led_on` (Power Strip and Chuangmi Plug V3)

Turn the wifi led on.

| Service data attribute | Optional | Description |
|---------------------------|----------|---------------------------------------------------------|
| `entity_id` | yes | Only act on a specific air purifier. Else targets all. |

#### Service `xiaomi_miio_plug.switch_set_wifi_led_off` (Power Strip and Chuangmi Plug V3)

Turn the wifi led off.

| Service data attribute | Optional | Description |
|---------------------------|----------|---------------------------------------------------------|
| `entity_id` | yes | Only act on a specific air purifier. Else targets all. |

#### Service `xiaomi_miio_plug.switch_set_power_price` (Power Strip only)

Set the power price.

| Service data attribute | Optional | Description |
|---------------------------|----------|---------------------------------------------------------|
| `entity_id` | yes | Only act on a specific air purifier. Else targets all. |
| `price` | no | Power price, between 0 and 999. |

#### Service `xiaomi_miio_plug.switch_set_power_mode` (Power Strip V1 only)

Set the power mode.

Expand Down
9 changes: 0 additions & 9 deletions custom_components/switch/services.yaml

This file was deleted.

Loading

0 comments on commit aa1c784

Please sign in to comment.