From c5f012c85a8d5f74ff53f00e1641be8e40e9a3fb Mon Sep 17 00:00:00 2001
From: Sebastian Muszynski <basti@linkt.de>
Date: Sat, 16 Jun 2018 21:53:25 +0200
Subject: [PATCH] Remove load power attribute for channel USB (#14996)

* Remove load power attribute for channel USB

* Fix format
---
 homeassistant/components/switch/xiaomi_miio.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/homeassistant/components/switch/xiaomi_miio.py b/homeassistant/components/switch/xiaomi_miio.py
index 1e11b844fdf..37b16f44ea8 100644
--- a/homeassistant/components/switch/xiaomi_miio.py
+++ b/homeassistant/components/switch/xiaomi_miio.py
@@ -421,8 +421,11 @@ class ChuangMiPlugSwitch(XiaomiPlugGenericSwitch):
             self._device_features = FEATURE_FLAGS_PLUG_V3
             self._state_attrs.update({
                 ATTR_WIFI_LED: None,
-                ATTR_LOAD_POWER: None,
             })
+            if self._channel_usb is False:
+                self._state_attrs.update({
+                    ATTR_LOAD_POWER: None,
+                })
 
     async def async_turn_on(self, **kwargs):
         """Turn a channel on."""
@@ -476,7 +479,7 @@ class ChuangMiPlugSwitch(XiaomiPlugGenericSwitch):
             if state.wifi_led:
                 self._state_attrs[ATTR_WIFI_LED] = state.wifi_led
 
-            if state.load_power:
+            if self._channel_usb is False and state.load_power:
                 self._state_attrs[ATTR_LOAD_POWER] = state.load_power
 
         except DeviceException as ex:
-- 
GitLab