Skip to content

Commit 2dc8f63

Browse files
authored
Merge pull request #1672 from w101723/master
Add support for giot.plug.v8icm
2 parents 1df480f + 2bd875e commit 2dc8f63

File tree

1 file changed

+43
-13
lines changed

1 file changed

+43
-13
lines changed

custom_components/xiaomi_gateway3/core/devices.py

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,15 +1602,15 @@
16021602
],
16031603
}, {
16041604
5480: ["Linptech", "Wireless Button", "linp.remote.k9b1"],
1605-
"spec": [
1605+
"spec": [
16061606
# mibeacon2 spec
16071607
BLEMapConv("action", "sensor", mi=4097, map={"000000": BUTTON_1_SINGLE, "000001": BUTTON_1_HOLD, "000002": BUTTON_1_DOUBLE}),
16081608
BLEByteConv("battery", "sensor", mi=18435, entity=ENTITY_LAZY), # uint8
16091609
# miot spec
16101610
ConstConv("action", mi="2.e.1", value=BUTTON_1_SINGLE),
16111611
ConstConv("action", mi="2.e.2", value=BUTTON_1_DOUBLE),
16121612
ConstConv("action", mi="2.e.3", value=BUTTON_1_HOLD),
1613-
BaseConv("battery", mi="3.p.1003"),
1613+
BaseConv("battery", mi="3.p.1003"),
16141614
],
16151615
# "ttl": "6h" # battery every 6 hours
16161616
}, {
@@ -1751,7 +1751,7 @@
17511751
BaseConv("custom_no_motion_time", "sensor", mi="2.p.1053", entity={"units": UNIT_MINUTES, "icon": "mdi:timer"}),
17521752
# other sensors
17531753
MathConv("no_motion_duration", "sensor", mi="2.p.1024", entity={"enabled": False, "units": UNIT_SECONDS, "icon": "mdi:timer"}),
1754-
BaseConv("battery", "sensor", mi="3.p.1003"),
1754+
BaseConv("battery", "sensor", mi="3.p.1003"),
17551755
],
17561756
}, {
17571757
# https://home.miot-spec.com/spec/linp.sensor_occupy.es3
@@ -1793,7 +1793,7 @@
17931793
]
17941794
}, {
17951795
# MIOT https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:remote-control:0000A021:lemesh-ts10:1
1796-
17658: ["LeMesh", "Remote Control TS10", "lemesh.remote.ts10"],
1796+
17658: ["LeMesh", "Remote Control TS10", "lemesh.remote.ts10"],
17971797
"spec": [
17981798
BaseConv("action", "sensor"),
17991799
# --- Handle directional button events using MapConv ---
@@ -1802,15 +1802,15 @@
18021802
MapConv("action", mi="5.e.1014.p.1", map={1: BUTTON_1_HOLD, 2: BUTTON_2_HOLD, 3: BUTTON_3_HOLD, 4: BUTTON_4_HOLD,}),
18031803
# --- Knob operation ---
18041804
# First use a generic value, then determine direction via another sensor
1805-
ConstConv("action", mi="5.e.1036", value="knob_rotate"),
1805+
ConstConv("action", mi="5.e.1036", value="knob_rotate"),
18061806
# The value of this sensor is a number: positive for right, negative for left rotation.
18071807
BaseConv("knob_rotation_amplitude", "sensor", mi="5.e.1036.p.2"),
18081808
# --- Combined operation events ---
18091809
# Both "Down Button Press Right/Left Rotation" and "Press To Turn Right/Left" correspond to eiid: 1028
18101810
ConstConv("action", mi="5.e.1028", value="button_3_press_rotate"),
18111811
# --- Battery level support ---
18121812
BaseConv("battery", "sensor", mi="1.p.1"),
1813-
]
1813+
]
18141814
}, {
18151815
16191: ["GranwinIoT", "V5 One Key Switch (BLE)", "giot.remote.v51kwm"],
18161816
"spec": [
@@ -3844,11 +3844,11 @@
38443844
ConstConv("action", mi="13.e.3", value=BUTTON_2_HOLD),
38453845
MapConv("left_switch_mode", "select", mi="2.p.2", map={0: "Normal", 1: "Wireless", 2: "Flex", 3: "Toggle", 4: "Normal+Wireless"}),
38463846
MapConv("right_switch_mode", "select", mi="3.p.2", map={ 0: "Normal", 1: "Wireless", 2: "Flex", 3: "Toggle", 4: "Normal+Wireless"}),
3847-
MapConv("power_on_state_left_switch", "select", mi="2.p.3", map={0: "Off", 1: "On", 2: "Default"}),
3847+
MapConv("power_on_state_left_switch", "select", mi="2.p.3", map={0: "Off", 1: "On", 2: "Default"}),
38483848
MapConv("power_on_state_right_switch", "select", mi="3.p.3", map={0: "Off", 1: "On", 2: "Default"}),
38493849
MapConv("left_switch_indicator_light_mode", "select", mi="16.p.1", map={0: "Follow", 1: "Opposite", 2: "Off", 3: "On"}),
38503850
MapConv("right_switch_indicator_light_mode", "select", mi="16.p.2", map={0: "Follow", 1: "Opposite", 2: "Off", 3: "On"}),
3851-
BaseConv("ambient_light", "switch", mi="17.p.1"),
3851+
BaseConv("ambient_light", "switch", mi="17.p.1"),
38523852
]
38533853
}, {
38543854
16366: ["SmartFrog", "V6 Triple Wall Switch", "giot.switch.v63ksm"],
@@ -3870,12 +3870,12 @@
38703870
MapConv("middle_switch_mode", "select", mi="3.p.2", map={0: "Normal", 1: "Wireless", 2: "Flex", 3: "Toggle", 4: "Normal+Wireless"}),
38713871
MapConv("right_switch_mode", "select", mi="4.p.2", map={ 0: "Normal", 1: "Wireless", 2: "Flex", 3: "Toggle", 4: "Normal+Wireless"}),
38723872
MapConv("power_on_state_left_switch", "select", mi="2.p.3", map={0: "Off", 1: "On", 2: "Default"}),
3873-
MapConv("power_on_state_middle_switch", "select", mi="3.p.3", map={0: "Off", 1: "On", 2: "Default"}),
3873+
MapConv("power_on_state_middle_switch", "select", mi="3.p.3", map={0: "Off", 1: "On", 2: "Default"}),
38743874
MapConv("power_on_state_right_switch", "select", mi="4.p.3", map={0: "Off", 1: "On", 2: "Default"}),
38753875
MapConv("left_switch_indicator_light_mode", "select", mi="16.p.1", map={0: "Follow", 1: "Opposite", 2: "Off", 3: "On"}),
38763876
MapConv("middle_switch_indicator_light_mode", "select", mi="16.p.2", map={0: "Follow", 1: "Opposite", 2: "Off", 3: "On"}),
38773877
MapConv("right_switch_indicator_light_mode", "select", mi="16.p.3", map={0: "Follow", 1: "Opposite", 2: "Off", 3: "On"}),
3878-
BaseConv("ambient_light", "switch", mi="17.p.1"),
3878+
BaseConv("ambient_light", "switch", mi="17.p.1"),
38793879
]
38803880
},{
38813881
20809: ["LeMesh", "Scene Wireless Button S", "lemesh.remote.ts00"],
@@ -3887,7 +3887,7 @@
38873887
BaseConv("battery", "sensor", mi="4.p.1003"),
38883888
MapConv("button_mode", "select", mi="5.p.1020", map={0: "Quick Single Click", 1: "Multiple Click"}),
38893889
]
3890-
}, {
3890+
}, {
38913891
9609: ["Bean", "Mesh Single Wall Switch (L)", "bean.switch.bl01"],
38923892
"spec": [
38933893
BaseConv("switch", "switch", mi="2.p.1"),
@@ -4786,7 +4786,7 @@
47864786
# MapConv("wireless_1", "select", mi="2.p.2", map={0: "Wired And Wireless", 1: "Wireless"}), # config
47874787
MapConv("power_on_state", "select", mi="2.p.5", map={1: "On", 2: "Off", 3: "Default"}), # config
47884788
# MapConv("wireless_2_1", "select", mi="2.p.6", map={0: "default", 1: "Wireless", 2: "Wireless", 3: "Wireless"}), # config
4789-
MapConv("scene_speed", "select", mi="12.p.1", map={1: "Top Speed", 2:"Standard"}), #config
4789+
MapConv("scene_speed", "select", mi="12.p.1", map={1: "Top Speed", 2:"Standard"}), #config
47904790
BaseConv("led", "switch", mi="11.p.1"), # config
47914791
BaseConv("action", "sensor", entity=ENTITY_DISABLED),
47924792
ConstConv("action", mi="5.e.1", value=BUTTON_1_SINGLE),
@@ -5080,6 +5080,36 @@
50805080
BaseConv("switch_sensor_on", "switch", mi="11.p.1"),
50815081
MathConv("switch_sensor_mode", "number", mi="11.p.2", min=1, max=7200),
50825082
],
5083+
}, {
5084+
# https://home.miot-spec.com/spec/giot.plug.v8icm
5085+
21478: ["GranwinIoT", "Gra Electricity Metering Controller V8 (Mesh)", "giot.plug.v8icm"],
5086+
"spec": [
5087+
BaseConv("switch", "switch", mi="2.p.1"),
5088+
MathConv("energy", "sensor", mi="4.p.1", multiply=0.0001, round=3),
5089+
MathConv("power", "sensor", mi="4.p.2", round=3),
5090+
MathConv("voltage", "sensor", mi="4.p.3"),
5091+
MathConv("current", "sensor", mi="4.p.4", multiply=0.001, round=3),
5092+
# BaseConv("auxiliary_switch", "switch", mi="7.p.1"),
5093+
# BaseConv("voice_disable", "switch", mi="7.p.2"),
5094+
# BaseConv("button_type", "sensor", mi="8.p.1"),
5095+
# BaseConv("action", "sensor"),
5096+
# ConstConv("action", mi="7.e.1", value="normal_mode"),
5097+
# ConstConv("action", mi="7.e.2", value="wireless_mode"),
5098+
# ConstConv("action", mi="7.e.3", value="jog_mode"),
5099+
# ConstConv("action", mi="7.e.4", value="follow_led"),
5100+
# ConstConv("action", mi="7.e.5", value="opposition_led"),
5101+
# ConstConv("action", mi="7.e.6", value="on_led"),
5102+
# ConstConv("action", mi="7.e.7", value="off_led"),
5103+
# ConstConv("action", mi="7.e.8", value="local_timing_on"),
5104+
# ConstConv("action", mi="7.e.9", value="local_timing_off"),
5105+
# ConstConv("action", mi="7.e.10", value="cycle_timing_on"),
5106+
# ConstConv("action", mi="7.e.11", value="cycle_timing_off"),
5107+
# ConstConv("action", mi="7.e.12", value="led_config_on"),
5108+
# ConstConv("action", mi="7.e.13", value="led_config_off"),
5109+
# ConstConv("action", mi="7.e.14", value="overcharging_on"),
5110+
# ConstConv("action", mi="7.e.15", value="overcharging_off"),
5111+
# ConstConv("action", mi="7.e.16", value="mixed_mode"),
5112+
],
50835113
}, {
50845114
21145: ["PTX", "AK4 Pro Mesh2.0", "090615.switch.akpro4"],
50855115
"spec": [
@@ -5135,7 +5165,7 @@
51355165
BaseConv("light", "light", mi="2.p.1"),
51365166
BrightnessConv("brightness", mi="2.p.2", max=100),
51375167
ColorTempKelvin("color_temp", mi="2.p.3", mink=3000, maxk=6500),
5138-
BaseConv("flex_switch", "switch", mi="2.p.12", entity=ENTITY_CONFIG),
5168+
BaseConv("flex_switch", "switch", mi="2.p.12", entity=ENTITY_CONFIG),
51395169
MapConv("mode","select",mi="2.p.13", map={0: "None", 1: "Day", 2: "Night", 3: "Warmth", 4: "TV", 5: "Reading", 6: "Computer", 7: "Sleep", 8: "Wakeup"}),
51405170
],
51415171
}, {

0 commit comments

Comments
 (0)