def do_discover(self) -> Message:
"""Send a handshake to the device,
which can be used to the device type and serial.
The handshake must also be done regularly to enable communication
with the device.
:rtype: Message
:raises DeviceException: if the device could not be discovered."""
m = Device.discover(self.ip)
if m is not None:
self._device_id = m.header.value.device_id
self._device_ts = m.header.value.ts
if self.debug > 1:
_LOGGER.debug(m)
_LOGGER.debug("Discovered %s with ts: %s, token: %s",
self._device_id,
self._device_ts,
codecs.encode(m.checksum, 'hex'))
else:
_LOGGER.error("Unable to discover a device at address %s", self.ip)
raise DeviceException("Unable to discover the device %s" % self.ip)
return m
评论列表
文章目录