-
Notifications
You must be signed in to change notification settings - Fork 101
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
Reading sensor values, blinking lights and lux #136
Comments
If I recall correctly, there is a GATT command to directly control the brightness of the LED. But I no not remember what is was... |
Any hint where i could find it ? |
Update: This adds a lot of delay but its ok for me, because the mifloars get pulled every 10 minutes. A better solution would be turning the blinking off on connecting, but i have not found anything so far. |
Have you considered implementing passive miflora data reading by sniffing all in the air "visible" data, parsing found miflora packets and adding them to the cache? Sensor sends multiple readings per minute without affecting battery life unlike active btle connection. Latest miflora firmware 3.2.1 does not send battery level, but this can be done once a day by active pooling among the firmware version. Advantages of passive Xiaomi sensors readings: Xiaomi passive BLE Monitor sensor platform for inspiration: Passive BTLE Xiaomi sensor reading is also done in ESPhome. |
Could you try to find out? Would be great to disable LED blinking while reading from sensor. |
Could you specify which source-code lines you've changed? Patch would be the best :-) Thanks! |
Hi, this is just a quitfix in the poller for my setup ... but it works for me. i added following import
and in the fill_cache function i added a sleep of 5 seconds after the connection init and the version exchange.
But like i said, this has a few drawbacks, but in my setup, i get correct readings now, because the led stops blinking after 3-4 seconds, but each reading has delay between initiating the read and reading actual data of 5 seconds, which is no problem in my setup. I hope that helps, |
If this solves the issue and we decide to implement it, let's rather divide the function and let the library user implement the delay. Side note: Same goes for the handling of exceptions. This should be removed and the responsibility of the user (instead of the ambiguous 5 minutes hack in the background). jm2c seeing the code snippet above |
@ThomDietrich, I've tried modifying miflora library couple days ago with same hack to mitigate led blinking, but for some strange reason miflora-mqtt-daemon which uses this library failed the step "Adding sensor to device list and testing connection". I have to test again with lastest miflora-mqtt-daemon git version. But I've suspected that miflora sensor doesn't like delay between "magic number write" and actual btle sensor reading... Of course it is best to divide the mentioned ideas into two tasks: |
Imho passive reading is an independent (and very interesting) topic and we should discuss it in a new ticket
This assumes the library is active in background, which it is not. The client would need to trigger background listening and provide a callback function to react to new passive readings. Let's move to a new ticket.
Did you try the same or a different solution than @MartinHaimberger in #136 (comment) |
Of course, I've just initially mentioned it here, because it solves the issue with LED blinking. Let's create new "feature request" (passive miflora reading).
I would say the same solution (I haven't modified import section, because I have already "import time" on line 6. But |
Hi,
Reading the values from a mi flora sensor works great!
But the lux read from the sensor is not correct because while filling the cache the sensor blinks and the blinking distortes the lux reading... in a dark room i get around 30 - 100 lux if the values is read while blinking.
Any idea how to disable the blinking or read the lux date if blinking is over or any other idea to get correct readings?
Thx,
Martin
The text was updated successfully, but these errors were encountered: