stijnstijn / pyaranet4 Goto Github PK
View Code? Open in Web Editor NEWA cross-platform Python interface for the Aranet4 CO₂ meter
License: MIT License
A cross-platform Python interface for the Aranet4 CO₂ meter
License: MIT License
pyaranet4 --history
raises ValueError
exception.
See Issue Details
section below for more information.
% python -VV
Python 3.10.8 (main, Oct 13 2022, 09:48:40) [Clang 14.0.0 (clang-1400.0.29.102)]
Firmware: v1.2.0
Smart Home Integration: enabled
I am receiving a ValueError runtime exception when attempting to pull back history from my Aranet4:
% pyaranet4 --history
Traceback (most recent call last):
File "/<redacted>/pyaranet4/.venv/bin/pyaranet4", line 8, in <module>
sys.exit(main())
File "/<redacted>/pyaranet4/.venv/lib/python3.10/site-packages/pyaranet4/__main__.py", line 56, in main
collect_data(a4, args, sensors)
File "/<redacted>/pyaranet4/.venv/lib/python3.10/site-packages/pyaranet4/__main__.py", line 114, in collect_data
history = a4.get_history(sensors)
File "/<redacted>/pyaranet4/.venv/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 219, in get_history
return self.loop.run_until_complete(self._get_history(sensors, start, end))
File "/<redacted>/homebrew/Cellar/[email protected]/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/<redacted>/pyaranet4/.venv/lib/python3.10/site-packages/pyaranet4/pyaranet4.py", line 410, in _get_history
index_map[max(self._datapoints)] = last_timestamp
ValueError: max() arg is an empty sequence
%
I can pull back the most recent measurement without issue using pyaranet4
:
% pyaranet4
--------------------------------------
Connected: Aranet4 03263 | v0.4.10
Updated 40 s ago. Intervals: 60 s
5040 total readings
--------------------------------------
CO2: 846 ppm
Temperature: 20.00 C
Humidity: 32 %
Pressure: 980.50 hPa
Battery: 33 %
--------------------------------------
But for some reason when I pass the --history
flag, I get the ValueError exception. Based on the detail message max() arg is an empty sequence
, I wonder if self._datapoints
isn't getting set for some reason.
Can you provide any guidance on why I might be receiving this error, and how to resolve it?
Please let me know if I can provide any additional details!
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.