Configura Aqara Hub as alarm?

Hi everyone,

Currently I’m migrating from Aqara homekit to HomeAssistant in combination with my Deconz Conbee II
Now the challenge is to get my Aqara Hub to Home Assistant, but don’t know how.

Its a while ago that I was busy with this, but what I would like is to create flows from Home Assistant for several devices which are connected to the Conbee USB as I have also Ikea lights.

The Aqara hub must be used as an alarm system, so when I leave home, I can enable the alarm, by any detection or movement the alarm goes on and I will receive a notification.

Now I don’t know if this is possible?
When I add the Homekit option to home assistant will it be possible to create this?

From here I can read the following:

ery simple. Please config as @sergeymaysak tell above.

  • you CAN add your aqara hub (and all its bridged accessories) to home assistant using homekit controller component (https://www.home-assistant.io/components/homekit_controller/ )
  • todo so you need to remove your hub from home app (if its already added to it)
  • make sure you use PIN of your aqara (8 numbers) hub in configure action as XXX-XX-XXX format otherwise it does not work
  • however please note that on the date of posting HA ver. 0.91.0.dev0 does not have support for aqara mini switches and for aqara contact sensors. it supports hub/ its light/security system and temp/humidity sensors for now.

Is this an option which I can use?
My apologies for asking this as I’m in the middle of movement with my house and don’t have the Aqara hub unboxed yet from my old house.

Capture

Aqara hub has been added via the Homekit Controller, but someone knows how the alarm exactly works?

Currently started over again, for months now the alarm is configured in the Xiaomi app, but would like to have this migrated to ha

What I would like:

  • Turn alarm on after 11:00 PM
  • Turn alarm of after 6:00 AM

This works so far, but when my door sensors are open after 11:00PM or other sensors, I need to receive a message from ha to my iPhone that someone is detected. Also the possibility to set an ringtone…

see:

New flow for Aqara Hug G3, easy to configure and with more functions

Looking to use the non-Node Red version of this for my G3 but struggling with the getting all the right codes for the REST sensors.

As far as I can tell from the docs, I need to have:

Your value from POST Request Aqara app:
appid ( XXXXXXAPPIDXXXXXXXXXXX )
token ( XXXXXXTOKENXXXXXXXXXXX )
subjectId ( lumi1.XXXXXXXXXXXX ) usually MAC-ADDRESS
aqara url ( rpc-ger.aqara.com ) Host
list aqara url
timezone ( it-IT ) -> es-ES/en-UK/de-DE/it-IT/pt-PT/en-US...
userid ( automatic, enter manual if not work )

To get this info I can run a python script, but I also need to have:

command for generate token:
requirement:
python3 and pycryptodome

I don’t think I have Pycryptodome as I got an error message when I tried to run:

wget -q https://raw.githubusercontent.com/sdavides/AqaraPOST-Homeassistant/main/generatejson/AqaraPOST-tokenGenerator.py --output-document=/tmp/AqaraPOST-tokenGenerator.py && chmod +x /tmp/AqaraPOST-tokenGenerator.py && /tmp/AqaraPOST-tokenGenerator.py

Can I simply install Pycryptodome through the HA Terminal using these instructions and run the python script above again?

For Python 3.x:

$ sudo apt-get install build-essential libgmp3-dev python3-dev
$ pip install pycryptodomex
$ python3 -m Cryptodome.SelfTest

Sorry for the questions, but this is a wee bit outside my knowledge area. If someone could walk me through the process I’d be grateful.

Thanks.

Hi @P6Dave
you don’t have to use the terminal inside HA, but directly on the linux server, where have you installed HA on a linux server? Do you have a G3 Hub or other aqara device?

I abandoned the method without nodered, use nodered which has many more functions.

pip install pycryptodome
for install cryptodome

I have HA running in a Proxmox VE on a mini pc.

I have a G3 hub yes.

Ah okay. I don’t use nodered at all. All my automations are native HA created. Is it worth using nodered just for this do you think?

I don’t know Proxmox VE, what is the operating system?

Alternatively to find the values ​​you can use Burp or Zap with the pdf guides

I don’t understand “I don’t use nodered at all. All my automations are native HA created.”

I’m talking about NodeRed official HA addon

I went for the install using the HA terminal and got this

So it seems to have worked. Is the warning about running pip as the ‘root’ anything to worry about?

no it’s just a warning that you are using it with root which could be dangerous

I’ve not used this at all. Might be time to start :+1:

Yes, now is the time, try it and let me know the problems you have

1 Like

Okay, first problem.

When I run the python script to generate a token, the json I get is quite long as I have a few connected devices in my account and I’m not able to scroll up to the top to see the Token, AppID, UserID for the G3.

I’m doing this in the Home Assistant Terminal.

How do I get up the screen to see the result for the G3.

I don’t know how to help you, I don’t use the terminal in HA.

try

cd /tmp
./AqaraPOST-tokenGenerator.py | tee /tmp/output.txt
cat /tmp/output.txt | less

however you could modify the script to unquery the devices by commenting out the last few lines.

Unfortunately, my HA server is in the attic and I don’t fancy hauling a keyboard and monitor up there for direct access :confused:

I’ll have a play around with the script and see what I can do. Thanks.