Merge branch 'current' into next

This commit is contained in:
Paulus Schoutsen 2018-02-27 21:54:17 -08:00
commit 73fc2cebd2
12 changed files with 143 additions and 23 deletions

View file

@ -101,6 +101,8 @@ Typical values for switches, the event codes are 4 numbers where the first and l
Where for example on a Philips Hue Dimmer, 2001 would be holding the dim up button.
For the IKEA Tradfri remote, 1 is the middle button, 2 is up, 3 is down, 4 is left, and 5 is right.
## {% linkable_title Examples %}
### {% linkable_title Step up and step down input number with wireless dimmer %}

View file

@ -52,7 +52,7 @@ This is a fully customized JSON you can use to test how the final notification w
"duration":2,
"transparency":"0%",
"color": "red",
"interrupt": 1,
"interrupt": 1
}
}
```

View file

@ -156,13 +156,32 @@ If the `recorder` component is activated then some components support `restore_s
| PostgreSQL | `postgresql://scott:tiger@SERVER_IP/DB_NAME` |
| MS SQL Server | `mssql+pymssql://user:pass@SERVER_IP/DB_NAME?charset=utf8` |
+<p class='note'>
+If you are running a database server instance on the same server as Home Assistant then you must ensure that this service starts before Home Assistant. For a Linux instance running Systemd (Raspberry Pi, Debian, Ubuntu and others) then you should edit the file /etc/systemd/system/home-assistant@homeassistant.service as root (e.g. sudo nano /etc/systemd/system/home-assistant@homeassistant.service) and add the service - for PostgreSQL:
+```
+[Unit]
+Description=Home Assistant
+After=network.target postgresql.service
+```
+</p>
## {% linkable_title Installation notes %}
Not all Python bindings for the chosen database engine can be installed directly. This section contains additional details which should help you to get it working.
### {% linkable_title MariaDB and MySQL %}
For MariaDB you may have to install a few dependencies. On the Python side we use the `mysqlclient`:
If you are in a virtual environment, don't forget to activate it before installing the `mysqlclient` Python package described below.
```bash
pi@homeassistant:~ $ sudo su homeassistant -s /bin/bash
homeassistant@homeassistant:~$ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@homeassistant:~$ pip3 install mysqlclient
```
For MariaDB you may have to install a few dependencies. If you're using MariaDB version 10.2, libmariadbclient-dev was renamed to libmariadb-dev, please install the correct package based on your MariaDB version.
On the Python side we use the `mysqlclient`:
```bash
$ sudo apt-get install libmariadbclient-dev libssl-dev
@ -176,14 +195,6 @@ $ sudo apt-get install default-libmysqlclient-dev libssl-dev
$ pip3 install mysqlclient
```
If you are in a virtual environment, don't forget to activate it before installing the `mysqlclient` Python package.
```bash
pi@homeassistant:~ $ sudo su homeassistant -s /bin/bash
homeassistant@homeassistant:~$ source /srv/homeassistant/bin/activate
(homeassistant) homeassistant@homeassistant:~$ pip3 install mysqlclient
```
After installing the dependencies, it is required to create the database manually. During the startup, Home Assistant will look for the database specified in the `db_url`. If the database doesn't exist, it will not automatically create it for you.
Once Home Assistant finds the database, with right level of permissions, all the required tables will then be automatically created and the data will be populated accordingly.

View file

@ -29,7 +29,7 @@ Send a notification.
|---------------------------|----------|--------------------------------------------------|
| `message` | no | Message body of the notification. |
| `title` | yes | Optional title for your notification. Will be composed as '%title\n%message'. |
| `target` | yes | An array of pre-authorized chat_ids to send the notification to. Defaults to the first allowed chat_id. |
| `target` | yes | An array of pre-authorized chat_ids or user_ids to send the notification to. Defaults to the first allowed chat_id. |
| `parse_mode` | yes | Parser for the message text: `html` or `markdown`. |
| `disable_notification` | yes | True/false for send the message silently. iOS users and web users will not receive a notification, Android users will receive a notification with no sound. Defaults to False. |
| `disable_web_page_preview`| yes | True/false for disable link previews for links in the message. |
@ -47,7 +47,7 @@ Send a photo.
| `username` | yes | Username for a URL which require HTTP basic authentication. |
| `password` | yes | Password for a URL which require HTTP basic authentication. |
| `authentication` | yes | Define which authentication method to use. Set to `digest` to use HTTP digest authentication. Defaults to `basic`. |
| `target` | yes | An array of pre-authorized chat_ids to send the notification to. Defaults to the first allowed chat_id. |
| `target` | yes | An array of pre-authorized chat_ids or user_ids to send the notification to. Defaults to the first allowed chat_id. |
| `disable_notification` | yes | True/false for send the message silently. iOS users and web users will not receive a notification, Android users will receive a notification with no sound. Defaults to False. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
@ -64,7 +64,7 @@ Send a video.
| `username` | yes | Username for a URL which requires HTTP basic authentication. |
| `password` | yes | Password for a URL which requires HTTP basic authentication. |
| `authentication` | yes | Define which authentication method to use. Set to `digest` to use HTTP digest authentication. Defaults to `basic`. |
| `target` | yes | An array of pre-authorized chat_ids to send the notification to. Defaults to the first allowed chat_id. |
| `target` | yes | An array of pre-authorized chat_ids or user_ids to send the notification to. Defaults to the first allowed chat_id. |
| `disable_notification` | yes | True/false to send the message silently. iOS users and web users will not receive a notification. Android users will receive a notification with no sound. Defaults to False. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
@ -80,7 +80,7 @@ Send a document.
| `username` | yes | Username for a URL which require HTTP basic authentication. |
| `password` | yes | Password for a URL which require HTTP basic authentication. |
| `authentication` | yes | Define which authentication method to use. Set to `digest` to use HTTP digest authentication. Defaults to `basic`. |
| `target` | yes | An array of pre-authorized chat_ids to send the notification to. Defaults to the first allowed chat_id. |
| `target` | yes | An array of pre-authorized chat_ids or user_ids to send the notification to. Defaults to the first allowed chat_id. |
| `disable_notification` | yes | True/false for send the message silently. iOS users and web users will not receive a notification, Android users will receive a notification with no sound. Defaults to False. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
@ -92,7 +92,7 @@ Send a location.
|---------------------------|----------|--------------------------------------------------|
| `latitude` | no | The latitude to send. |
| `longitude` | no | The longitude to send. |
| `target` | yes | An array of pre-authorized chat_ids to send the notification to. Defaults to the first allowed chat_id. |
| `target` | yes | An array of pre-authorized chat_ids or user_ids to send the notification to. Defaults to the first allowed chat_id. |
| `disable_notification` | yes | True/false for send the message silently. iOS users and web users will not receive a notification, Android users will receive a notification with no sound. Defaults to False. |
| `keyboard` | yes | List of rows of commands, comma-separated, to make a custom keyboard. Example: `["/command1, /command2", "/command3"]` |
| `inline_keyboard` | yes | List of rows of commands, comma-separated, to make a custom inline keyboard with buttons with associated callback data. Example: `["/button1, /button2", "/button3"]` or `[[["Text btn1", "/button1"], ["Text btn2", "/button2"]], [["Text btn3", "/button3"]]]` |
@ -316,7 +316,7 @@ Message editor:
- service: telegram_bot.edit_message
data_template:
message_id: {% raw %}'{{ trigger.event.data.message.message_id }}'{% endraw %}
chat_id: {% raw %}'{{ trigger.event.data.user_id }}'{% endraw %}
chat_id: {% raw %}'{{ trigger.event.data.chat_id }}'{% endraw %}
title: '*Message edit*'
inline_keyboard:
- "Edit message:/edit_msg, Don't:/do_nothing"
@ -344,7 +344,7 @@ Keyboard editor:
- service: telegram_bot.edit_replymarkup
data_template:
message_id: 'last'
chat_id: {% raw %}'{{ trigger.event.data.user_id }}'{% endraw %}
chat_id: {% raw %}'{{ trigger.event.data.chat_id }}'{% endraw %}
inline_keyboard:
- "Edit message:/edit_msg, Don't:/do_nothing"
```
@ -400,7 +400,7 @@ class TelegramBotEventListener(appapi.AppDaemon):
assert event_id == 'telegram_callback'
data_callback = payload_event['data']
callback_id = payload_event['id']
user_id = payload_event['user_id']
chat_id = payload_event['chat_id']
# keyboard = ["Edit message:/edit_msg, Don't:/do_nothing",
# "Remove this button:/remove button"]
keyboard = [[("Edit message", "/edit_msg"),
@ -420,7 +420,7 @@ class TelegramBotEventListener(appapi.AppDaemon):
title = '*Message edit*'
msg = 'Callback received from %s. Message id: %s. Data: ``` %s ```'
self.call_service('telegram_bot/edit_message',
chat_id=user_id,
chat_id=chat_id,
message_id=msg_id,
title=title,
message=msg % (user, msg_id, data_callback),
@ -436,7 +436,7 @@ class TelegramBotEventListener(appapi.AppDaemon):
# Edit the keyboard
new_keyboard = keyboard[:1]
self.call_service('telegram_bot/edit_replymarkup',
chat_id=user_id,
chat_id=chat_id,
message_id='last',
inline_keyboard=new_keyboard)

View file

@ -45,4 +45,4 @@ Configuration variables:
- **mouse** (*Optional*): Set to 1 to show mouse detectors, 0 to disable. Default 1.
- **door_window** (*Optional*): Set to 1 to show door and window sensors, 0 to disable. Default 1.
- **code_digits** (*Optional*): Number of digits in PIN code. Default 4.
- **giid** (*Optional*): The GIID of your installation (If you have more then one alarm system).
- **giid** (*Optional*): The GIID of your installation (If you have more then one alarm system). To find the GIID for your systems run 'python verisure.py EMAIL PASSWORD installations'