mirror of https://github.com/arendst/Tasmota.git
Updated Home Assistant (markdown)
parent
24c167a461
commit
4d0050c343
|
@ -1,11 +1,9 @@
|
||||||
[Home Assistant](https://home-assistant.io/) (Hass) is an open-source home automation platform running on Python 3.
|
[Home Assistant](https://home-assistant.io/) (Hass) is an open-source home automation platform running on Python 3.
|
||||||
|
|
||||||
**Important:** The information on this page is related to:
|
**Important:** The information on this page is related to:
|
||||||
- Tasmota release 6.4.1
|
- Tasmota release 6.4.1 or later
|
||||||
- Home Assistant 0.84.2 or later
|
- Home Assistant 0.84.2 or later
|
||||||
|
|
||||||
Binary tasmota-basic.bin (which comes packaged with Tuya Convert) does not support autodiscovery. Please upgrade to tasmota.bin or similar release that supports this feature.
|
|
||||||
|
|
||||||
## Hass configuration - General
|
## Hass configuration - General
|
||||||
This page describes configuring Hass and Tasmota for MQTT device discovery.
|
This page describes configuring Hass and Tasmota for MQTT device discovery.
|
||||||
|
|
||||||
|
@ -13,7 +11,7 @@ If you don't want to use this option, please refer to:
|
||||||
- [[Home Assistant - Manual Config|Home-Assistant-‐-Manual-Config]] - For Home Assistant 0.84.2 or later together with Tasmota developement version built 2018-12-13 or later
|
- [[Home Assistant - Manual Config|Home-Assistant-‐-Manual-Config]] - For Home Assistant 0.84.2 or later together with Tasmota developement version built 2018-12-13 or later
|
||||||
- [[Home Assistant - Manual Config (Legacy)|Home-Assistant-‐-Manual-Config-(Legacy)]] - For older versions of Home Assistant or Tasmota
|
- [[Home Assistant - Manual Config (Legacy)|Home-Assistant-‐-Manual-Config-(Legacy)]] - For older versions of Home Assistant or Tasmota
|
||||||
|
|
||||||
Hass configuration is not exposed in the web UI. It is done by editing the `configuration.yaml` file which is found in folder `.homeassistant` after installing and first starting of Hass (or in the `/config` folder, if you’re using Hass.io).
|
Hass configuration is not exposed in the web UI. It is done by editing the `configuration.yaml` file which is found in the `.homeassistant` folder after installing and the first startup of Hass (or in the `/config` folder, if you’re using Hass.io).
|
||||||
|
|
||||||
Note: After every change to the configuration file you'll need to restart Hass to make it aware of the changes.
|
Note: After every change to the configuration file you'll need to restart Hass to make it aware of the changes.
|
||||||
This can be done either:
|
This can be done either:
|
||||||
|
@ -43,11 +41,12 @@ mqtt:
|
||||||
```
|
```
|
||||||
|
|
||||||
Default username for the embedded broker is `homeassistant` while port defaults to `1883`.
|
Default username for the embedded broker is `homeassistant` while port defaults to `1883`.
|
||||||
|
|
||||||
#### :warning: Warning:
|
#### :warning: Warning:
|
||||||
As of release 0.92, the embedded broker has been marked as deprecated. This means bugs may not be fixed, and the functionality may be removed in a future release.
|
As of release 0.92, the embedded broker has been marked as deprecated. This means bugs may not be fixed, and the functionality may be removed in a future release.
|
||||||
|
|
||||||
## Add Tasmota devices to Home Assistant
|
## Add Tasmota devices to Home Assistant
|
||||||
To ease Home Assistant configuration a feature called [MQTT discovery](https://www.home-assistant.io/docs/mqtt/discovery/) is available. _(warning: this feature is not included in `tasmota-basic.bin` and `tasmota-classic.bin`)_\
|
To ease Home Assistant configuration, a feature called [MQTT discovery](https://www.home-assistant.io/docs/mqtt/discovery/) is available. _(warning: this feature is not included in `tasmota-classic.bin`)_\
|
||||||
With MQTT discovery, no user interaction or configuration file edit is needed to add new devices to Hass.
|
With MQTT discovery, no user interaction or configuration file edit is needed to add new devices to Hass.
|
||||||
|
|
||||||
Automatic discovery is currently supported for:
|
Automatic discovery is currently supported for:
|
||||||
|
@ -60,45 +59,45 @@ Automatic discovery is currently supported for:
|
||||||
- Button - Announced as Home Assistant `binary sensor`
|
- Button - Announced as Home Assistant `binary sensor`
|
||||||
- Switch - Announced as Home Assistant `binary sensor`
|
- Switch - Announced as Home Assistant `binary sensor`
|
||||||
|
|
||||||
Starting from release 6.7.1 to have `buttons` and `switches` discovered `switchtopic` or `buttontopic` must be set to default value `0` and they will listen to `%topic%/stat/RESULT` topic.
|
Starting from release 6.7.1, to have `buttons` and `switches` discovered `switchtopic` or `buttontopic` must be set to the default value of `0` and they will listen to `%topic%/stat/RESULT` topic.
|
||||||
```yaml
|
```lua
|
||||||
MQT: sonoff/stat/RESULT = {"BUTTON1":"TOGGLE"}
|
MQT: tasmota/stat/RESULT = {"BUTTON1":"TOGGLE"}
|
||||||
MQT: sonoff/stat/RESULT = {"POWER":"ON"}
|
MQT: tasmota/stat/RESULT = {"POWER":"ON"}
|
||||||
MQT: sonoff/stat/POWER = ON
|
MQT: tasmota/stat/POWER = ON
|
||||||
```
|
```
|
||||||
This option leave to the user the ability to get a more granular control over entities on both Tasmota or Hass.
|
This option leave to the user the ability to get a more granular control over entities on both Tasmota or Hass.
|
||||||
|
|
||||||
A simple Tasmota rule example:
|
A simple Tasmota rule example:
|
||||||
```yaml
|
```lua
|
||||||
Rule1 ON Button1#STATE DO Var1 %value% ENDON
|
Rule1 ON Button1#STATE DO Var1 %value% ENDON
|
||||||
```
|
```
|
||||||
With the rule enabled , when you press the button you will get
|
With the rule enabled , when you press the button you will get
|
||||||
```yaml
|
```lua
|
||||||
RUL: BUTTON1#STATE performs "var1 2"
|
RUL: BUTTON1#STATE performs "var1 2"
|
||||||
MQT: sonoff/stat/RESULT = {"Var1":"2"}
|
MQT: tasmota/stat/RESULT = {"Var1":"2"}
|
||||||
MQT: sonoff/stat/RESULT = {"BUTTON1":"TOGGLE"}
|
MQT: tasmota/stat/RESULT = {"BUTTON1":"TOGGLE"}
|
||||||
```
|
```
|
||||||
and the relay will NOT be switched.
|
and the relay will NOT be switched.
|
||||||
|
|
||||||
|
|
||||||
Tasmota `switchmode` default for buttons and switches is `Switchmode 0` (TOGGLE). This means all the entities created will automatically turn off after `one second`. To change the button behavior a [switchmode](https://github.com/arendst/Tasmota/wiki/Commands#switchmode) change is needed. For example setting up a switch to `switchmode 1` (follow) will create a switch with ON and OFF payloads.
|
Tasmota `switchmode` default for buttons and switches is `Switchmode 0` (TOGGLE). This means all the entities created will automatically turn off after `one second`. To change the button behavior a [switchmode](Commands#switchmode) change is needed. For example setting up a switch to `switchmode 1` (follow) will create a switch with ON and OFF payloads.
|
||||||
|
|
||||||
For other type of devices, e.g iFan02, example entries for configuration.yaml is available in [[Home Assistant - Manual Config|Home-Assistant-‐-Manual-Config]]
|
For other type of devices, e.g SOnoff iFan02, example entries for `configuration.yaml` are available in [[Home Assistant - Manual Config|Home-Assistant-‐-Manual-Config]]
|
||||||
|
|
||||||
On each Tasmota device which should be automatically discovered by Hass, enter the following commands in the web console:\
|
On each Tasmota device which should be automatically discovered by Hass, enter the following commands in the web console:\
|
||||||
`SetOption19 1` - Enables MQTT discovery\
|
`SetOption19 1` - Enables MQTT discovery\
|
||||||
|
|
||||||
By executing `SetOption19 1`, the automatic discovery feature is enabled and a retained MQTT message starting with topic "homeassistant/..", as defined in `my_user_config.h` HOME_ASSISTANT_DISCOVERY_PREFIX, is sent containing parameters used by Home Assistant to automatically configure a device.
|
By executing `SetOption19 1`, the automatic discovery feature is enabled and a retained MQTT message starting with topic "homeassistant/..", as defined in `my_user_config.h` HOME_ASSISTANT_DISCOVERY_PREFIX, is sent containing parameters used by Home Assistant to automatically configure a device.
|
||||||
|
|
||||||
To disable the automatic discovery feature and remove the retained message, execute `SetOption19 0` and the "homeassistant" topic is removed from Home Assistant and MQTT broker. The device topic will not revert to defaults. You have to manually change the topic structure back to `%prefix%/%topic%/` in [**MQTT Configuration**](MQTT).
|
To disable the automatic discovery feature and remove the retained message, execute `SetOption19 0` and the "homeassistant" topic is removed from Home Assistant and MQTT broker. **The device topic will not revert to defaults**. You have to manually change the fulltopic structure back to `%prefix%/%topic%/` in [**MQTT Configuration**](MQTT).
|
||||||
|
|
||||||
#### :warning: Important:
|
#### :warning: Important:
|
||||||
This feature will change the default Tasmota topic `%prefix%/%topic%/<command>`, e.g. `cmnd/tasmota/POWER` to `%topic%/%prefix%/<command>`, e.g., `sonoff/cmnd/POWER`.
|
This feature will change the default Tasmota fulltopic `%prefix%/%topic%/<command>`, e.g. `cmnd/tasmota/POWER` to `%topic%/%prefix%/<command>`, e.g., `tasmota/cmnd/POWER`.
|
||||||
You cannot use custom defined topics while `Setoption19` is on since it will always revert it to `%topic%/%prefix%` due to Home Assistant requirements.
|
You cannot use custom defined topics while `Setoption19` is on since it will always revert it to `%topic%/%prefix%` due to Home Assistant requirements.
|
||||||
|
|
||||||
## Setup Tasmota devices through Home Assistant
|
## Setup Tasmota devices through Home Assistant
|
||||||
All automatically discovered entities will show up under:\
|
All automatically discovered entities will show up under:
|
||||||
Configuration -> Integrations -> Configured -> MQTT\
|
Configuration -> Integrations -> Configured -> MQTT
|
||||||
The entities are grouped by hardware, example for a Sonoff Basic:
|
The entities are grouped by hardware, example for a Sonoff Basic:
|
||||||
|
|
||||||
![image](https://user-images.githubusercontent.com/7702766/67961116-082b2b80-fbda-11e9-8552-ce2bd85d2a3f.png)
|
![image](https://user-images.githubusercontent.com/7702766/67961116-082b2b80-fbda-11e9-8552-ce2bd85d2a3f.png)
|
||||||
|
@ -112,7 +111,7 @@ By clicking on one of the entities, and then on the cog wheel, name in Hass and
|
||||||
Note1: Lights currently show up under "Entities without devices", this will be fixed in Hass 0.85 [#19013](https://github.com/home-assistant/home-assistant/pull/19013)\
|
Note1: Lights currently show up under "Entities without devices", this will be fixed in Hass 0.85 [#19013](https://github.com/home-assistant/home-assistant/pull/19013)\
|
||||||
Note2: After changing `entity_id` Hass must be restarted, this will be fixed in Hass 0.85 [#19414](https://github.com/home-assistant/home-assistant/pull/19414)
|
Note2: After changing `entity_id` Hass must be restarted, this will be fixed in Hass 0.85 [#19414](https://github.com/home-assistant/home-assistant/pull/19414)
|
||||||
|
|
||||||
For every device discovered with `setoption19` an informative sensor will be created automatically:
|
For every device discovered with `SetOption19` an informative sensor will be created automatically:
|
||||||
|
|
||||||
![image](https://user-images.githubusercontent.com/7702766/67965278-88ed2600-fbe0-11e9-9de5-29ecd2c78fac.png)
|
![image](https://user-images.githubusercontent.com/7702766/67965278-88ed2600-fbe0-11e9-9de5-29ecd2c78fac.png)
|
||||||
|
|
||||||
|
@ -120,8 +119,7 @@ For every device discovered with `setoption19` an informative sensor will be cre
|
||||||
|
|
||||||
### Tip: Sync power state
|
### Tip: Sync power state
|
||||||
|
|
||||||
If the MQTT broker or Hass is restarted, or there is a WiFi outage, Tasmota device state may not be synced with Home Assistant.
|
If the MQTT broker or Hass is restarted, or there is a WiFi outage, Tasmota device state may not be synced with Home Assistant. Use this automation to get all your (auto discovered) devices in sync, including power state, **immediately** after Home Assistant is (re)started.
|
||||||
Use this automation to get all your (auto discovered) devices in sync, including power state, **immediately** after Home Assistant is (re)started.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example automations.yaml entry
|
# Example automations.yaml entry
|
||||||
|
@ -137,12 +135,12 @@ Use this automation to get all your (auto discovered) devices in sync, including
|
||||||
```
|
```
|
||||||
### Tip: Make all Tasmota devices be automatically discovered
|
### Tip: Make all Tasmota devices be automatically discovered
|
||||||
|
|
||||||
If you want all your devices to be found by Home Assistant, add an automation which will enable `SetOption19` for all devices.\
|
If you want all your devices to be found by Home Assistant, add an automation which will enable `SetOption19` for all devices.
|
||||||
The automation will be triggered each time Home Assistant is (re)started although it is necessary to run it only if you have a device that doesn't have `SetOption19` enabled. After all your devices are setup with autodiscovery its advisable to turn off or delete this automation.
|
The automation will be triggered each time Home Assistant is (re)started although it is necessary to run it only if you have a device that doesn't have `SetOption19` enabled. After all your devices are setup with autodiscovery, it is advisable to turn off or delete this automation.
|
||||||
|
|
||||||
Note: This must use the default Tasmota topic format `%prefix%/%topic%/<command>`. After enabling SetOption19, the format will change to `%topic%/%prefix%/<command>` and those devices won't see this message.
|
Note: This must use the default Tasmota topic format `%prefix%/%topic%/<command>`. After enabling `SetOption19`, the format will change to `%topic%/%prefix%/<command>` and those devices won't see this message.
|
||||||
|
|
||||||
This can also be done manually in Home Assistant UI through Developer tools - ![](https://cdn.pbrd.co/images/HY47i1b.jpg) (MQTT) by posting to topic `cmnd/tasmotas/SetOption19` with payload `1`
|
This can also be done manually in Home Assistant UI through Developer tools - ![](https://cdn.pbrd.co/images/HY47i1b.jpg) (MQTT) by publishing to grouptopic `cmnd/tasmotas/SetOption19` with payload `1`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# Example automations.yaml entry
|
# Example automations.yaml entry
|
||||||
|
@ -172,8 +170,6 @@ This can also be done manually in Home Assistant UI through Developer tools - ![
|
||||||
payload: "0"
|
payload: "0"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Tip: Make all Tasmota devices report their firmware version
|
### Tip: Make all Tasmota devices report their firmware version
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
Loading…
Reference in New Issue