-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support new xiaomi aqara device model and LAN protocol 2.0 #13540
Changes from 1 commit
17ef258
7ace038
54dad52
77cc7df
29b2d97
8a11675
5dc40bf
e1f4036
d8c103f
e59e19d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,30 +25,30 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
for (_, gateway) in hass.data[PY_XIAOMI_GATEWAY].gateways.items(): | ||
for device in gateway.devices['binary_sensor']: | ||
model = device['model'] | ||
if model in ['motion', 'sensor_motion.aq2']: | ||
if model in ['motion', 'sensor_motion', 'sensor_motion.aq2']: | ||
devices.append(XiaomiMotionSensor(device, hass, gateway)) | ||
elif model in ['magnet', 'sensor_magnet.aq2']: | ||
elif model in ['magnet', 'sensor_magnet', 'sensor_magnet.aq2']: | ||
devices.append(XiaomiDoorSensor(device, gateway)) | ||
elif model == 'sensor_wleak.aq1': | ||
devices.append(XiaomiWaterLeakSensor(device, gateway)) | ||
elif model == 'smoke': | ||
elif model in ['smoke', 'sensor_smoke']: | ||
devices.append(XiaomiSmokeSensor(device, gateway)) | ||
elif model == 'natgas': | ||
elif model in ['natgas', 'sensor_natgas']: | ||
devices.append(XiaomiNatgasSensor(device, gateway)) | ||
elif model in ['switch', 'sensor_switch.aq2', 'sensor_switch.aq3']: | ||
devices.append(XiaomiButton(device, 'Switch', 'status', | ||
elif model in ['switch', 'sensor_switch', 'sensor_switch.aq2', 'sensor_switch.aq3']: | ||
devices.append(XiaomiButton(device, 'Switch', 'status' if int(device['proto'][0:1]) == 1 else 'channel_0', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long (122 > 79 characters) |
||
hass, gateway)) | ||
elif model == '86sw1': | ||
elif model in ['86sw1', 'sensor_86sw1.aq1']: | ||
devices.append(XiaomiButton(device, 'Wall Switch', 'channel_0', | ||
hass, gateway)) | ||
elif model == '86sw2': | ||
elif model in ['86sw2', 'sensor_86sw2.aq1']: | ||
devices.append(XiaomiButton(device, 'Wall Switch (Left)', | ||
'channel_0', hass, gateway)) | ||
devices.append(XiaomiButton(device, 'Wall Switch (Right)', | ||
'channel_1', hass, gateway)) | ||
devices.append(XiaomiButton(device, 'Wall Switch (Both)', | ||
'dual_channel', hass, gateway)) | ||
elif model == 'cube': | ||
elif model in ['cube', 'sensor_cube']: | ||
devices.append(XiaomiCube(device, hass, gateway)) | ||
add_devices(devices) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
'temperature', gateway)) | ||
devices.append(XiaomiSensor(device, 'Humidity', | ||
'humidity', gateway)) | ||
elif device['model'] == 'weather.v1': | ||
elif device['model'] in ['weather', 'weather.v1']: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure about this ("weather") model name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes ,i sure |
||
devices.append(XiaomiSensor(device, 'Temperature', | ||
'temperature', gateway)) | ||
devices.append(XiaomiSensor(device, 'Humidity', | ||
|
@@ -36,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
elif device['model'] == 'sensor_motion.aq2': | ||
devices.append(XiaomiSensor(device, 'Illumination', | ||
'lux', gateway)) | ||
elif device['model'] == 'gateway': | ||
elif device['model'] in ['gateway', 'gateway.v3', 'acpartner.v3']: | ||
devices.append(XiaomiSensor(device, 'Illumination', | ||
'illumination', gateway)) | ||
add_devices(devices) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
for device in gateway.devices['switch']: | ||
model = device['model'] | ||
if model == 'plug': | ||
devices.append(XiaomiGenericSwitch(device, "Plug", 'status', | ||
devices.append(XiaomiGenericSwitch(device, "Plug", 'status' if int(device['proto'][0:1]) == 1 else 'channel_0', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long (127 > 79 characters) |
||
True, gateway)) | ||
elif model in ['ctrl_neutral1', 'ctrl_neutral1.aq1']: | ||
devices.append(XiaomiGenericSwitch(device, 'Wall Switch', | ||
|
@@ -52,7 +52,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): | |
'Wall Switch LN Right', | ||
'channel_1', | ||
False, gateway)) | ||
elif model in ['86plug', 'ctrl_86plug.aq1']: | ||
elif model in ['86plug', 'ctrl_86plug', 'ctrl_86plug.aq1']: | ||
devices.append(XiaomiGenericSwitch(device, 'Wall Plug', | ||
'status', True, gateway)) | ||
add_devices(devices) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,6 +211,7 @@ def __init__(self, device, device_type, xiaomi_hub): | |
self._sid = device['sid'] | ||
self._name = '{}_{}'.format(device_type, self._sid) | ||
self._type = device_type | ||
self._proto = xiaomi_hub.proto | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this used? |
||
self._write_to_hub = xiaomi_hub.write_to_hub | ||
self._get_from_hub = xiaomi_hub.get_from_hub | ||
self._device_state_attributes = {} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (96 > 79 characters)