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

Aqara hub Xiaomi integration not working (possibly since it is impossible to switch to local control who are the current and previous versions of mi app as opposed to steps in guide and tutorial) #94567

Closed
candybars2001 opened this issue Jun 13, 2023 · 10 comments

Comments

@candybars2001
Copy link

The problem

I am quite new here, I’m not very technical and most of my experience has been trying to get other systems to perform the type of automations Home Assistant can is an end-user, so I apologize for some technical illiteracy.

My Home Assistant OS is installed in virtual box on a Windows machine, according to the recommended configuration and with Bridged network in the VM, I’m full access to all devices to my Firewall (which monitors traffic and non-has been blocked).

I initially configured the aqara hub and sensors in the aqara app, but realized it did not have integration with Home Assistant so added it as a bridge through home controller integration. However, I quickly realized I would not get the functionality I need this way and that I would need to use xiaomi Mi app installation to get what I need. This includes luminance information needed for automation. More importantly even, without the proper integration, my goal of using multiple pairs of sensors on either side of each doorway. As a means to measure occupancy, could not be achieved by “ shortcutting” the way through home controller integration, something that it appears users are having to resort to from other thread because of the issues discussed ahead.

These “ occupancy” sensr pairs are only effective if their “sleep time “is reduced from 60 to the 5 second minimum, involving both a simple hardware hac (simple soldering in the sensor ), and automation configuration that requires proper integration of the hub and sensors into Home Assistant through Xiaomi-aqara integration ( long and bitter experience has shown me that PIR sensors are ineffective and situations where people are stationary).

I therefore reset the hub and sensors, switched the Hut mode to xiaomi mode, and configured everything again in the Mi app, according to the steps outlined in Home Assistant instructions for how to add Aqara MS1 Hub configured through Mi app, through the Aqara Xiaomi integration (https://www.home-assistant.io/integrations/xiaomi_aqara/) https://www.home-assistant.io/integrations/xiaomi_aqara/), which reference this old tutorial (https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)#Adding_the_Xiaomi_Gateway_to_Domoticz), that requires in the Mi app to switch to developer mode, which supposedly would allow moving the hub from WAN to local access and extracting Device tokens.

It’s completed, the device should be discovered by home assistant, and if not can be added manually through the Xiaomi Aqara integration.

However, as can be seen in the screenshots below as well as in many discussion threads that I have been through and through, for quite a long while now, the option described in the tutorial to switch to press something five times, switch to developer mode and then switch the hub over to Lan mode on Mi app no longer exists. According to the current mi tutorial in the app, only a specific xiaomi hub with an app available only for xiaomi phones, enables switching to local access mode. The guide and specifically the tutorial it refers to discuss a version that has long been unavailable even in android old a APK files which I tried as an alternatives (don’t match current OS requirement).

I was able to extract the tokens of my devices by finding this link referenced in some of the discussions over the issue(https://github.com/PiotrMachowski).

Following this I tried to add the hub after it was not discovered automatically even though it appears fine mi app, Northrough the xiaomi aqara integration, and I checked for every possible troubleshooting issue in various threads (setting VIP with without Mac address, verify my Firewalla wasn’t blocking a single packet and the virtual machine on which home assistant is running is in network bridged mode as well, running integration on windows machine running home assistant, among others). A specific log error that I’m not sure if relate to this or not but correlates in time, is in the relevant section below.

I’m reporting this as a bug because I see the issue persist but not resolved through multiple threads, and because Home Assistant itself seems to rely on that does not exist in mi app and references impossible options there. Of course there could be another reason other than local area settings that my hub does not show up on Home Assistant, but I think I rolled them out and the fact that it works properly on the MI qpp, is the first cannot second version of M which apparently has some issues, leads me repeatedly to a dead end. I think you in advance for reading this long description and hope that this issue with seems to travel others too, can be resolved
IMG_2518
IMG_2517
IMG_2509
IMG_2521
IMG_2522
IMG_2520
IMG_2510
IMG_2511

What version of Home Assistant Core has the issue?

core-2023.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Xiaomi aqara

Link to integration documentation on our website

See links in the body of thr text

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

am not very versed in this, I captured bug error that happens when I try to add the hub just adding it here in case it’s connected:

Logger: frontend.js.latest.202306080
Source: components/system_log/__init__.py:257 
First occurred: June 13, 2023 at 11:36:06 PM (68027 occurrences) 
Last logged: 2:15:29 AM

:0:0 Script error.

Additional information

No response

@home-assistant
Copy link

Hey there @Danielhiversen, @syssi, mind taking a look at this issue as it has been labeled with an integration (xiaomi_aqara) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of xiaomi_aqara can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign xiaomi_aqara Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


xiaomi_aqara documentation
xiaomi_aqara source
(message by IssueLinks)

@candybars2001
Copy link
Author

candybars2001 commented Jun 14, 2023

Small update, I wanted to check my theory that the Hub is not discovered because of the local issue, so just for the hell of it I tried using xiaomi Milo integration ,with cloud controlled. devices and switches (supposed to work with a Quora ms1). I entered my mi account credentials,and was able to connect to the aqara MS1 hub, that and no other. It’s not useful and I am going to remove it, but I think this reinforces the premise that the issue is lack of functionality in the mi configuration platform to prepare devices for local access, while a device while a device that should be showing in the local integration, ends up in this place even though it’s not on the list perhaps it’ll help resolve thank you attached screenshots
IMG_2528
IMG_2529
IMG_2533
``

@candybars2001
Copy link
Author

candybars2001 commented Jun 15, 2023

I see this has been assigned to someone, but perhaps because of the update that I added It was missed and has not been addressed yet. I’m waiting on a solution because I’m planning to buy a large number of these sensors during the sale on the 18th. Assuming I can make it work. I really hope someone can take a look at it by then thank you again.

Reference to discussion boards that clearly indicate lack of developer options in the last several years in the in mi qpp. Hope someone takes a look at this

https://community.home-assistant.io/t/not-able-to-get-xiaomi-gateway-key/61795/202

@syssi
Copy link
Member

syssi commented Jun 17, 2023

@starkillerOG could you help here? If I remember correctly this gateway (lumi.gateway.acn004) isn't supported by xiaomi_miio and xiaomi_aqara.

@candybars2001
Copy link
Author

I hope somebody respond to this thread. It’s very confusing, because in the first link that I mentioned, the xiaomi Aqara Integration instructions which references the tutorial, the hub is on one hand on the unsupported device list, On the other hand, The entire section is devoted to how to add this hub and highlights that the first generation, MS1 It’s more straightforward. The tutorial it references, does require changing to local access through mi app, Step-by-step however, things that are not possible And menus that do not exist on that app today.

So at the very least, it’s not up-to-date. However, I was able to add the hub with the sensors through the xiaomi milo Integration, and there is a thread on how to get the secret key if you want to Perform further Customizations. I want to convert pairs of sensors into an occupancy “the counter”, As I explained, And there is no up-to-date explanation how to do that with A hub that is, in fact, supported and working (Lumi gateway).

So it would be nice if someone addressed this, and if I Need to get rid of that hub and get something else, be straightforward about what I need to do as a non-technical new user. Guess this is related to what you are also The general subject you are trying to get the attention of someone To look good over here and hopefully it happens sooner than later. Thanks.

@starkillerOG could you help here? If I remember correctly this gateway (lumi.gateway.acn004) isn't supported by xiaomi_miio and xiaomi_aqara.

@starkillerOG
Copy link
Contributor

@candybars2001 your gateway model "lumi.gateway.acn004" is not in the list of supported gateways.
This means it has not been tested and not reported to work.

I would guess it will not work with the xiaomi_aqara integration since the last few newer models were also lacking the local control API for that integration.

The xiaomi_miio integration might work but might also not work, it has not been tested.
Subdivices (sensors) will most likely not work (yet).
I have been working on getting subdevices working in xiaomi_miio for 1.5 years now, see #64726.

It does work for me, but the problem is that the upstream library python-miio https://github.com/rytilahti/python-miio has not seen a release for ages (last release was a year ago). This has been very frustrating for me as a developer since that ment my PR has been stuck for ages.

Maybe @rytilahti could shed some light on when a new release is planned?

Currently your best bed would be to buy a zigbee stick like the Sonoff Zigbee USB Dongle Plus-E and integrate the aqara devices through that using either ZHA or zigbee2mqtt.

@candybars2001
Copy link
Author

thank you first of all for responding. Regarding xiaomi aqara integration, you’re right it doesn’t work, however both device and sensors (aqara model RTCGQ11LM) child devices, do work for me with the xiaomi_Milo integration. If I can do anything to help that work for others with my limited technical capabilities I’ll be happy to do that.

The problem is that the mi application does not allow changing from wan to local access (in this respect, the section of xiaomi aqara integration in the home assistant guide should be corrected, as regardless of the hub model it indicates the need to switch to local access and that is not possible because of the application not the model). By the way in the mi app (I may have mentioned this), and the help section somewhere it talks about a xiaomi gateway that enables local control over ms1 Gateway, in another section mentions that this is possible with xiaomi phones any specific app that is only available there. So they’re definitely not trying to make it easier…

Anyway since I need to change the sleep time to five seconds, I do need local access and it does appear that the sonof model is the easiest to deal with that regard. I’ve already ruined two sensors trying to perform the hardware hack and read that with sonof you only need to add an automation to enable it without changing the ZHA integration and without performing the hardware hack. Is it something you can confirm? Any advice about that would be appreciated as well.

I am seeing this dongle available for about US$75 on AliExpress. Does that make sense? Depending on the destination country prices really changed there, so if it’s a reasonable price I’ll get it there but if it’s available elsewhere for less (the aqara was about $20 and I also bought Tuya how do that won’t need I guess).

Also, for something around 150 ft.²/1500 m² when placed in the center, the aqara MS1 hub covers all my sensors. However I read that often a repeater is needed, can you advise on that and if so what should I get??

Thanks a lot again!

@candybars2001 your gateway model "lumi.gateway.acn004" is not in the list of supported gateways. This means it has not been tested and not reported to work.

I would guess it will not work with the xiaomi_aqara integration since the last few newer models were also lacking the local control API for that integration.

The xiaomi_miio integration might work but might also not work, it has not been tested. Subdivices (sensors) will most likely not work (yet). I have been working on getting subdevices working in xiaomi_miio for 1.5 years now, see #64726.

It does work for me, but the problem is that the upstream library python-miio https://github.com/rytilahti/python-miio has not seen a release for ages (last release was a year ago). This has been very frustrating for me as a developer since that ment my PR has been stuck for ages.

Maybe @rytilahti could shed some light on when a new release is planned?

Currently your best bed would be to buy a zigbee stick like the Sonoff Zigbee USB Dongle Plus-E and integrate the aqara devices through that using either ZHA or zigbee2mqtt.

@starkillerOG
Copy link
Contributor

I am definetly not a export on this stuff, but got my Sonoff zigbee usb stick for about €30,-.
The range is supposed to be very good, but have not tested it myself.

@candybars2001
Copy link
Author

Thanks yes I found it on AliExpress after that. Do you know if I set up aqara P1 sensor short sleep/wake up time, and I assume it's possible in aqara or xiaomi app, are those settings not going to transpire if I use either home controller integration through aqara and home bridge, or the milo integration, both of which show my m1s and attached sensors, although I have the older model now so I cannot configure the sleep time. What does integrations not reflect the configuration of P1? I'm asking because this is just the easiest way for me to implement this, but if not, I'm reading conflicting recommendations about sonof, including that the plusE is better also includes and mqtt ever need it than thr plus. Any information about this and how straightforward it would be to change the delay settings through the ZHA integration versus the ways I contemplate to try ?thanks

I am definetly not a export on this stuff, but got my Sonoff zigbee usb stick for about €30,-.

The range is supposed to be very good, but have not tested it myself.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants