Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Auto discovery #1320

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions docs/Auto-Discovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
description: Device auto discovery

# Auto discovery
Tasmota auto discovery is meant to replace deprecated [Home Assistant discovery]([Home-Assistant.md](Home-Assistant.md#legacy-discovery-format)) (`SetOption19`) by a custom discovery format better suited for Tasmota.

> Home Assistant's MQTT discovery protocol includes a lot of redundant information which increases Tasmota's code size, and has some crucial limitations e.g. RGBxx lights flickering when turning on from HA.
> Also, Home Assistant's MQTT discovery protocol is not easy to add new features or make breaking changes to. (https:/arendst/Tasmota/issues/9267)

## Availability
* Starting `v9.3.1.2` Tasmota ships with its format as an alternative to Home Assistant discovery.
* Since `v11.1.0.2` Home Assistant discovery is considered deprecated.

## Discovery message format
Topic: `tasmota/discovery/49A3BC`

Payload:
```
{
"btn":[0,0,0,0], // Buttons, 0: disabled: 1: enabled
"dn":"Living Room", // Device name
"ip":"192.168.15.10", // IP address
"fn":["Ceiling Lamp", "Floor Lamp"], // List of friendly names
"ft":"%prefix%/%topic%/", // Fulltopic
"hn":"tasmota_49A3BC-0956", // Hostname
"mac":"49A3BC873A78", // MAC address
"md":"Sonoff Dual", // Module
"ofln":"Offline", // D_OFFLINE
"onln":"Online", // D_ONLINE
"rl":[0,0,0,0,0,0,0,0], // Relays, 0: disabled, 1: relay, 2.. future extension (fan, shutter?)
"so":{"13":0,"17":1,"30":0,"37":1,"68":0,"73":1}, // SetOption needed by HA to map Tasmota devices to HA entities and triggers
"state":["OFF","ON","TOGGLE","HOLD"], // StateText[0..3]
"sw":"13.3.0" // Tasmota SW build version
"swc":[0,0,0,0,0,0,0,0], // Switches, 0: disabled: 1: enabled
"t":"tasmota_49A3BC", // Topic
"tp":["cmnd","stat","tele"], // [SUB_PREFIX, PUB_PREFIX, PUB_PREFIX2]
"lt_st":0, // Light subtype
"ver":1 // Discovery protocol version, must be 1
}
```
7 changes: 6 additions & 1 deletion docs/Home-Assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ Tasmota communicates with Home Assistant using MQTT. Before going any further, m
Home Assistant can add Tasmota devices using:

1. Official Tasmota integration - **preferred** and automatic instant discovery of entities
2. Manual configuration by editing configuration.yaml - recommended for marginal use cases, e.g., TuyaMCU fan devices
2. Legacy Home Assistant discovery format **deprecated**
3. Manual configuration by editing configuration.yaml - recommended for marginal use cases, e.g., TuyaMCU fan devices

## Tasmota Integration

[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=Tasmota)

## Legacy discovery format

!!! failure "`SetOption19` is deprecated in favor of [Tasmota discovery format](Auto-Discovery.md). The new format is also used by the Home Assistant integration."

Once you configure the [Home Assistant](https://www.home-assistant.io/integrations/tasmota/) integration every new Tasmota device with `SetOption19 0` set will be discovered automatically.

All Tasmota devices will be listed in their own Tasmota card in **Configuration - Integrations** menu in Home Assistant.
Expand Down