Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.xiaomi_miio.switch Namespace Reference

Classes

class  ChuangMiPlugSwitch
 
class  XiaomiAirConditioningCompanionSwitch
 
class  XiaomiGatewaySwitch
 
class  XiaomiGenericCoordinatedSwitch
 
class  XiaomiMiioSwitchDescription
 
class  XiaomiPlugGenericSwitch
 
class  XiaomiPowerStripSwitch
 

Functions

def async_setup_coordinated_entry (hass, config_entry, async_add_entities)
 
None async_setup_entry (HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
 
def async_setup_other_entry (hass, config_entry, async_add_entities)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string ATTR_ANION = "anion"
 
string ATTR_AUTO_DETECT = "auto_detect"
 
string ATTR_BUZZER = "buzzer"
 
string ATTR_CHILD_LOCK = "child_lock"
 
string ATTR_CLEAN = "clean_mode"
 
string ATTR_DISPLAY = "display"
 
string ATTR_DRY = "dry"
 
string ATTR_IONIZER = "ionizer"
 
string ATTR_LEARN_MODE = "learn_mode"
 
string ATTR_LED = "led"
 
string ATTR_LOAD_POWER = "load_power"
 
string ATTR_MODEL = "model"
 
string ATTR_POWER = "power"
 
string ATTR_POWER_MODE = "power_mode"
 
string ATTR_POWER_PRICE = "power_price"
 
string ATTR_PRICE = "price"
 
string ATTR_PTC = "ptc"
 
string ATTR_WIFI_LED = "wifi_led"
 
string DATA_KEY = "switch.xiaomi_miio"
 
string DEFAULT_NAME = "Xiaomi Miio Switch"
 
int FEATURE_FLAGS_GENERIC = 0
 
int FEATURE_FLAGS_PLUG_V3 = FEATURE_SET_WIFI_LED
 
tuple FEATURE_FLAGS_POWER_STRIP_V1
 
int FEATURE_FLAGS_POWER_STRIP_V2 = FEATURE_SET_WIFI_LED | FEATURE_SET_POWER_PRICE
 
int FEATURE_SET_POWER_MODE = 1
 
int FEATURE_SET_POWER_PRICE = 4
 
int FEATURE_SET_WIFI_LED = 2
 
dictionary GATEWAY_SWITCH_VARS
 
string KEY_CHANNEL = "channel"
 
string MODEL_PLUG_V3 = "chuangmi.plug.v3"
 
string MODEL_POWER_STRIP_V2 = "zimi.powerstrip.v2"
 
dictionary MODEL_TO_FEATURES_MAP
 
 SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_ENTITY_ID): cv.entity_ids})
 
 SERVICE_SCHEMA_POWER_MODE
 
 SERVICE_SCHEMA_POWER_PRICE
 
dictionary SERVICE_TO_METHOD
 
tuple SWITCH_TYPES
 

Detailed Description

Support for Xiaomi Smart WiFi Socket and Smart Power Strip.

Function Documentation

◆ async_setup_coordinated_entry()

def homeassistant.components.xiaomi_miio.switch.async_setup_coordinated_entry (   hass,
  config_entry,
  async_add_entities 
)
Set up the coordinated switch from a config entry.

Definition at line 354 of file switch.py.

◆ async_setup_entry()

None homeassistant.components.xiaomi_miio.switch.async_setup_entry ( HomeAssistant  hass,
ConfigEntry  config_entry,
AddEntitiesCallback  async_add_entities 
)
Set up the switch from a config entry.

Definition at line 341 of file switch.py.

◆ async_setup_other_entry()

def homeassistant.components.xiaomi_miio.switch.async_setup_other_entry (   hass,
  config_entry,
  async_add_entities 
)
Set up the other type switch from a config entry.

Definition at line 390 of file switch.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.xiaomi_miio.switch._LOGGER = logging.getLogger(__name__)
private

Definition at line 121 of file switch.py.

◆ ATTR_ANION

string homeassistant.components.xiaomi_miio.switch.ATTR_ANION = "anion"

Definition at line 146 of file switch.py.

◆ ATTR_AUTO_DETECT

