New Details category (#1347)

* Place details in the new category

* Update title
This commit is contained in:
Fabian Affolter 2016-10-28 08:19:07 +02:00 committed by GitHub
parent 85eb61de87
commit 83d5638d29
6 changed files with 27 additions and 6 deletions

View file

@ -0,0 +1,125 @@
---
layout: page
title: "Database"
description: "Details about the database which Home Assistant is using."
date: 2016-10-10 10:00
sidebar: false
comments: false
sharing: true
footer: true
---
The default database that is used for Home Assistant is [SQLite](https://www.sqlite.org/) and is stored in your [configuration directory](/getting-started/configuration/), eg. `<path to config dir>/.homeassistant/home-assistant_v2.db`. You will need an installation of `sqlite3`, the command-line for SQLite database, or [DB Browser for SQLite](http://sqlitebrowser.org/) which provide an editor for executing SQL commands.
First load your database with `sqlite3`.
```bash
$ sqlite3 home-assistant_v2.db
SQLite version 3.13.0 2016-05-18 10:57:30
Enter ".help" for usage hints.
sqlite>
```
It helps to set some options to make the output better readable.
```bash
sqlite> .header on
sqlite> .mode column
```
You could also start `sqlite3` and attach the database later. Not sure what database you are working with? Check it, especially if you are going to delete data.
```bash
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /home/fab/.homeassistant/home-assistant_v2.db
```
### {% linkable_title Schema %}
Get all available tables from your current Home Assistant database.
```bash
sqlite> SELECT sql FROM sqlite_master;
-------------------------------------------------------------------------------------
CREATE TABLE events (
event_id INTEGER NOT NULL,
event_type VARCHAR(32),
event_data TEXT,
origin VARCHAR(32),
time_fired DATETIME,
created DATETIME,
PRIMARY KEY (event_id)
)
CREATE INDEX ix_events_event_type ON events (event_type)
CREATE TABLE recorder_runs (
run_id INTEGER NOT NULL,
start DATETIME,
"end" DATETIME,
closed_incorrect BOOLEAN,
created DATETIME,
PRIMARY KEY (run_id),
CHECK (closed_incorrect IN (0, 1))
)
CREATE TABLE states (
state_id INTEGER NOT NULL,
domain VARCHAR(64),
entity_id VARCHAR(64),
state VARCHAR(255),
attributes TEXT,
event_id INTEGER,
last_changed DATETIME,
last_updated DATETIME,
created DATETIME,
PRIMARY KEY (state_id),
FOREIGN KEY(event_id) REFERENCES events (event_id)
)
CREATE INDEX states__significant_changes ON states (domain, last_updated, entity_id)
CREATE INDEX states__state_changes ON states (last_changed, last_updated, entity_id)
CREATE TABLE sqlite_stat1(tbl,idx,stat)
```
To only show the details about the `states` table as we are using that one in the next examples.
```bash
sqlite> SELECT sql FROM sqlite_master WHERE type = 'table' AND tbl_name = 'states';
```
### {% linkable_title Query %}
The identification of the available columns in the table is done and we are now able to create a query. Let's list of your Top 10 entities.
```bash
sqlite> .width 30, 10,
sqlite> SELECT entity_id, COUNT(*) as count FROM states GROUP BY entity_id ORDER BY count DESC LIMIT 10;
entity_id count
------------------------------ ----------
sensor.cpu 28874
sun.sun 21238
sensor.time 18415
sensor.new_york 18393
cover.kitchen_cover 17811
switch.mystrom_switch 14101
sensor.internet_time 12963
sensor.solar_angle1 11397
sensor.solar_angle 10440
group.all_switches 8018
```
### {% linkable_title Delete %}
If you don't want to keep certain entities, you can delete them permanently.
```bash
sqlite> DELETE FROM states WHERE entity_id="sensor.cpu";
```
The `VACUUM` command cleans the your database.
```bash
sqlite> VACUUM;
```
For a more interactive way to work with the database or the create statistics, checkout our [Jupyther notebooks](http://nbviewer.jupyter.org/github/home-assistant/home-assistant-notebooks/blob/master/).

View file

@ -0,0 +1,51 @@
---
layout: page
title: "Updater"
description: "Details what the updater component is reporting about your Home Assistant instance."
date: 2016-10-22 08:00
sidebar: false
comments: false
sharing: true
footer: true
---
Starting with 0.31 the [updater component](/components/updater/) sends an optional report about Home Assistant instance.
We are only collecting this information to better understand our user base to provide better long term support and feature development.
| Name | Description | Example | Data Source |
|-----------------------|--------------------------------------------|------------------------------------|----------------|
| `arch` | CPU Architecture | `x86_64` | Local Instance |
| `distribution` | Linux Distribution name (only Linux) | `Ubuntu` | Local Instance |
| `docker` | True if running inside Docker | `false` | Local Instance |
| `first_seen_datetime` | First time instance ID was submitted | `2016-10-22T19:56:03.542Z` | Update Server |
| `geo_city` | GeoIP determined city | `Oakland` | Update Server |
| `geo_country_code` | GeoIP determined country code | `US` | Update Server |
| `geo_country_name` | GeoIP determined country name | `United States` | Update Server |
| `geo_latitude` | GeoIP determined latitude | `37.8047` | Update Server |
| `geo_longitude` | GeoIP determined longitude | `-122.2124` | Update Server |
| `geo_metro_code` | GeoIP determined metro code | `807` | Update Server |
| `geo_region_code` | GeoIP determined region code | `CA` | Update Server |
| `geo_region_name` | GeoIP determined region name | `California` | Update Server |
| `geo_time_zone` | GeoIP determined time zone | `America/Los_Angeles` | Update Server |
| `geo_zip_code` | GeoIP determined zip code | `94602` | Update Server |
| `last_seen_datetime` | Most recent time instance ID was submitted | `2016-10-22T19:56:03.542Z` | Update Server |
| `os_name` | Operating system name | `Darwin` | Local Instance |
| `os_version` | Operating system version | `10.12` | Local Instance |
| `python_version` | Python version | `3.5.2` | Local Instance |
| `timezone` | Timezone | `America/Los_Angeles` | Local Instance |
| `user_agent` | User agent used to submit analytics | `python-requests/2.11.1` | Local Instance |
| `uuid` | Unique identifier | `10321ee6094d4a2ebb5ed55c675d5f5e` | Local Instance |
| `version` | Home Assistant version | `0.31.0` | Local Instance |
| `virtualenv` | True if running inside virtualenv | `true` | Local Instance |
In addition to the above collected data, the server will also use your IP address to do a geographic IP address lookup to determine a general geographic area that your address is located in. To be extremely, extremely clear about this bit: __The Home Assistant updater does not: store your IP address in a database and also does not submit the location information from your `configuration.yaml`.__
Our tests showed that at best, we get 4 digits of accuracy on your IP address location which is a 5 mile radius of your actual IP location, assuming that it is even correct in the first place (geo IP lookups are very hit or miss).
The server also adds two timestamps to the data:
- the original date your instance UUID was first seen
- the timestamp of the last time we have seen your instance
There are currently no plans to publicly expose any of this information. If we did do such a thing in the future we would of course notify you in advance. It must also be stated that we will never sell or allow the use of this information for non-Home Assistant purposes.

View file

@ -0,0 +1,38 @@
---
layout: page
title: "Web server"
description: "Use nmap to scan your Home Assistant instance."
date: 2016-10-06 08:00
sidebar: false
comments: false
sharing: true
footer: true
---
It was only a matter of time till the first queries for tools like [https://www.shodan.io](https://www.shodan.io/search?query=Home+Assistant) to search for Home Assistant instances showed up.
To get an idea about how your Home Assistant instance looks like for network scanner, you can use `nmap`. The `nmap` tool is already available if you are using the [nmap device tracker](/components/device_tracker/).
```yaml
$ nmap -sV -p 8123 --script=http-title,http-headers 192.168.1.3
Starting Nmap 7.12 ( https://nmap.org ) at 2016-10-06 10:01 CEST
Nmap scan report for 192.168.1.3 (192.168.1.3)
Host is up (0.00011s latency).
PORT STATE SERVICE VERSION
8123/tcp open http CherryPy wsgiserver
| http-headers:
| Content-Type: text/html; charset=utf-8
| Content-Length: 4309
| Connection: close
| Date: Thu, 06 Oct 2016 08:01:31 GMT
| Server: Home Assistant
|
|_ (Request type: GET)
|_http-server-header: Home Assistant
|_http-title: Home Assistant
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 6.70 seconds
```