Merge branch 'current' into next

This commit is contained in:
Paulus Schoutsen 2017-09-21 21:23:50 -07:00
commit 1b1bf59c0c
43 changed files with 311 additions and 230 deletions

View file

@ -75,7 +75,7 @@ freshwater_temp_alert:
### {% linkable_title Complex Alert Criteria %}
By design, the `alert` component only handles very simple criteria for firing. That is, is only checks if a single entity's state is equal to a value. At some point, it may be desireable to have an alert with a more complex criteria. Possibly, when a battery percentage falls below a threshold. Maybe you want to disable the alert on certain days. Maybe the alert firing should depend on more than one input. For all of these situations, it is best to use the alert in conjunction with a `Template Binary Sensor`. The following example does that.
By design, the `alert` component only handles very simple criteria for firing. That is, it only checks if a single entity's state is equal to a value. At some point, it may be desireable to have an alert with a more complex criteria. Possibly, when a battery percentage falls below a threshold. Maybe you want to disable the alert on certain days. Maybe the alert firing should depend on more than one input. For all of these situations, it is best to use the alert in conjunction with a `Template Binary Sensor`. The following example does that.
```yaml
binary_sensor:

View file

@ -14,12 +14,9 @@ ha_release: 0.53
---
The `bayesian` binary sensor platform observes the state from multiple sensors and uses Bayes' rule to estimate the probability that an event has occurred
given the state of the observed sensors. If the estimated posterior probability is above the `probabiliy_threshold`, the value of the sensor is `on`.
Otherwise, the sensor is `off`.
The `bayesian` binary sensor platform observes the state from multiple sensors and uses Bayes' rule to estimate the probability that an event has occurred given the state of the observed sensors. If the estimated posterior probability is above the `probability_threshold`, the sensor is `on` otherwise it is `off`.
This allows for the detection of complex events that may not be readily observable, i.e., cooking, showering, in bed, the start of a morning routine, etc. It
can also be used to gain greater confidence about events that _are_ directly observable, but for which the sensors can be unreliable, i.e., presence.
This allows for the detection of complex events that may not be readily observable, e.g., cooking, showering, in bed, the start of a morning routine, etc. It can also be used to gain greater confidence about events that _are_ directly observable, but for which the sensors can be unreliable, e.g., presence.
To enable the Bayesian sensor, add the following lines to your `configuration.yaml`:
@ -39,7 +36,7 @@ binary_sensor:
Configuration variables:
- **prior** (*Required*): The prior probability of the event. At any point in time (ignoring all external influences) how likely is this event to occur?
- **observations** array (*Required*): The observations which should influence the likelihood that the given event has occurred.
- **observations** array (*Required*): The observations which should influence the likelihood that the given event has occurred.
- **entity_id** (*Required*): Name of the entity to monitor.
- **prob_given_true** (*Required*): The probability of the observation occurring, given the event is `true`.
- **prob_given_false** (*Optional*): The probability of the observation occurring, given the event is `false` can be set as well. If `prob_given_false` is not set, it will default to `1 - prob_given_true`.
@ -77,4 +74,3 @@ binary_sensor:
platform: 'state'
to_state: 'below_horizon'
```

View file

