YinHangCode / homebridge-mi-aqara

a homebridge plugin for XiaoMi Aqara plugin.
1.08k stars 154 forks source link

Reporting #277

Open lboue opened 4 years ago

lboue commented 4 years ago

Hello,

Could you add firmware version to the web interface please? We can get that information from the 'miio inspect' command:

pi@raspberrypi:~ $ miio inspect 52051***
 INFO  Attempting to inspect 52051***

Device ID: 52051***
Model info: lumi.gateway.v3
Address: 192.168.1.4
Token: 81264c64d56238aa92dcfb**********f via auto-token
Support: At least basic

Type info: sensor, miio:gateway, miio
Capabilities: illuminance, state, children

Firmware version: 1.4.1_170
Hardware version: MW300
MCU firmware version: 0158

WiFi: Freebox-****** (68:A3:78:**:**:**) RSSI: -53
WiFi firmware version: SD878x-14.76.36.p84-702.1.0-WM

Remote access (Mi Home App): TCP

Properties:
  - illuminance: 319
  - rgb: [object Object]
  - brightness: 0

python-miio also have a discover method: https://github.com/rytilahti/python-miio/blob/master/miio/device.py#L176

    def discover(addr: str = None) -> Any:
        """Scan for devices in the network.
        This method is used to discover supported devices by sending a
        handshake message to the broadcast address on port 54321.
        If the target IP address is given, the handshake will be send as
        an unicast packet.
        :param str addr: Target IP address"""
        timeout = 5
        is_broadcast = addr is None
        seen_addrs = []  # type: List[str]
        if is_broadcast:
            addr = "<broadcast>"
            is_broadcast = True
            _LOGGER.info("Sending discovery to %s with timeout of %ss..", addr, timeout)
        # magic, length 32
        helobytes = bytes.fromhex(
            "21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
        )

https://github.com/jghaanstra/com.xiaomi-miio/blob/master/docs/obtain_token.md#method-4a---packet-sender-tool

Regards

YinHangCode commented 4 years ago

this plugin not use miio. firmware version information can not get from protocol.