Skip to content
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

Switchbot Meter Plus sometimes detected as Tile tracker #505

Closed
brandonmpace opened this issue Jan 29, 2024 · 7 comments
Closed

Switchbot Meter Plus sometimes detected as Tile tracker #505

brandonmpace opened this issue Jan 29, 2024 · 7 comments

Comments

@brandonmpace
Copy link

brandonmpace commented Jan 29, 2024

I have a Switchbot Meter Plus that was being picked up as a "Smart Tracker" for a bit.

To Reproduce

I collected output from runs of examples/python/ScanAndDecode.py

In the bad detection state the device sends out data like this: (MAC in output redacted, replaced with DC:FF:FF:FF:FF:FF)

DC:FF:FF:FF:FF:FF:AdvertisementData(manufacturer_data={2409: b'\xdc\xff\xff\xff\xff\xff\x03\x03\x08\x97\xad', 64: b'\x00l\x02'}, service_data={'0000feed-0000-1000-8000-00805f9b34fb': b'\x02\x00\xa3\rY\xa8\xff\x18\x14\xfa'}, rssi=-54)
data sent to decoder:  {"servicedatauuid": "feed", "servicedata": "0200a30d59a8ff1814fa", "manufacturerdata": "6909dcffffffffff03030897ad", "id": "DC:FF:FF:FF:FF:FF", "rssi": -54}
TheengsDecoder found device: {"servicedatauuid":"feed","servicedata":"0200a30d59a8ff1814fa","manufacturerdata":"6909dcffffffffff03030897ad","id":"DC:FF:FF:FF:FF:FF","rssi":-54,"brand":"Tile","model":"Smart Tracker","model_id":"TILE","type":"TRACK","cidc":false,"acts":true,"cont":true,"track":true,"device":"Tile Tracker"}
{"properties":{"device":{"unit":"string","name":"tracker device"}}}
brand: Tile , model: Smart Tracker

Note the manufacturer data confirms it is my Switchbot Meter Plus.
I don't know why the sent data was different or what the exact trigger was since I had done several things, including:

  • added it in Switchbot app
  • confirmed it was on latest current firmware
  • removed it from the app
  • held button on back for 15 seconds to fully reset it

Expected behavior
The data it sent out when it was properly tagged:

DC:FF:FF:FF:FF:FF:AdvertisementData(manufacturer_data={2409: b'\xdc\xff\xff\xff\xff\xff\x05\x03\x07\x97\xad'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'i\x00\xe4\x07\x97\xad'}, rssi=-64)
data sent to decoder:  {"servicedatauuid": "fd3d", "servicedata": "6900e40797ad", "manufacturerdata": "6909dcffffffffff05030797ad", "id": "DC:FF:FF:FF:FF:FF", "rssi": -64}
TheengsDecoder found device: {"servicedatauuid":"fd3d","servicedata":"6900e40797ad","manufacturerdata":"6909dcffffffffff05030797ad","id":"DC:FF:FF:FF:FF:FF","rssi":-64,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","type":"THB","acts":true,"tempc":23.7,"tempf":74.66,"hum":45,"batt":100}
{"properties":{"tempc":{"unit":"°C","name":"temperature"},"hum":{"unit":"%","name":"humidity"},"batt":{"unit":"%","name":"battery"}}}
brand: SwitchBot , model: Meter (Plus)

Environment (please complete the following information):

  • version used: 1.6.8

Additional context
This is output for a tracker, for comparison:

F8:FF:FF:FF:FF:FF:AdvertisementData(service_data={'0000feed-0000-1000-8000-00805f9b34fb': b'\x02\x00d\x85\xdd\x85gyp\xa8'}, service_uuids=['0000feed-0000-1000-8000-00805f9b34fb'], rssi=-70)
data sent to decoder:  {"servicedatauuid": "feed", "servicedata": "02006485dd85677970a8", "id": "F8:FF:FF:FF:FF:FF", "rssi": -70}
TheengsDecoder found device: {"servicedatauuid":"feed","servicedata":"02006485dd85677970a8","id":"F8:FF:FF:FF:FF:FF","rssi":-70,"brand":"Tile","model":"Smart Tracker","model_id":"TILE","type":"TRACK","cidc":false,"acts":true,"cont":true,"track":true,"device":"Tile Tracker"}
{"properties":{"device":{"unit":"string","name":"tracker device"}}}
brand: Tile , model: Smart Tracker

I note that there is no manufacturer data for that device.
Maybe that could be used to fine-tune the tracker detection? Right now it appears to be solely based on uuid

@DigiH
Copy link
Member

DigiH commented Jan 29, 2024

Hi @brandonmpace

Yes, very strange and unwanted recognition of your Meter Plus as a Tile tracker.

Not having a Meter Plus nor a Tile tracker, these two decoder have been solely based on user data and the BLE-API from the semi-offical SwitchBot repo.

For the Tile trackers the uuids for model recognition have been fine so far, with being unique to Tile, but obviously it seems that SwitchBot is now using the same uuid for a Meter Plus alternative broadcast, while at the same time the actual servicedata is a lot longer too, 20, compared to the expected 12, which is also being broadcast when your Meter Plus is being recognised correctly.

It seems that this longer alternative servicedata does not actually contain the temperature and humidity information which is gathered and decoded from the 12 long servicedata, unless it has been encoded in a very different way with this broadcasts.

Why your Meter Plus seems to broadcast two different kinds of servicedata we really don't know, even the first octet, which normally indicates the device type of a SwitchBot device is with 02 and undocumented type.

So with no apparent decodable data in these alternative broadcasts, this is more a situation of how to not recognise this as a Tile tracker, and not in trying to get it to be recognised as a Meter Plus with the possibility of getting useful information from it.

@brandonmpace
Copy link
Author

Agreed, this issue is mostly to avoid the 'false positive' case and not recognize it as a Tile

@DigiH
Copy link
Member

DigiH commented Jan 29, 2024

@brandonmpace Would you mind giving this test branch a go?

https://github.com/DigiH/decoder/tree/tile-test

Hopefully not wrongly recognising the new "feed" Meter Plus broadcasts as a Tile tracker any longer.

@brandonmpace
Copy link
Author

It is working for me. Tile is still recognized and the Meter is not categorized as a Tile.

In the changes I see both "no-mfgdata" and "no-mandata" and I'm curious what the difference is. It may also be helpful to add a note to adding-decoders.md if that was merged.

Below the debug print you added is the "match = true;" supposed to be outside the if?

@DigiH
Copy link
Member

DigiH commented Jan 30, 2024

Well spotted, but that part should have not actually been in the commit ;)

Could you try again please with the cleaned up version of the test decoder and possibly post a Meter Plus message with the actual servicedata when it's not recognised as a Tile?

@brandonmpace
Copy link
Author

Active scan for the meters works still (not currently sending the 'feed' uuid though)

CC:FF:FF:FF:FF:FF:AdvertisementData(manufacturer_data={2409: b'\xcc\x12{\x8c\x03=\x80\x03\x08\x96\xa9'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'T\x00\xe4\x08\x96\xa9'}, rssi=-63)
data sent to decoder:  {"servicedatauuid": "fd3d", "servicedata": "5400e40896a9", "manufacturerdata": "6909ccffffffffff80030896a9", "id": "CC:FF:FF:FF:FF:FF", "rssi": -63}
TheengsDecoder found device: {"servicedatauuid":"fd3d","servicedata":"5400e40896a9","manufacturerdata":"6909ccffffffffff80030896a9","id":"CC:FF:FF:FF:FF:FF","rssi":-63,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","type":"THB","acts":true,"tempc":22.8,"tempf":73.04,"hum":41,"batt":100}
{"properties":{"tempc":{"unit":"°C","name":"temperature"},"hum":{"unit":"%","name":"humidity"},"batt":{"unit":"%","name":"battery"}}}
brand: SwitchBot , model: Meter (Plus)

DC:FF:FF:FF:FF:FF:AdvertisementData(manufacturer_data={2409: b'\xdc\xf8p\x06\xad#\xe1\x03\x08\x96\xa9'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'i\x00\xe4\x08\x96\xa9'}, rssi=-63)
data sent to decoder:  {"servicedatauuid": "fd3d", "servicedata": "6900e40896a9", "manufacturerdata": "6909dcffffffffffe1030896a9", "id": "DC:FF:FF:FF:FF:FF", "rssi": -63}
TheengsDecoder found device: {"servicedatauuid":"fd3d","servicedata":"6900e40896a9","manufacturerdata":"6909dcffffffffffe1030896a9","id":"DC:FF:FF:FF:FF:FF","rssi":-63,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","type":"THB","acts":true,"tempc":22.8,"tempf":73.04,"hum":41,"batt":100}
{"properties":{"tempc":{"unit":"°C","name":"temperature"},"hum":{"unit":"%","name":"humidity"},"batt":{"unit":"%","name":"battery"}}}
brand: SwitchBot , model: Meter (Plus)

DD:FF:FF:FF:FF:FF:AdvertisementData(manufacturer_data={2409: b'\xdd\xb6x\xc1|\x9b\x1e\x03\t\x96*\x00'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'w\x00\xe4'}, rssi=-58)
data sent to decoder:  {"servicedatauuid": "fd3d", "servicedata": "7700e4", "manufacturerdata": "6909ddffffffffff1e0309962a00", "id": "DD:FF:FF:FF:FF:FF", "rssi": -58}
TheengsDecoder found device: {"servicedatauuid":"fd3d","servicedata":"7700e4","manufacturerdata":"6909ddffffffffff1e0309962a00","id":"DD:FF:FF:FF:FF:FF","rssi":-58,"brand":"SwitchBot","model":"Outdoor Meter","model_id":"W340001X","type":"THB","acts":true,"tempc":22.9,"tempf":73.22,"hum":42,"batt":100,"mac":"DD:FF:FF:FF:FF:FF"}
{"properties":{"tempc":{"unit":"°C","name":"temperature"},"hum":{"unit":"%","name":"humidity"},"batt":{"unit":"%","name":"battery"},"mac":{"unit":"string","name":"MAC address"}}}
brand: SwitchBot , model: Outdoor Meter

And the tracker also still works:

F8:FF:FF:FF:FF:FF:AdvertisementData(service_data={'0000feed-0000-1000-8000-00805f9b34fb': b'\x02\x000rP\xb5\x86\x19\xabC'}, service_uuids=['0000feed-0000-1000-8000-00805f9b34fb'], rssi=-77)
data sent to decoder:  {"servicedatauuid": "feed", "servicedata": "0200307250b58619ab43", "id": "F8:FF:FF:FF:FF:FF", "rssi": -77}
TheengsDecoder found device: {"servicedatauuid":"feed","servicedata":"0200307250b58619ab43","id":"F8:FF:FF:FF:FF:FF","rssi":-77,"brand":"Tile","model":"Smart Tracker","model_id":"TILE","type":"TRACK","cidc":false,"acts":true,"cont":true,"track":true,"device":"Tile Tracker"}
{"properties":{"device":{"unit":"string","name":"tracker device"}}}
brand: Tile , model: Smart Tracker

Since the odd brodcasts weren't happening I just manually tested the library to confirm the None was returned:

>>> import TheengsDecoder
>>> test_string = '{"servicedatauuid": "feed", "servicedata": "0200a30d59a8ff1814fa", "manufacturerdata": "6909dcffffffffff03030897ad", "id": "DC:FF:FF:FF:FF:FF", "rssi": -54}'
>>> TheengsDecoder.decodeBLE(test_string)
>>>

DigiH added a commit to DigiH/decoder that referenced this issue Jan 31, 2024
"no-mfgdata" model condition implementation and application in the Tile tracker decoder

theengs#505
@DigiH
Copy link
Member

DigiH commented Jan 31, 2024

Great, thanks for the confirmation.

Merged this after adding the additional new no-mfgdata model condition option to the docs.

@DigiH DigiH closed this as completed Jan 31, 2024
DigiH added a commit that referenced this issue Jan 31, 2024
"no-mfgdata" model condition implementation and application in the Tile tracker decoder

#505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants