-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add Xiaomi RoPot device #105
Conversation
Thanks! Could you add also some test case like the MiFlora please, decoder/tests/BLE/test_ble.cpp Line 11 in d5b82e6
And here is the input data: decoder/tests/BLE/test_ble.cpp Line 120 in d5b82e6
You will need to add the enum below also: decoder/tests/BLE/test_ble.cpp Line 156 in d5b82e6
|
6709f1b
to
6fb16a6
Compare
Thanks @emericg note the test erros
differnce between your commented out nested definition vs. onst char* _HHCCPOT002_json also please have a look at my comment about the model condition. The decoder still has a battery property in _HHCCPOT002_json_props which it actually doesn't seem to get from the data. |
Ok I've fixed the enum, and added test cases. |
Still the upper/lower case issue with "model"
|
Daamn. I can push this PR into one commit if you prefer. |
That would be preferable, but first please have a look at my comment about the model condition above, can you see it, about it currently only being
which can easily catch wrong devices which have a temperture of 34,9 ºC for example, or steps for the Mi Band etc. So a more specific
will avoid this. |
Sure no problem. This could be applied to the flower care as well, the 2 bytes starting at offset 4 are the product ID. |
Probably best to stick with the ones you can verify with your devices for the moment. So getting the product ID 2 bytes static at index 4, great. Also, do you get a serviceuuid (when you add |
Looking good. I've seen your WatchFlower project - great to get some of those extra device into the Decoder here :) Thanks |
I have all the devices :p An old Flower Care with 0x20 (but it has no useful data) and a new one with 0x02.
And the 16b service UUID is 0xFE95, like the flower care. |
The 'new' Flower Care already is integrated with the Mi Flora decoder, also with a "contain" only, but a more distinct 3 byte. @1technophile @h2zero - wondering if this maybe was implemented before the "index" option, and if an additional uuid comparison could/should be included? Same for the just merged RoPot decoder, which is more distinct now with the index condition, but would be even more unique with an addition AND uuid, which would then also require for the tests to be moved to the test_uuid section.
@emericg the only different bytes I can obviously see here, apart from the product ID, are {"id":"C4:7C:8D:62:D4:BE","name":"Flower care","servicedata":"310298004abed4628d7cc40d"} so not sure if you see them changing over time, or if the old model is only giving it's details with a connection ;) |
If I recall correctly, this decoder was derived from the original code in OMG. If a better/more specific detection is available then it should probably be added. |
I'm just thinking, that while a "contain" with 3 bytes looks quite unique for most cases, it could still, under some conditions, catch another device with matching data anywhere. So restricting it with "index" gives a higher uniqueness, and any addition serviceuuid would be ideal. There are quite a few, albeit all with 3 byte
only model condition decoders which could benefit from this.\ P.S.: So a very active Mi Band user with 38944 steps will currently be recognised as a Mi Flora device LOL |
I can make these "index" changes tomorrow if you all agree. @emericg - shall I extend the RoPot condition to the 3 byte "205d01" at the same time? |
I have no particular opinion on the 0x20. However if you do that, I think you can also remove the temperature from the RoPot. I still haven't got a temp reading, and I found out that esphome wasn't including it either, just moisture and fertility. With a direct connection I can read the current temperature and battery level though. But because these are not included in the theengs properties they are going to be ignored anyway. |
I've extended it to
and also removed the temperature according to your info. So that and the battery are not possible through the Decoder, but through OMG READ commands directly. Thanks |
Description:
Add Xiaomi RoPot device.
Let me know if the position of the RoPot in the _devices array is not good for you.
Checklist: