Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Mar 11, 2021
2 parents 0eb1531 + 8b1fbd7 commit be7a3f9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/xiaomi_gateway3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity_registry import EntityRegistry
from homeassistant.helpers.storage import Store

Expand Down Expand Up @@ -307,6 +308,7 @@ def device_info(self):
type_ = self.device['type']
if type_ == 'gateway':
return {
'connections': {(CONNECTION_NETWORK_MAC, self.device['wlan_mac'])},
'identifiers': {(DOMAIN, self.device['mac'])},
'manufacturer': self.device['device_manufacturer'],
'model': self.device['device_model'],
Expand Down
20 changes: 20 additions & 0 deletions custom_components/xiaomi_gateway3/core/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
[2, 1, 'left_switch', 'switch'],
[3, 1, 'right_switch', 'switch'],
]
}, {
1945: ["Xiaomi", "Mesh Wall Switch", "DHKG01ZM"],
'params': [
[2, 1, 'switch', 'switch']
],
}, {
2007: ["Unknown", "Mesh Switch Controller"],
'params': [
Expand Down Expand Up @@ -86,6 +91,21 @@
[8, 1, 'backlight', 'switch'],
[8, 2, 'smart', 'switch'],
]
}, {
2717: ["Xiaomi", "Mesh Wall Triple Switch", "ISA-KG03HL"],
'params': [
[2, 1, 'left_switch', 'switch'],
[3, 1, 'middle_switch', 'switch'],
[4, 1, 'right_switch', 'switch'],
[6, 1, 'humidity', 'sensor'],
[6, 7, 'temperature', 'sensor'],
]
},{
3083: ["Xiaomi", "Mi Smart Electrical Outlet", "ZNCZ01ZM"],
'params': [
[2, 1, 'outlet', 'switch'],
[4, 1, 'backlight', 'switch'],
]
}]

# if color temp not default 2700..6500
Expand Down
1 change: 1 addition & 0 deletions custom_components/xiaomi_gateway3/core/gateway3.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ def _get_devices(self, shell: TelnetShell):
'did': self.did,
'model': 'lumi.gateway.mgl03',
'mac': device['mac'],
'wlan_mac': shell.get_wlan_mac(),
'type': 'gateway',
'init': {
'firmware lock': shell.check_firmware_lock(),
Expand Down
5 changes: 5 additions & 0 deletions custom_components/xiaomi_gateway3/core/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ def get_version(self):
m = RE_VERSION.search(raw.decode())
return m[1]

def get_wlan_mac(self) -> str:
raw = self.read_file('/sys/class/net/wlan0/address')

return raw.decode().rstrip().upper()

@property
def mesh_group_table(self) -> str:
if self.ver >= '1.4.7_0160':
Expand Down

0 comments on commit be7a3f9

Please sign in to comment.