Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Failed to read temperature, humidity, co2, pressure #4

Open
JulyIghor opened this issue May 15, 2023 · 1 comment
Open

Failed to read temperature, humidity, co2, pressure #4

JulyIghor opened this issue May 15, 2023 · 1 comment

Comments

@JulyIghor
Copy link

pyaranet4 --history works as expected, but pyaranet4 produces the error:

--------------------------------------
Connected: Aranet4 1BAE8 | v0.4.14
Updated 20 s ago. Intervals: 60 s
249 total readings
--------------------------------------
Traceback (most recent call last):
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 477, in _read_value
    value = await self._client.read_gatt_char(uuid)
  File "/home/ighor/.local/lib/python3.10/site-packages/bleak/__init__.py", line 571, in read_gatt_char
    return await self._backend.read_gatt_char(char_specifier, **kwargs)
  File "/home/ighor/.local/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py", line 679, in read_gatt_char
    assert_reply(reply)
  File "/home/ighor/.local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 20, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.NotPermitted] Read not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ighor/.local/bin/pyaranet4", line 8, in <module>
    sys.exit(main())
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/__main__.py", line 61, in main
    basic_overview(a4)
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/__main__.py", line 76, in basic_overview
    print("CO2:         {:d} ppm".format(a4.current_readings.co2))
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 155, in current_readings
    return self._get_readings(simple=False)
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 284, in _get_readings
    data = self.read_from_uuid(uuid)
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 230, in read_from_uuid
    value = self.loop.run_until_complete(self._read_value(uuid))
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/ighor/.local/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 479, in _read_value
    raise Aranet4UnpairedException("Error reading from device. Check if it is properly paired.")
pyaranet4.exceptions.Aranet4UnpairedException: Error reading from device. Check if it is properly paired.
@JulyIghor
Copy link
Author

The problem appears because if UUID_CURRENT_READING_FULL requested it produces "Failed to read: org.bluez.Error.NotPermitted", when UUID_CURRENT_READING_SIMPLE forced everything works fine. Possible solution is fallback to UUID_CURRENT_READING_SIMPLE when UUID_CURRENT_READING_FULL failed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant