-
Notifications
You must be signed in to change notification settings - Fork 8
Xiaomi
Xiaomi IOT devices are supported. The following devices has been thoroughly tested:
You can interact with the Xiaomi devices in 3 ways:
- Read - Asking for their status, e.g. is the door open (door sensor)
- Report - Awaiting an action, e.g. when the door opens, it sends a notification (door sensor)
- Write - Send a message to the device (only some devices accepted this), e.g. play a sound (gateway)
All you Xiaomi devices are connected to a gateway. It is through this gateway, we are communicating with each of the devices. Each devices is identified by with SID. Before NimHA can use the Xiaomi devices, you need to setup the gateway and the devices with your Xiaomi app.
To write to a device, we need to exchange a encrypted key with the gateway based on a ever-changing token. We are currently using a Python script to generate the encrypted key from the token.
But before we can generate the key, you need to gather you gateway password. Follow this guide Domotics or the bullets below. Remember to write the key down.
- Install the Xiaomi app
- Set the region to Mainland China under Settings->Locale
- You can set the language to English, even though the region is China
- Sign in/Make an account
- Select your Gateway in the app
- Tap the 3 dots in top right corner
- Click About
- Tap on the version repeatedly until a new menu appear
- Click on Wireless communication protocol
- Enable the this and write down you password and press Ok
Inside NimHA goto the Xiaomi page.
Press the "Auto discover" button and wait. NimHA will find the connected Xiaomi devices and list them for you. You can change their names used in NimHA.
Inside NimHA goto the Xiaomi page.
Only devices that you can either read data from or devices their report status are allowed.
To continuously read a value each time it changes, you have to set the action to read
. This will ensure, that the value will be displayed on your dashboard.
When reading a value, the "Value data" needs to be empty.
The report is primary used in conjunction with the alarm. When using the report, you also need to specify the "Value data" and the "Trigger alarm".
For PIR sensors the "Value name" would be status
and the "Value data" would bed motion
.
For magnet sensors the "Value name" would be status
and the "Value data" would bed open
or close
.
Examples of possible values for "Value data":
- Read: PIR sensors will respond with
motion
- Read: Magnet sensors will respond with
voltage
- Read: Magnet sensors will respond with
status
for the switch - Report: PIR sensors will respond with
status
- Report: Magnet sensors will respond with
status
for the switch
Inside NimHA goto the Xiaomi page.
Only devices that you can write data to are allowed.
Insert ringtone
in the "Value name". Insert the ringtone number in "Value data": 8
To adjust the volume, append a comma and the volume number. Using ringtone 8 and volume level 4: 8,4
To create an action to stop the sound (good idea!), insert 10000
in the "Value data".
Insert rgb
in the "Value name". Insert the preferred color code in "Value data". For a red light insert: 4294914304
To assign a RGB color, you have to use the Android() color format.
You can convert HEX to Android() at this website.
- Red =
4294914304
- Green =
4283359807
- Purple =
4283637131
- Yellow =
4292211292
- Blue =
4283327469
- Off =
0
- Home
- Requirements
- Install NimHA
- Optional
- Modules
- Tutorials (helpers, etc.)
- Development