custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.91k stars 247 forks source link

Where are miflora sensors data? #50

Closed jnaav closed 4 years ago

jnaav commented 4 years ago

Hi,

I just discovered this custom-component and looks great so I want to try it because I want only one component to retrieve al my BLE sensors data. I have two miflora sensors, two LYWSD03MMC (I know they are not supported right now, no problem), and a LYWSD02.

With the LYWSD02 I had no problem. Found it easy and works great. But with the miflora, I can not find them in States in Dev Tools. I do not see any new sensor for them or see anything in the logs. Maybe the component is not reading them?

With hcitool lescan command I can see them. I also could retrieve their data with other (python) scripts so I think they work fine.

Is there anywhere I can find some clue about what is happening?

Magalex2x14 commented 4 years ago

Hello, @goliath888 !

Version 0.6.0 has just been published with support for LYWSD03MMC.

As for MiFlora:

  1. Is this sensor added to the official MiHome or FlowerCare app or something else? For many sensors, BLE ADV messages do not contain actual measurements if they are not added to the official application.

  2. Is this the original MiFlora? I know that there are several types of sensors, very similar to MiFlora, but using different identifiers. For example, VegTrug GrowCare. The steps for implementing support for new sensors are described in the FAQ.

If with point 1 everything is good, then I think that in your situation it is worth making the one indicated in point 2. Turning on debugging and the option report_unknown will give a lot of information about your situation.

jnaav commented 4 years ago

Hi,

I only had one of miflora added to the MiHome App, but I just added the other. They are suppose to be original, at least I bought them as so (but who knows) They work fine in MiHome.

I set debug mode and report_unknown to true, but all I can see in the logs are:

2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] HCIdump thread: joined 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s). 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] HCIdump thread: Init 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0 2020-03-08 16:16:41 DEBUG (Thread-7) [custom_components.mitemp_bt.sensor] HCIdump thread: Run 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1 2020-03-08 16:16:41 DEBUG (SyncWorker_13) [custom_components.mitemp_bt.sensor] Finished. Parsed: 156 hci events, 1 xiaomi devices.

It only says 1 xiaomi devices...Anything else I could do?

By the way: What is the name I should look for in sensors?

Magalex2x14 commented 4 years ago

You can go to HA Configuration -> Entities and filter by string mi_ - all entities created by the component will be visible. MiFlora creates several sensor entities, it should be:

- mi_t_<mac> for temperature
- mi_m_<mac> for moisture
- mi_l_<mac> for luminosity
- mi_c_<mac> for conductivity (fertility)
Magalex2x14 commented 4 years ago

After enabling debug and report_unknown wait 10 minutes, and drop the entire journal here (it is better to copy-paste into a text file, and attach to the message).

Tell me, how far are these sensors from the host with HA? If possible, try placing them closer to the host for about 10 minutes (temporarily, to make sure that bad reception conditions is not the source of the problem).

Magalex2x14 commented 4 years ago

Another source of the problem may be other components using bluetooth - for example, various bt-trackers. You can try to temporarily disable them.

In general, it is useful to devote some time to our FAQ - many cases are covered there.

jnaav commented 4 years ago

No luck. Just put the sensor besides the bt host and all the time the same lines I put in the message above. No other process was using the bt. I guess I should look for other alternatives. But thanks anyway.

Magalex2x14 commented 4 years ago

Very strange ... I myself use this sensor, and it works without problems, and there are positive feedback from users of this sensor and its analogue. I can advise you to update the component to 0.6.0 (published today) and check for updates for the sensor itself in the MiHome application.

In addition, the last way to clarify the situation is to record a complete dump, as described here or in the DEBUG section of our FAQ (btmon utility) - then I can study the situation in great detail.

I remembered another subtlety - the sensors stop sending broadcast packets when a connection is established to them (from the official application or any other, including third-party scripts).

jnaav commented 4 years ago

Already updated. Do not worry. I will try other alternatives first and in case I found nothing I will try that. Thanks for your help