string homeassistant.components.xiaomi_miio.switch.ATTR_AUTO_DETECT = "auto_detect"

Definition at line 137 of file switch.py.

◆ ATTR_BUZZER

string homeassistant.components.xiaomi_miio.switch.ATTR_BUZZER = "buzzer"

Definition at line 138 of file switch.py.

◆ ATTR_CHILD_LOCK

string homeassistant.components.xiaomi_miio.switch.ATTR_CHILD_LOCK = "child_lock"

Definition at line 139 of file switch.py.

◆ ATTR_CLEAN

string homeassistant.components.xiaomi_miio.switch.ATTR_CLEAN = "clean_mode"

Definition at line 140 of file switch.py.

◆ ATTR_DISPLAY

string homeassistant.components.xiaomi_miio.switch.ATTR_DISPLAY = "display"

Definition at line 141 of file switch.py.

◆ ATTR_DRY

string homeassistant.components.xiaomi_miio.switch.ATTR_DRY = "dry"

Definition at line 142 of file switch.py.

◆ ATTR_IONIZER

string homeassistant.components.xiaomi_miio.switch.ATTR_IONIZER = "ionizer"

Definition at line 145 of file switch.py.

◆ ATTR_LEARN_MODE

string homeassistant.components.xiaomi_miio.switch.ATTR_LEARN_MODE = "learn_mode"

Definition at line 143 of file switch.py.

◆ ATTR_LED

string homeassistant.components.xiaomi_miio.switch.ATTR_LED = "led"

Definition at line 144 of file switch.py.

◆ ATTR_LOAD_POWER

string homeassistant.components.xiaomi_miio.switch.ATTR_LOAD_POWER = "load_power"

Definition at line 147 of file switch.py.

◆ ATTR_MODEL

string homeassistant.components.xiaomi_miio.switch.ATTR_MODEL = "model"

Definition at line 148 of file switch.py.

◆ ATTR_POWER

string homeassistant.components.xiaomi_miio.switch.ATTR_POWER = "power"

Definition at line 149 of file switch.py.

◆ ATTR_POWER_MODE

string homeassistant.components.xiaomi_miio.switch.ATTR_POWER_MODE = "power_mode"

Definition at line 150 of file switch.py.

◆ ATTR_POWER_PRICE

string homeassistant.components.xiaomi_miio.switch.ATTR_POWER_PRICE = "power_price"

Definition at line 151 of file switch.py.

◆ ATTR_PRICE

string homeassistant.components.xiaomi_miio.switch.ATTR_PRICE = "price"

Definition at line 152 of file switch.py.

◆ ATTR_PTC

string homeassistant.components.xiaomi_miio.switch.ATTR_PTC = "ptc"

Definition at line 153 of file switch.py.

◆ ATTR_WIFI_LED

string homeassistant.components.xiaomi_miio.switch.ATTR_WIFI_LED = "wifi_led"

Definition at line 154 of file switch.py.

◆ DATA_KEY

string homeassistant.components.xiaomi_miio.switch.DATA_KEY = "switch.xiaomi_miio"

Definition at line 124 of file switch.py.

◆ DEFAULT_NAME

string homeassistant.components.xiaomi_miio.switch.DEFAULT_NAME = "Xiaomi Miio Switch"

Definition at line 123 of file switch.py.

◆ FEATURE_FLAGS_GENERIC

int homeassistant.components.xiaomi_miio.switch.FEATURE_FLAGS_GENERIC = 0

Definition at line 160 of file switch.py.

◆ FEATURE_FLAGS_PLUG_V3

int homeassistant.components.xiaomi_miio.switch.FEATURE_FLAGS_PLUG_V3 = FEATURE_SET_WIFI_LED

Definition at line 168 of file switch.py.

◆ FEATURE_FLAGS_POWER_STRIP_V1

tuple homeassistant.components.xiaomi_miio.switch.FEATURE_FLAGS_POWER_STRIP_V1
Initial value:
1 = (
2  FEATURE_SET_POWER_MODE | FEATURE_SET_WIFI_LED | FEATURE_SET_POWER_PRICE
3 )

Definition at line 162 of file switch.py.

◆ FEATURE_FLAGS_POWER_STRIP_V2

int homeassistant.components.xiaomi_miio.switch.FEATURE_FLAGS_POWER_STRIP_V2 = FEATURE_SET_WIFI_LED | FEATURE_SET_POWER_PRICE

Definition at line 166 of file switch.py.

◆ FEATURE_SET_POWER_MODE

int homeassistant.components.xiaomi_miio.switch.FEATURE_SET_POWER_MODE = 1

Definition at line 156 of file switch.py.

◆ FEATURE_SET_POWER_PRICE

int homeassistant.components.xiaomi_miio.switch.FEATURE_SET_POWER_PRICE = 4

Definition at line 158 of file switch.py.

◆ FEATURE_SET_WIFI_LED

int homeassistant.components.xiaomi_miio.switch.FEATURE_SET_WIFI_LED = 2

Definition at line 157 of file switch.py.

◆ GATEWAY_SWITCH_VARS

dictionary homeassistant.components.xiaomi_miio.switch.GATEWAY_SWITCH_VARS
Initial value:
1 = {
2  "status_ch0": {KEY_CHANNEL: 0},
3  "status_ch1": {KEY_CHANNEL: 1},
4  "status_ch2": {KEY_CHANNEL: 2},
5 }

Definition at line 130 of file switch.py.

◆ KEY_CHANNEL

string homeassistant.components.xiaomi_miio.switch.KEY_CHANNEL = "channel"

Definition at line 129 of file switch.py.

◆ MODEL_PLUG_V3

string homeassistant.components.xiaomi_miio.switch.MODEL_PLUG_V3 = "chuangmi.plug.v3"

Definition at line 127 of file switch.py.

◆ MODEL_POWER_STRIP_V2

string homeassistant.components.xiaomi_miio.switch.MODEL_POWER_STRIP_V2 = "zimi.powerstrip.v2"

Definition at line 126 of file switch.py.

◆ MODEL_TO_FEATURES_MAP

dictionary homeassistant.components.xiaomi_miio.switch.MODEL_TO_FEATURES_MAP

Definition at line 193 of file switch.py.

◆ SERVICE_SCHEMA

homeassistant.components.xiaomi_miio.switch.SERVICE_SCHEMA = vol.Schema({vol.Optional(ATTR_ENTITY_ID): cv.entity_ids})

Definition at line 170 of file switch.py.

◆ SERVICE_SCHEMA_POWER_MODE

homeassistant.components.xiaomi_miio.switch.SERVICE_SCHEMA_POWER_MODE
Initial value:
1 = SERVICE_SCHEMA.extend(
2  {vol.Required(ATTR_MODE): vol.All(vol.In(["green", "normal"]))}
3 )

Definition at line 172 of file switch.py.

◆ SERVICE_SCHEMA_POWER_PRICE

homeassistant.components.xiaomi_miio.switch.SERVICE_SCHEMA_POWER_PRICE
Initial value:
1 = SERVICE_SCHEMA.extend(
2  {vol.Required(ATTR_PRICE): cv.positive_float}
3 )

Definition at line 176 of file switch.py.

◆ SERVICE_TO_METHOD

dictionary homeassistant.components.xiaomi_miio.switch.SERVICE_TO_METHOD
Initial value:
1 = {
2  SERVICE_SET_WIFI_LED_ON: ServiceMethodDetails(method="async_set_wifi_led_on"),
3  SERVICE_SET_WIFI_LED_OFF: ServiceMethodDetails(method="async_set_wifi_led_off"),
4  SERVICE_SET_POWER_MODE: ServiceMethodDetails(
5  method="async_set_power_mode",
6  schema=SERVICE_SCHEMA_POWER_MODE,
7  ),
8  SERVICE_SET_POWER_PRICE: ServiceMethodDetails(
9  method="async_set_power_price",
10  schema=SERVICE_SCHEMA_POWER_PRICE,
11  ),
12 }

Definition at line 180 of file switch.py.

◆ SWITCH_TYPES

tuple homeassistant.components.xiaomi_miio.switch.SWITCH_TYPES

Definition at line 238 of file switch.py.