@ -108,7 +108,7 @@ This example creates a washing machine "load running" sensor by monitoring an en
binary_sensor:
- platform: template
name: Washing Machine
value_template: {% raw %}'{{ sensor.washing_machine_power > 0 }}'{% endraw %}
value_template: {% raw %}'{{ states.sensor.washing_machine_power.state > 0 }}'{% endraw %}
off_delay:
minutes: 5
```
@ -117,7 +117,7 @@ binary_sensor:
This example is determining if anyone is home based on the combination
of device tracking and motion sensors. It's extremely useful if you
have kids / baby sitter / grand parrents who might still be in your
have kids/baby sitter/ grand parents who might still be in your
house that aren't represented by a trackable device in home
assistant. This is providing a composite of wifi based device tracking
and z-wave multisensor presence sensors.

View file

@ -28,6 +28,6 @@ camera:
Configuration variables:
- **ffmpeg_arguments**: (*Optional*): Extra options to pass to ffmpeg, e.g. image quality or video filter options.
- **ffmpeg_arguments**: (*Optional*): Extra options to pass to ffmpeg, e.g., image quality or video filter options.
**Note:** To be able to playback the last capture, it is required to install the `ffmpeg` component. Make sure to follow the steps mentioned at [FFMPEG](https://home-assistant.io/components/ffmpeg/) documentation.

View file

@ -26,10 +26,10 @@ counter:
Configuration variables:
- **[alias]** (*Required*): Alias for the slider input. Multiple entries are allowed.
- **name** (*Optional*): Friendly name of the slider input.
- **[alias]** (*Required*): Alias for the counter. Multiple entries are allowed.
- **name** (*Optional*): Friendly name of the counter.
- **initial** (*Optional*): Initial value when Home Assistant starts. Defaults to 0.
- **step** (*Optional*): Step value for the slider. Defaults to 1.
- **step** (*Optional*): Incremental/step value for the counter. Defaults to 1 (increments by 1).
- **icon** (*Optional*): Icon for entry.
Pick an icon that you can find on [materialdesignicons.com](https://materialdesignicons.com/) to use for your input and prefix the name with `mdi:`. For example `mdi:car`, `mdi:ambulance`, or `mdi:motorbike`.

View file

@ -13,10 +13,10 @@ ha_iot_class: "Local Polling"
ha_release: 0.18
---
This tracker discovers new devices on boot and tracks bluetooth devices periodically based on interval_seconds value. It is not required to pair the devices with each other! Devices discovered are stored with 'bt_' as the prefix for device mac addresses in `known_devices.yaml`.
This tracker discovers new devices on boot and tracks Bluetooth devices periodically based on `interval_seconds` value. It is not required to pair the devices with each other! Devices discovered are stored with 'bt_' as the prefix for device MAC addresses in `known_devices.yaml`.
<p class='note'>
If you are using [Hass.io](/hassio/) you will need to enable the Bluetooth BCM43xx (/addons/bluetooth_bcm43xx/) addon.
[Hass.io](/hassio/) only supports bluetooth on Raspberry Pi 3 via the Bluetooth BCM43xx (/addons/bluetooth_bcm43xx/) addon. [Hass.io](/hassio/) doesn't support external Bluetooth dongles.
</p>
To use the Bluetooth tracker in your installation, add the following to your `configuration.yaml` file:
@ -27,6 +27,6 @@ device_tracker:
- platform: bluetooth_tracker
```
In some cases it can be that your device is not discovered. In that case let your phone scan for BT devices while you restart Home Assistant. Just hit `Scan` on your phone all the time until Home Assistant is fully restarted and the device should appear in `known_devices.yaml`.
In some cases it can be that your device is not discovered. In that case let your phone scan for Bluetooth devices while you restart Home Assistant. Just hit `Scan` on your phone all the time until Home Assistant is fully restarted and the device should appear in `known_devices.yaml`.
For additional configuration variables check the [Device tracker page](/components/device_tracker/).

View file

@ -55,11 +55,14 @@ Valid values for ignore are:
* `apple_tv`: Apple TV
* `axis`: Axis Communications security devices
* `bluesound`
* `bose_soundtouch`: Bose Soundtouch speakers
* `denonavr`: Denon Network Receivers
* `directv`: DirecTV
* `flux_led`: Flux Led/MagicLight
* `frontier_silicon`
* `google_cast`: Google Chromecast
* `harmony`: Harmony Hub
* `ikea_tradfri`: IKEA Trådfri
* `logitech_mediaserver`: Logitech media server - Squeezebox player
* `openhome`: Linn/Openhome
@ -67,11 +70,12 @@ Valid values for ignore are:
* `philips_hue`: Philips Hue
* `plex_mediaserver`: Plex media server
* `roku`: Roku media player
* `sabnzbd`
* `samsung_tv`: Samsung TV
* `sonos`: Sonos Speakers
* `yamaha`: Yamaha media player
* `yeelight`: Yeelight Sunflower Bulb
<p class='note'>
Home Assistant must be on the same network as the devices for uPnP discovery to work.
If running Home Assistant in a [Docker container](/docs/installation/docker/) use switch `--net=host` to put it on the host's network.

View file

@ -37,7 +37,6 @@ Configuration variables (global):
- **hosts** (*Required*): Configuration for each host to integrate into Home Assistant.
- **local_ip** (*Optional*): IP of device running Home Assistant. Override autodetected value for exotic network setups.
- **local_port** (*Optional*): Port for connection with Home Assistant. By default it is randomly assigned.
- **delay** (*Optional*): [Float] Delay fetching of current state per device on startup. Used to prevent overloading of the CCU. Defaults to 0.5.
Configuration variables (host):
@ -55,7 +54,6 @@ Configuration variables (host):
```yaml
homematic:
delay: 1.0
hosts:
rf:
ip: 127.0.0.1

View file

@ -62,6 +62,8 @@ http:
The [Set up encryption using Let's Encrypt](/blog/2015/12/13/setup-encryption-using-lets-encrypt/) blog post gives you details about the encryption of your traffic using free certificates from [Let's Encrypt](https://letsencrypt.org/).
Or use a self signed certificate following the instructions here [Self-signed certificate for SSL/TLS](/docs/ecosystem/certificates/tls_self_signed_certificate/)
On top of the `http` component is a [REST API](/developers/rest_api/) and a [Python API](/developers/python_api/) available. There is also support for [Server-sent events](/developers/server_sent_events/).
The `http` platforms are not real platforms within the meaning of the terminology used around Home Assistant. Home Assistant's [REST API](/developers/rest_api/) sends and receives messages over HTTP.

View file

@ -13,15 +13,15 @@ featured: true
ha_iot_class: "Cloud Push"
---
[IFTTT](https://ifttt.com) is a web service that allows users to create chains of simple conditional statements, so called "Applets". With the IFTTT component you can trigger applets through the **"Maker"** channel. See the [announcement blog post](/blog/2015/09/13/home-assistant-meets-ifttt/) for examples how to use it.
[IFTTT](https://ifttt.com) is a web service that allows users to create chains of simple conditional statements, so called "Applets". With the IFTTT component you can trigger applets through the **"Webhooks"** service (which was previously the **"Maker"** channel). See the [announcement blog post](/blog/2015/09/13/home-assistant-meets-ifttt/) for examples how to use it.
```yaml
# Example configuration.yaml entry
ifttt:
key: xxxxx-x-xxxxxxxxxxxxx
key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
`key` is your API key which can be obtained by viewing the **Settings** of the [Maker Channel](https://ifttt.com/services/maker_webhooks/settings). It's the last part of the URL (e.g. https://maker.ifttt.com/use/MYAPIKEY) you will find under **Settings** > **Account Info**.
`key` is your API key which can be obtained by viewing the **Settings** of the [Webhooks applet](https://ifttt.com/services/maker_webhooks/settings). It's the last part of the URL (e.g. https://maker.ifttt.com/use/MYAPIKEY) you will find under **My Applets** > **Webhooks** > **Settings**.
<p class='img'>
@ -37,7 +37,7 @@ After restarting the server, be sure to watch the console for any logging errors
### {% linkable_title Testing your trigger %}
You can use the **Developer tools** to test your [Maker Channel](https://ifttt.com/maker) trigger. To do this, open the Home Assistant frontend, open the sidebar, click on the first icon in the developer tools. This should get you to the **Call Service** screen. Fill in the following values:
You can use the **Developer tools** to test your [Webhooks](https://ifttt.com/maker_webhooks) trigger. To do this, open the Home Assistant frontend, open the sidebar, click on the first icon in the developer tools. This should get you to the **Call Service** screen. Fill in the following values:
Field | Value
----- | -----
@ -52,11 +52,11 @@ When your screen looks like this, click the 'call service' button.
### {% linkable_title Setting up a recipe %}
Press the *New applet* button and search for *Maker* .
Press the *New applet* button and search for *Webhooks*.
<p class='img'>
<img src='/images/components/ifttt/setup_service.png' />
Choose "Maker" as service.
Choose "Webhooks" as service.
</p>
<p class='img'>

View file

@ -17,7 +17,7 @@ The `xiaomi_philipslight` platform allows you to control the state of your Xiaom
Currently, the supported features are `on`, `off`, `set_cct` (colortemp) , `set_bright` (brightness).
Please follow the instructions on [Retrieving the Access Token](/xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
Please follow the instructions on [Retrieving the Access Token](/components/vacuum.xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
To add a Xiaomi Philips Light to your installation, add the following to your configuration.yaml file:

View file

@ -23,6 +23,7 @@ The requirement is that you have setup [Wink](/components/wink/).
- Kwikset
- Schlage
- August (No Wink hub required) (August Connect required)
- Generic Z-wave
<p class='note'>

View file

@ -13,7 +13,7 @@ ha_release: 0.49
---
The `media_extractor` component gets an stream URL and send it to a media player entity. This component can extract entity specific streams if configured accordingly.
The `media_extractor` component gets a stream URL and sends it to a media player entity. This component can extract entity specific streams if configured accordingly.
<p class='note'>
Media extractor doesn't transcode streams, it just tries to find stream that match requested query.

View file

@ -14,7 +14,7 @@ Interacts with media players on your network. Please check the sidebar for a ful
## {% linkable_title Services %}
### {% linkable_title Media control services %}
Available services: `turn_on`, `turn_off`, `toggle`, `volume_up`, `volume_down`, `media_play_pause`, `media_play`, `media_pause`, `media_stop`, `media_next_track`, `media_previous_track`, `clear_playlist`
Available services: `turn_on`, `turn_off`, `toggle`, `volume_up`, `volume_down`, `media_play_pause`, `play_media`, `media_pause`, `media_stop`, `media_next_track`, `media_previous_track`, `clear_playlist`
| Service data attribute | Optional | Description |
| ---------------------- | -------- | ------------------------------------------------ |

View file

@ -38,6 +38,7 @@ Configuration variables:
Currently known supported models:
- C7700
- D6500
- D7000
- D8000
- ES5500

View file

@ -27,7 +27,7 @@ recorder:
Configuration variables:
- **purge_days** (*Optional*): Delete events and states older than x days.
- **purge_days** (*Optional*): Delete events and states older than x days. The purge task runs every 2 days, starting from when Home Assistant is started if you restart your instance more frequently than the purge will never take place.
- **exclude** (*Optional*): Configure which components should be excluded from recordings.
- **entities** (*Optional*): The list of entity ids to be excluded from recordings.
- **domains** (*Optional*): The list of domains to be excluded from recordings.

View file

@ -29,9 +29,9 @@ sensor:
Configuration variables:
- **indoor_temp_sensor** (*Required*): The enditiy ID of the indoor temperature sensor.
- **indoor_humidity_sensor** (*Required*): The enditiy ID of the indoor humidity sensor.
- **outdoor_temp_sensor** (*Required*): The enditiy ID of the outdoor temperature sensor.
- **indoor_temp_sensor** (*Required*): The entitiy ID of the indoor temperature sensor.
- **indoor_humidity_sensor** (*Required*): The entitiy ID of the indoor humidity sensor.
- **outdoor_temp_sensor** (*Required*): The entitiy ID of the outdoor temperature sensor.
- **calibration_factor** (*Required*): Needs to be calibrated to the critical point in the room.
In this case, the weather forecast temperature sensor is used for the outside temperature.

View file

@ -25,5 +25,9 @@ All information about how the seasons work was taken from Wikipedia:
# Example configuration.yaml entry
sensor:
- platform: season
type: astronomical (optional, will default to astronomical)
type: astronomical
```
Configuration variables:
- **type** (*Optional*): Type of season definition. Options are `meteorological` or `astronomical`. Default is `astronomical`.

View file

@ -90,6 +90,25 @@ sensor:
- upload
```
### {% linkable_title Using as a trigger in an automation %}
```yaml
# Example configuration.yaml entry
automation:
- alias: 'Internet Speed Glow Connect Great'
trigger:
platform: template
value_template: '{% raw %}{{ states.sensor.speedtest_download.state|float > 10}}{% endraw %}'
action:
service: shell_command.green
- alias: 'Internet Speed Glow Connect Poor'
trigger:
platform: template
value_template: '{% raw %}{{ states.sensor.speedtest_download.state| float < 10 }}{% endraw %}'
action:
service: shell_command.red
```
## {% linkable_title Notes %}
- When running on Raspberry Pi, just note that the maximum speed is limited by its 100 Mbit/s LAN adapter.

View file

@ -37,7 +37,7 @@ Configuration variables:
- **unit_of_measurement** (*Optional*): Defines the units of measurement of the sensor, if any.
- **value_template** (*Required*): Defines a [template](/docs/configuration/templating/#processing-incoming-data) to extract a value from the event bus.
- **icon_template** (*Optional*): Defines a [template](/topics/templating/) for the icon of the sensor.
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update it's state.
- **entity_id** (*Optional*): Add a list of entity IDs so the sensor only reacts to state changes of these entities. This will reduce the number of times the sensor will try to update its state.
## {% linkable_title Examples %}

View file

@ -27,7 +27,7 @@ The requirement is that you have setup [Wink](/components/wink/).
- Wink eggminder (No Wink hub required)
- Nest protect Smoke and CO severity (No confirmation that this is actually reported) (No Wink hub required)
- Motion sensor temperature
- Quirky refuel propane tank monitor
- Quirky refuel propane tank monitor (No Wink hub required)
<p class='note'>
The above devices are confimed to work, but others may work as well.

View file

@ -42,7 +42,7 @@ Configuration variables:
- **parse_mode** (*Optional*): Default parser for messages if not explicit in message data: 'html' or 'markdown'. Default is 'markdown'.
- **proxy_url** (*Optional*): Proxy url if working behind one (`socks5://proxy_ip:proxy_port`)
- **proxy_params** (*Optional*): Proxy configuration parameters, as dict, if working behind a proxy (`username`, `password`, etc.)
- **url** (*Optional*): Allow to overwrite the `base_url` from http component for diferent configs.
- **url** (*Optional*): Allow to overwrite the `base_url` from the [`http`](/components/http/) component for different configurations (`https://<public_url>:<port>`).
To get your `chat_id` and `api_key` follow the instructions [here](/components/notify.telegram). As well as authorising the chat, if you have added your bot to a group you will also need to authorise any user that will be interacting with the webhook. When an unauthorised user tries to interact with the webhook Home Assistant will raise an error ("Incoming message is not allowed"), you can easily obtain the the users id by looking in the "from" section of this error message.

View file

@ -17,7 +17,7 @@ The `xiaomi` vacuum platform allows you to control the state of your [Xiaomi Mi
Current supported features are `turn_on`, `pause`, `stop`, `return_to_home`, `turn_off` (stops goes to dock), `locate`, `clean_spot`, `set_fanspeed` and even remote control your robot.
Please follow the instructions on [Retrieving the Access Token](/components/xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
Please follow the instructions on [Retrieving the Access Token](/components/vacuum.xiaomi/#retrieving-the-access-token) to get the API token to use in the `configuration.yaml` file.
To add a vacuum to your installation, add the following to your `configuration.yaml` file:
@ -79,3 +79,63 @@ Use this call to enter the remote control mode, make one move, and stop and exit
| `velocity` | no | Speed, between -0.29 and 0.29. |
| `rotation` | no | Rotation, between -179 degrees and 179 degrees. |
| `duration` | no | Parameter affecting the duration of the movement. |
### {% linkable_title Retrieving the Access Token %}
<p class='note'>
This token (32 hexadecimal characters) is required for the Xiaomi Mi Robot Vacuum and Xiaomi Philips Light. The Xiaomi Gateway uses another security method and requires a `key` (16 alphanumeric chars) which can be obtained easily via a hidden menu item at the Mi-Home app.
</p>
Follow the pairing process using your phone and Mi-Home app. You will be able to retrieve the token from a SQLite file inside your phone.
Before you begin you need to install `libffi-dev` and `libssl-dev` by running the command below. This is needed for `python-mirobo` to be installed correctly.
```bash
$ sudo apt-get install libffi-dev libssl-dev
```
If your Home Assistant installation is running in a [Virtualenv](/docs/installation/virtualenv/#upgrading-home-assistant), make sure you activate it by running the commands below.
```bash
$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate
```
To fetch the token follow these instructions depending on your mobile phone platform.
#### {% linkable_title Windows and Android %}
1. Configure the robot with the Mi-Home app.
2. Enable developer mode and USB debugging on the Android phone and plug it into the computer.
3. Get and install the [ADB tool for Windows](https://developer.android.com/studio/releases/platform-tools.html).
4. Create a backup of the application `com.xiaomi.smarthome`:
```bash
$ adb backup -noapk com.xiaomi.smarthome -f backup.ab
```
5. If you have this message: "More than one device or emulator", use this command to list all devices:
```bash
$ adb devices
```
and execute this command:
```bash
$ adb -s DEVICEID backup -noapk com.xiaomi.smarthome -f backup.ab # (with DEVICEID the device id from the previous command)
```
6. On the phone, you must confirm the backup. DO NOT enter any password and press button to make the backup.
7. Get and install [ADB Backup Extractor](https://sourceforge.net/projects/adbextractor/).
8. Extract All files from the backup:
```bash
$ java.exe -jar ../android-backup-extractor/abe.jar unpack backup.ab backup.tar ""
```
9. Unzip the ".tar" file.
10. Open the SQLite database `miio2.db` with a tool like SQLite Manager extension for FireFox.
11. Get the token from "devicerecord" table.
#### {% linkable_title Linux and Android (rooted!) %}
1. Configure the light with the Mi-Home app.
2. Enable developer mode, USB debugging and root permission only for ADB on the Android phone and plug it into the computer.
3. Get ADB f.e. `apt-get install android-tools-adb`
4. `adb devices` should list your device
5. `adb root` (does work for development builds only: ones with `ro.debuggable=1`)
6. `adb shell`
7. `echo "select name,localIP,token from devicerecord;" | sqlite3 /data/data/com.xiaomi.smarthome/databases/miio2.db` returns a list of all registered devices including IP address and token.

View file

@ -46,8 +46,6 @@ What's not available?
Follow the setup process using your phone and Mi-Home app. From here you will be able to retrieve the key from within the app following [this tutorial](https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/1832)
Please check the instructions in this [section](/xiaomi/#retrieving-the-access-token) to get the API token to use with your platforms.
To enable Xiaomi gateway in your installation, add the following to your `configuration.yaml` file:
### {% linkable_title One Gateway %}
@ -140,72 +138,8 @@ Automation example
That means that Home Assistant is not getting any response from your Xiaomi gateway. Might be a local network problem or your firewall.
- Make sure you have enabled LAN access: https://community.home-assistant.io/t/beta-xiaomi-gateway-integration/8213/1832
- Turn off the firewall on the system where Home Assistant is running
- Turn off the firewall on the system where Home Assistant is running.
- Try to leave the MAC address `mac:` blank.
- Try to set `discovery_retry: 10`
- Try to disable and then enable LAN access
### {% linkable_title Retrieving the Access Token %}
Follow the pairing process using your phone and Mi-Home app. You will be able to retrieve the token from a SQLite file inside your phone. This token is needed for using various `xiaomi_*` platforms.
Before you begin you need to install `libffi-dev` by running the command below. This is needed for `python-mirobi` to be installed correctly.
```bash
$ sudo apt-get install libffi-dev
```
If your Home Assistant installation is running in a [Virtualenv](/docs/installation/virtualenv/#upgrading-home-assistant), make sure you activate it by running the commands below.
```bash
$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate
```
To fetch the token follow these instructions depending on your mobile phone platform.
#### {% linkable_title Windows and Android %}
1. Configure the robot with the Mi-Home app.
2. Enable developer mode and USB debugging on the Android phone and plug it into the computer.
3. Get and install the [ADB tool for Windows](https://developer.android.com/studio/releases/platform-tools.html).
4. Create a backup of the application `com.xiaomi.smarthome`:
```bash
$ adb backup -noapk com.xiaomi.smarthome -f backup.ab
```
5. If you have this message: "More than one device or emulator", use this command to list all devices:
```bash
$ adb devices
```
and execute this command:
```bash
$ adb -s DEVICEID backup -noapk com.xiaomi.smarthome -f backup.ab # (with DEVICEID the device id from the previous command)
```
6. On the phone, you must confirm the backup. DO NOT enter any password and press button to make the backup.
7. Get and install [ADB Backup Extractor](https://sourceforge.net/projects/adbextractor/).
8. Extract All files from the backup:
```bash
$ java.exe -jar ../android-backup-extractor/abe.jar unpack backup.ab backup.tar ""
```
9. Unzip the ".tar" file.
10. Open the SQLite database `miio2.db` with a tool like SQLite Manager extension for FireFox.
11. Get the token from "devicerecord" table.
#### {% linkable_title Linux and Android (rooted!) %}
1. Configure the light with the Mi-Home app.
2. Enable developer mode, USB debugging and root permission only for ADB on the Android phone and plug it into the computer.
3. Get ADB f.e. `apt-get install android-tools-adb`
4. `adb devices` should list your device
5. `adb root` (does work for development builds only: ones with `ro.debuggable=1`)
6. `adb shell`
7. `echo "select name,localIP,token from devicerecord;" | sqlite3 /data/data/com.xiaomi.smarthome/databases/miio2.db` returns a list of all registered devices including IP address and token.
#### {% linkable_title macOS and iOS %}
1. Setup iOS device with the Mi-Home app.
2. Create an unencrypted backup of the device using iTunes.
3. Install [iBackup Viewer](http://www.imactools.com/iphonebackupviewer/).
4. Extract this file: **`/raw data/com.xiami.mihome/1234567_mihome.sqlite`** to your computer, where `_1234567_` is any string of numbers.
5. Open the SQLite database with a tool like SQLite Manager extension for FireFox or DB Browser. You will then see the list of all the devices in your account with their token. The token you need is in the column **`ZToken`** and looks like **`123a1234567b12345c1d123456789e12`**.
(Location of SQLite files directly on iOS devices **/private/var/mobile/Containers/Data/Application/A80CE9E4-AD2E-4649-8C28-801C96B16BD7/Documents/**)
- Try to set `discovery_retry: 10`.
- Try to disable and then enable LAN access.
- Hard reset the gateway: Press the button of the gateway 30 seconds and start again from scratch.