h4 / lywsd02

MIT License
172 stars 35 forks source link

how can use gatttool to read data from lywsd02 #9

Open ouhaiorg opened 4 years ago

ouhaiorg commented 4 years ago

Python 3.7.4 (default, Oct 15 2019, 15:58:26) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from lywsd02 import Lywsd02Client mac = 'E7:2E:00:B2:38:35' client = Lywsd02Client(mac) print(client.temperature) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/lywsd02/client.py", line 44, in temperature self._get_sensor_data() File "/usr/local/lib/python3.7/site-packages/lywsd02/decorators.py", line 5, in wrapper self._peripheral.connect(self._mac) File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 446, in connect self._connect(addr, addrType, iface) File "/usr/local/lib/python3.7/site-packages/bluepy/btle.py", line 439, in _connect raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp) bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral E7:2E:00:B2:38:35, addr type: public

but same system in homeassistant,can read temperature and humidity I want to use gatttool to find the error

h4 commented 4 years ago

In most cases this issue related to distance between sensor and HA server.