room-assistant icon indicating copy to clipboard operation
room-assistant copied to clipboard

Xiaomi sensors

Open mycanaletto opened this issue 4 years ago • 12 comments

Hi,

I have this error 9/13/2020, 11:03:37 PM - warn - XiaomiMiService: Clear Cuisine does not appear to be a Xiaomi device. Got advertisement {"localName":"ClearGrass Temp & RH","serviceData":[{"uuid":"fdcd","data":{"type":"Buffer","data":[8,7,109,77,16,52,45,88,1,4,34,1,28,2,2,1,11]}}],"serviceUuids":[],"solicitationServiceUuids":[],"serviceSolicitationUuids":[]}

The information goes back to HA but without the battery information.

Merci !

global:
  instanceName: canaletto_ble
  integrations:
    - homeAssistant
    - bluetoothLowEnergy
    - xiaomiMi
homeAssistant:
  mqttUrl: 'mqtt://192.168.210.44:1883'
  mqttOptions:
    username: mqtt
    password: xx
bluetoothClassic:
  minRssi: '-20'
  hciDeviceId: 1
  addresses:
    - 'xx:65:2D:D4:xx:xx'
bluetoothLowEnergy:
  hciDeviceId: 1
  onlyIbeacon: true
  whitelist:
    - f8de32b1ddffg
    - 94652DDdfgd6
    - 1dbedc84d5bdfgdga93d22a85cb1f933-9-9
  tagOverrides:
    f8de32gfdsfgd:
      name: Tile
xiaomiMi:
  hciDeviceId: 1
  sensors:
    - name: Clear Cuisine
      address: 582fgdg4d6d
    - name: Clear SdB
      address: 58dgdg03286
    - name: Clear Exterieur
      address: 4c65dfgdb75
    - name: Clear Square
      address: 3f59dgd0ca
    - name: Clear Clock
      address: 582d3dgddg2
      bindKey: cc0d9d2dgfd95d27eacf5250e2e8
entities:
  behaviors:
    ble-f8de32dgdfg-tracker:
      debounce:
        wait: 1.75
        maxWait: 2

mycanaletto avatar Sep 13 '20 21:09 mycanaletto

EDIT The lost the battery information is only on CGG1 model. image

mycanaletto avatar Sep 14 '20 11:09 mycanaletto

Hello,

I also have a problem with a TAG Tile that spends its time connecting and disconnecting while it is not moving and is close to the receiver (SENA-UD100 key)...

This is annoying in the sense that it is impossible to rely on its state for the implementation of automations in HA.

image

mycanaletto avatar Sep 14 '20 14:09 mycanaletto

Unfortunately I don't have the device to reproduce this issue, but the code is largely based on the homebridge-mi-hygrothermograph repository. Maybe it could also be worth a shot to look for help there?

As for the tag: in such cases I would recommend to raise the timeout in the bluetoothLowEnergy integration settings. Looking at your log a value between 20 and 30 should be good.

mKeRix avatar Sep 23 '20 17:09 mKeRix

I use the "mi_temp" integration and I have the correct feedback on the stacks.

For the timeout I have actually since set to 40.

On the other hand for the error of which I speak at the beginning?

Merci

mycanaletto avatar Sep 23 '20 20:09 mycanaletto

Atm I don't really know how to fix this by myself, as I didn't write the relevant code myself and also don't have anyway of reproducing it. I suppose we could extend the debug logging for these scenarios so that you could capture the whole advertisement that triggers this false error. That would at least help with finding the issue.

mKeRix avatar Sep 30 '20 18:09 mKeRix

Yes, tell me how to do and where to send the logs ?

mycanaletto avatar Sep 30 '20 18:09 mycanaletto

I just realized - the necessary information is already logged and you posted it in your initial log message. Sorry, totally blanked on that one. When I have some time I can try to make sense of this!

mKeRix avatar Sep 30 '20 19:09 mKeRix

I'm thinking that the error isn't relevant. It says uuid: "fdcd". As far as I can tell, mitemp_bt also only looks at advertisements with uuid: "fe95". It's possible that there is a bug in how noble is parsing the service ID. But I think it's more likely that the battery is getting reported in a different advertisement than the one triggering that error.

If you turn on debug logs then you might see messages like "advertisement with no event" from this device. Those would be helpful. Also, any messages that look like "unknown event type".

