Skip to content

Commit

Permalink
✨ [2024-04-30] 添加新特性: 支持智能插座 "SL_OE_3C" 带计量, "SL_OE_W" 带计量, "OD_WE_OT…
Browse files Browse the repository at this point in the history
…1" 只有开关。

✨ [2024-04-30] 添加新特性: 计量插座的功率门限读取,不支持修改和关闭,不安全(火灾隐患)
  • Loading branch information
MapleEve committed Apr 30, 2024
1 parent c870c1a commit 11dbbb2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ lifesmart:
| SL_OE_DE | 支持计量,经过真实设备测试 |
| SL_OE_3C | 支持计量 |
| SL_OL_W | 支持计量 |
| OD_WE_OT1 | |
| ~~SL_OL_UL~~ | |
| ~~SL_OL_UK~~ | |
| ~~SL_OL_THE~~ | |
| ~~SL_OL_3C~~ | |
| ~~SL_O~~L | |
| OD_WE_OT1 | 此设备只有开关 |
| ~~SL_OL_UL~~ | 真有这个设备? |
| ~~SL_OL_UK~~ | 真有这个设备 |
| ~~SL_OL_THE~~ | 真有这个设备? |
| ~~SL_OL_3C~~ | 真有这个设备? |
| ~~SL_O~~L | 真有这个设备? |
#### 窗帘电机类:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/lifesmart/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"SL_SW_MJ2",
]
GENERIC_CONTROLLER_TYPES = ["SL_P", "SL_P_IR"]
SMART_PLUG_TYPES = ["SL_OE_DE"]
SMART_PLUG_TYPES = ["SL_OE_DE", "SL_OE_3C", "SL_OE_W", "OD_WE_OT1"]

LIFESMART_HVAC_STATE_LIST = [
climate.const.HVACMode.OFF,
Expand Down
6 changes: 6 additions & 0 deletions custom_components/lifesmart/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ def __init__(
self._device_class = SensorDeviceClass.POWER
self._unit = UnitOfPower.WATT
self._state = sub_device_data["v"]
elif device_type in SMART_PLUG_TYPES and sub_device_key == "P4":
self._device_class = SensorDeviceClass.POWER
self._unit = UnitOfPower.WATT
self._state = sub_device_data["val"]
else:
if sub_device_key == "T" or sub_device_key == "P1":
self._device_class = SensorDeviceClass.TEMPERATURE
Expand Down Expand Up @@ -238,6 +242,8 @@ async def _update_value(self, data) -> None:
self._state = data["v"]
elif self.device_type in SMART_PLUG_TYPES and self.sub_device_key == "P3":
self._state = data["v"]
elif self.device_type in SMART_PLUG_TYPES and self.sub_device_key == "P4":
self._state = data["val"]
else:
self._state = data["v"]

Expand Down

0 comments on commit 11dbbb2

Please sign in to comment.