Comments (5)
That doesn't look like a ruuvitag advertisement (it doesn't look like a valid BLE advertisement at all unless there's some data getting lost somewhere). From the code, this should just cause the sending MAC to be blacklisted, but the process as a whole should move on.
How many tags do you have? Are you losing data from all of them after this?
from ruuvitag-sensor.
Thank you for your reply!
I have only one tag in that location.
This was happening before and after upgrading the firmware of the ruuvitag to the latest.
So if it blacklists the MAC, then I understand that it stops to read data from this tag.
For now I just restart the container manually and all seems to work after it.
Could I somehow set the process to restart, exit the process or to crash the container when this happens?
from ruuvitag-sensor.
Hi @eRazeri!
This sounds like a docker / system specific problem, so I wouldn't add any custom functionality for this case.
We can utilize Python log's custom handlers to make the process to exit when specific MAC is blacklisted. Handler will listen for all log events and will exit when we receive a log message that matches the condition.
from ruuvitag_sensor.ruuvi import RuuviTagSensor
import ruuvitag_sensor.log
from logging import StreamHandler
class ExitHandler(StreamHandler):
def emit(self, record):
if (record.levelname != "DEBUG"):
return
msg = self.format(record)
if "Blacklisting MAC AA:BB:CC:DD:EE:FF" in msg:
exit(1)
#ruuvitag_sensor.log.enable_console()
exit_handler = ExitHandler()
ruuvitag_sensor.log.log.addHandler(exit_handler)
if __name__ == "__main__":
RuuviTagSensor.get_data_for_sensors()
Let me know if this solution solves your problem. I will close this issue, but if this solution doesn't work, please reopen the issue.
from ruuvitag-sensor.
Hi @ttu!
Thank you very much!
Sorry for the long delay in answering, it took me a long time to verify because the error is very random.
With your code as base, I was able to catch the error and restart the container.
I did change your code a little to work for me. I'm checking for the "Invalid advertisement data", because I never encountered this "Blacklisting MAC" message in my enviroment.
from ruuvitag-sensor.
I'm still confused as to how we get this data in the first place, as it doesn't seem to conform to the specification for BLE messages. Maybe parsing the output from hcitool goes wrong somewhere?
If you can turn up the debug level in your application to debug
you should get some useful output. Unfortunately it'll be a lot of output, so I'm not sure whatever system you're using can store this.
from ruuvitag-sensor.
Related Issues (20)
- Cross-platform BLE communicaton with Bleak
- Changing the spelling of datas to data HOT 9
- find_ruuvitags_async payload contains non-parsed data HOT 1
- ruuvi_rx should support Bleak-adapter HOT 3
- Add tests for find_ruuvitags_async HOT 1
- Use typing in examples HOT 3
- BleCommunicationBleak doesn't work with asyncio.run() HOT 3
- Docs request: Pull Request Templates HOT 1
- Data Format Mismatch HOT 2
- Get sensor data with callback stopped working after new firmware HOT 3
- Bleak Async call failing ... no attribute HOT 1
- Development install fails HOT 3
- streaming from "get_async_bleak.py" HOT 4
- hcitool not activating le scan HOT 3
- RuuviTags not found with Intel AX200 USB HOT 2
- RSSI data missing with the Bleson adapter HOT 4
- Bluetooth device argument ignored when using Bleak HOT 3
- Consider using Ruff to replace flake8, isort, PyLint and Black HOT 3
- Release version 3.0 HOT 9
- Deprecation warning in examples
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruuvitag-sensor.