Support new xiaomi aqara device model and LAN protocol 2.0#13540
Support new xiaomi aqara device model and LAN protocol 2.0#13540syssi merged 10 commits intohome-assistant:devfrom
Conversation
|
Hi @ileler, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
| 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.
line too long (127 > 79 characters)
| 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.
line too long (122 > 79 characters)
| 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']: |
There was a problem hiding this comment.
line too long (96 > 79 characters)
| 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.
continuation line under-indented for visual indent
line too long (83 > 79 characters)
| 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.
continuation line under-indented for visual indent
line too long (84 > 79 characters)
| devices.append(XiaomiGenericSwitch(device, "Plug", 'status', | ||
| devices.append(XiaomiGenericSwitch(device, "Plug", | ||
| 'status' if 'proto' not in device | ||
| or int(device['proto'][0:1]) == 1 |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| 'sensor_switch.aq2', 'sensor_switch.aq3']: | ||
| devices.append(XiaomiButton(device, 'Switch', | ||
| 'status' if 'proto' not in device | ||
| or int(device['proto'][0:1]) == 1 |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| if model == 'plug': | ||
| devices.append(XiaomiGenericSwitch(device, "Plug", 'status', | ||
| devices.append(XiaomiGenericSwitch(device, "Plug", | ||
| 'status' if 'proto' not in device or int(device['proto'][0:1]) == 1 |
There was a problem hiding this comment.
continuation line under-indented for visual indent
line too long (87 > 79 characters)
| elif model in ['switch', 'sensor_switch', | ||
| 'sensor_switch.aq2', 'sensor_switch.aq3']: | ||
| devices.append(XiaomiButton(device, 'Switch', | ||
| 'status' if 'proto' not in device or int(device['proto'][0:1]) == 1 |
There was a problem hiding this comment.
continuation line under-indented for visual indent
line too long (87 > 79 characters)
fabaff
left a comment
There was a problem hiding this comment.
Don't change the permission of the files. They don't need to be executable.
| self._sid = device['sid'] | ||
| self._name = '{}_{}'.format(device_type, self._sid) | ||
| self._type = device_type | ||
| self._proto = xiaomi_hub.proto |
|
It is not used currently. I think it may be used later. |
|
Then you should remove |
|
@ileler I added some docs to support your PR. Please feel free to copy & extend: home-assistant/home-assistant.io#5083 |
| 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.
Are you sure about this ("weather") model name?
| 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', |
There was a problem hiding this comment.
Is my assumption correct: The device "switch" is called "sensor_switch" in future (new protocol version). It isn't a new hardware version of the device?
There was a problem hiding this comment.
According to me, the sub-device receives a new gateway (protocol 2.0) and the model changes. So, in order to be compatible with the old and new agreements
|
??? |
|
@ileler I will merge the PR soon. I just need some more time for testing. |
|
@syssi Thanks |
Description:
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: