AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.47k stars 347 forks source link

Add support 090615.remote.btsw1 on old gateway firmwares #1463

Open PeaceByPeace opened 1 month ago

PeaceByPeace commented 1 month ago

I have an issue and don't know to what it is related. The device is shown and connected but action status always stays the same no matter what I press(singe, double or hold actions doesn't appear in logs). What's more interesting when I press the botton it resets the counter last seen in logs to 1 sec and diagnostic value of bluetooth drops to 1 sec too , so integration has some internal connection going on but nothing works (btw in xiaomi app everything works as expected) image

gx19970920 commented 1 month ago

You click on this entity to see if there are any 'attributes', and the state change may be in the attributes

PeaceByPeace commented 1 month ago

You click on this entity to see if there are any 'attributes', and the state change may be in the attributes

No, there's no attributes to this sensor which is interesting because vibration sensor has attributes when triggered (which indicates that someting wrong with connection itself) .

image

image

I turn on logging sensor and data is updated when I press the button but no action is being recorded on the side of integration.

image image

Basically what I'm referring to is that only logging BLE sensor displays history information and action bell displays nothing, so that's the issue.

P.S. btw I tried to reset device and add it to mi home app again a couple times and result is still the same.

Update:

I found out that this button has no key last_report_gateway (I have bluetooth smoke detector which works fine and it has this attribute)

image

Now I have my suspicion on the matter of this key. What's far more interesting is that last seen parametr (which is present both is last_seen and last_report_gw) mac is mac of my xiaomi gateway 2. So basically there's a registration of connection (since last seen is updated as I press the button) but no key last_report_gateway, which is an attribute of timestamp class, maybe something wrong with that. Also "params" key value is empty which doesn't seems right.

AlexxIT commented 1 month ago

https://github.com/AlexxIT/XiaomiGateway3?tab=readme-ov-file#handle-ble-locks

PeaceByPeace commented 1 month ago

I still don't get how documentation would help me understand why action aren't appearing on action bell when I touch ptx button. Also you pointed to ble locks section which has nothing to do with my button but that's ok, maybe I don't understand something here. What I'm struggling to make sense of is if there was an action there should be a trace of it (basically last triggered state in action bell arrtibutes as documentation states) but no, it's nothing.

AlexxIT commented 1 month ago

You just need to learn how to write Hass automations. By states and attributes.

PeaceByPeace commented 1 month ago

I have over 20 automaions but never faced an issue like that. Basically since not a single object(except vibration sensors and button) has this kind of behaviour(I mean action bell), so that's why I'm asking since there's no attributes(except info and friendly name) and state of object, it's just blank

image

And after I press a button nothing had changed, it stays blank (no new attributes appearing). Only thing that changes is BLE sensor, so I'm assuming if issue won't go away I will be forced to use this sensor as indicator to my automation (I don't need a type of press, just fact itself). I still don't get what have I done wrong in that case. Would be much appreciated if you can provide me with detailed answer of what should I do. I rarely post something on internet like this and trying to find answers myself but it's a dead end for me, thank you in advance.

AlexxIT commented 1 month ago

Please show device diagnostics for your gateway device.

PeaceByPeace commented 1 month ago

config_entry-xiaomi_gateway3-01J569RA981HRJMH3NWXEXJCMA.json

AlexxIT commented 1 month ago

I think old gateway firmware could be reason of your problem. It can have old BLE format for your model. You needs update it. Or collect debug log, so I can update converter for supporting old format.

PeaceByPeace commented 1 month ago

As far as I can remember my gateway is supported by ingergation(lumi.gateway.mgl03 and 1.5.0_0026 version) and also wanted to point out that in native mi Home no issue whatsoever. What about BLE format? How can I update it? I will collect debug log but later (have no access to device at the moment). Wrapping up wanted to ask: there's a command select menu in diagnostic part of gateway integration which indicated I can update my gateway to a newer version, so I wonder, are there some issues regarding an update from 1.5.0_0026 to 1.5.5 for instance since I saw "limited support" because of the key. I'm asking because maybe there's something essentially broken in this version.

AlexxIT commented 1 month ago

It is very important to securely save the key before upgrading. Because it will be difficult to retrieve it after the upgrade. Some info about old BLE format you can read here https://github.com/AlexxIT/Blog/issues/20

PeaceByPeace commented 1 month ago

There's debug home-assistant_xiaomi_gateway3_2024-10-20T12-53-08.375Z.log

AlexxIT commented 1 month ago

You can check latest master version