alan-strohm avatar Oct 20 '20 06:10 alan-strohm

Hi ! I have a CGG1 and can confirm RA reports temperature, hygrometry and battery level correctly (same values as mitemp_bt on HA). This is great as it will allow me to remove the mitemp_bt integration from HA and run RA for all my BT uses on the same radio :-) I can however confirm the logs being populated with warnings about "fdcd" advertisements. Below is what I hope to be all the relevant verbose logs.

2020-12-23 19:26:44 - debug - XiaomiMiService: CGG1: battery: 35%
2020-12-23 19:26:44 - debug - EntitiesService: Adding new entity cgg1-battery
2020-12-23 19:26:44 - debug - HomeAssistantService: Registering entity room-assistant-bedroom-cgg1-battery under homeassistant/sensor/room-assistant/bedroom-cgg1-battery/config
2020-12-23 19:26:44 - debug - HomeAssistantService: Sending new state 35 for room-assistant-bedroom-cgg1-battery
2020-12-23 19:26:44 - info - BluetoothLowEnergyService: Discovered new BLE peripheral ClearGrass Temp & RH with ID 582d341139a9 and RSSI -74
2020-12-23 19:26:46 - warn - XiaomiMiService: CGG1 does not appear to be a Xiaomi device. Got advertisement {"localName":"ClearGrass Temp & RH","serviceData":[{"uuid":"fdcd","data":{"type":"Buffer","data":[8,7,169,57,17,52,45,88,1,4,198,0,52,2,2,1,35]}}],"serviceUuids":[],"solicitationServiceUuids":[],"serviceSolicitationUuids":[]}
2020-12-23 19:26:48 - debug - XiaomiMiService: CGG1: temperature: 19.8°C
2020-12-23 19:26:48 - debug - EntitiesService: Adding new entity cgg1-temperature
2020-12-23 19:26:48 - debug - HomeAssistantService: Registering entity room-assistant-bedroom-cgg1-temperature under homeassistant/sensor/room-assistant/bedroom-cgg1-temperature/config
2020-12-23 19:26:48 - debug - HomeAssistantService: Sending new state 19.8 for room-assistant-bedroom-cgg1-temperature
2020-12-23 19:26:52 - debug - XiaomiMiService: CGG1: humidity: 56.4%
2020-12-23 19:26:52 - debug - EntitiesService: Adding new entity cgg1-humidity
2020-12-23 19:26:52 - debug - HomeAssistantService: Registering entity room-assistant-bedroom-cgg1-humidity under homeassistant/sensor/room-assistant/bedroom-cgg1-humidity/config
2020-12-23 19:26:52 - debug - HomeAssistantService: Sending new state 56.4 for room-assistant-bedroom-cgg1-humidity
2020-12-23 19:26:54 - warn - XiaomiMiService: CGG1 does not appear to be a Xiaomi device. Got advertisement {"localName":"ClearGrass Temp & RH","serviceData":[{"uuid":"fdcd","data":{"type":"Buffer","data":[8,7,169,57,17,52,45,88,1,4,198,0,52,2,2,1,35]}}],"serviceUuids":[],"solicitationServiceUuids":[],"serviceSolicitationUuids":[]}

Thanks for room assistant !

alainperry avatar Dec 23 '20 18:12 alainperry

@alainperry Bravo, you are lucky...

I have 3 CGG1, 1 which goes up the battery and 2 which do not go up it.

Of course under mi_temp all the batteries go up well.

My idea was also to use only my BT Sena key. But for the moment I let the RPI's BT run mid_temp...

mycanaletto avatar Dec 23 '20 23:12 mycanaletto

There hasn't been any activity on this issue recently. In an effort to provide a better overview of current issues we automatically clean some of the old ones. Many of them may already be resolved in newer versions of room-assistant. This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 05 '21 02:05 github-actions[bot]

Well, I know this hasn't seen much activity recently, but as far as I can tell, the problem is still there and my logs still get filled while the room-assistant indeed sends all the relevant values to my MQTT broker. So while I understand that for some the battery info is not working correctly, I'm pretty sure the fdcd advertisement log is useless for everyone and could be done without, which would make me an even happier user :-)

lesensei avatar May 05 '21 08:05 lesensei