-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bytearray index out of range #49
Comments
Thanks for creating the issue. Does this happen all the time or just occasionally? Can you try if you can repeat the error with the code from Bleson branch? |
it's will happened when I display on the screen. I will try the bleson branch first. |
Decoding the data fails and instead of dictionary it returns None. As None is not dictionary data['temperature'] raises an exception. There is something wrong with convert_data function, as it returns �. Can you add log.info(raw) to that function so we can see what it tries to decode before it fails. |
I'm seeing similar errors in my raspbian with my Raspi 3B. I've started seing this error few weeks back, and I think it might have started after some Raspbian update. Anyway, I have several Ruuvitags with 1.2.12 firmware installed and I'm using RAW mode. What should I do? Here are the errors:
There's also few other datapoints with same error messages:
|
@fiasko Thanks for the messages. I updated logging few days ago, so could get that RAW data and fix the encoding. Ran some tests with the RAW data you provided and was wondering why everything seems to be working correctly. Then noticed that the app is using decoder for data type 2 and 4 although should be using data type 3 decoder. Will make a fix for code that decides which decoder should be used. Thanks again for the data! |
Few hours of testing is now passed and so far I haven't seen any errors. I'm quite confident that the issue is now fixed. I'll let you know if new errors shows up. |
Added another fix to master (f6e6212). This could also affect to this issue as after encoding other manufacturers device might have been considered as a RuuviTag sending data with data format 2/4 if broadcasted data contained e.g. error log from the first message had |
I guess it's working. I haven't seen any error so far after ~24h of testing. |
My program stop as below:
Press Ctrl+C to quit.
2018-07-14 10:40:08.420778
Sensor - DF:25:8D:F6:45:47
Temperature: -21.46 C
Humidity: 57.0
Pressure: 1011.97
.......
Encoded value: �
not valid
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.6/site-packages/ruuvitag_sensor/decoder.py", line 88, in decode_data
'temperature': self._get_temperature(decoded),
File "/home/pi/.local/lib/python3.6/site-packages/ruuvitag_sensor/decoder.py", line 59, in _get_temperature
temp = (decoded[2] & 127) + decoded[3] / 100
IndexError: bytearray index out of range
Traceback (most recent call last):
File "bryant.py", line 38, in
line_tem = str.format('Temperature: {0} C', data['temperature'])
TypeError: 'NoneType' object is not subscriptable
The text was updated successfully, but these errors were encountered: