[thethingsnetwork] Upgrade to TheThingsNetwork v3 (#32953)

* update documentation to v3

* Use step numbers in procedure

* Apply suggestions from code review

* fix typos

* Update source/_integrations/thethingsnetwork.markdown

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update source/_integrations/thethingsnetwork.markdown

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update source/_integrations/thethingsnetwork.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Update source/_integrations/thethingsnetwork.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* Numbering of prerequisites

* Update source/_integrations/thethingsnetwork.markdown

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>

* adjust numbering

* fix tabs

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Angel Nunez Mencias 2024-05-29 08:39:21 +02:00 committed by GitHub
parent 42b9c47b5b
commit 5e849a610f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 25 additions and 110 deletions

View File

@ -5,142 +5,57 @@ ha_category:
- Hub - Hub
- Sensor - Sensor
ha_release: 0.55 ha_release: 0.55
ha_iot_class: Local Push ha_iot_class: Cloud Polling
ha_codeowners: ha_codeowners:
- '@fabaff' - '@angelnu'
ha_domain: thethingsnetwork ha_domain: thethingsnetwork
ha_platforms: ha_platforms:
- sensor - sensor
ha_integration_type: integration ha_integration_type: integration
--- ---
<div class='note warning'> The `thethingsnetwork` {% term integration%} allows you to interact with the [The Things Network](https://www.thethingsnetwork.org) from within Home Assistant. This community-driven and open network supports [LoRaWAN](https://www.lora-alliance.org/) for long-range (~5 to 15 km) communication with low bandwidth (51 bytes/message). [Gateways](https://www.thethingsnetwork.org/docs/gateways/) transfer the received data from the sensors to The Things Network.
This integration only supports TTNv2 that has been definitively switched off in 2022 (deprecated). The Things Network supports various integrations to make the data available:
For TTNv3, use the [MQTT integration](/integrations/mqtt).
</div>
The `thethingsnetwork` integration allows one to interact with the [The Things Network](https://www.thethingsnetwork.org). This community-driven and open network supports [LoRaWAN](https://www.lora-alliance.org/) for long range (~5 to 15 km) communication with a low bandwidth (51 bytes/message). [Gateways](https://www.thethingsnetwork.org/docs/gateways/) transfers the received data from the sensors to the The Things Network.
The Things network support various integrations to make the data available:
| The Things Network Integration | Home Assistant platform | | The Things Network Integration | Home Assistant platform |
|---|---| |---|---|
| [MQTT](https://www.thethingsnetwork.org/docs/applications/mqtt/) | | | [MQTT](https://www.thethingsindustries.com/docs/integrations/mqtt) | [`MQTT`](integrations/mqtt) |
| [Storage](https://www.thethingsnetwork.org/docs/applications/storage/) | [`thethingsnetwork`](#sensor) | | [Storage](https://www.thethingsindustries.com/docs/integrations/storage) | [`thethingsnetwork`](#setup) |
| [HTTP](https://www.thethingsnetwork.org/docs/applications/http/) | | | [HTTP](https://www.thethingsindustries.com/docs/integrations/webhooks) | |
There is currently support for the following device types within Home Assistant: There is currently support for the following device types within Home Assistant:
- [Prerequisites](#prerequisites)
- [Sensor](#sensor) - [Sensor](#sensor)
## Setup
Visit the [The Things Network Console](https://console.thethingsnetwork.org/) website, log in with your The Things Network credentials, choose your application from **Applications**. ## Prerequisites
The **Application ID** is used to identify the scope of your data.
<p class='img'> 1. Visit the [The Things Network Console](https://console.thethingsnetwork.org/) website, log in with your The Things Network credentials, choose your application from **Applications**.
<img src='/images/integrations/thethingsnetwork/applications.png' /> - The **Application ID** is used to identify the scope of your data.
Application overview
</p>
You need an access key to be able to read the data from your application. ![Application overview](/images/integrations/thethingsnetwork/applications.png)
<p class='img'> 2. Under the integrations menu, enable the storage integration:
<img src='/images/integrations/thethingsnetwork/access_key.png' />
Access keys
</p>
## Configuration ![Storage Integration](/images/integrations/thethingsnetwork/storage_integration.png)
To enable this integration, add the following lines to your {% term "`configuration.yaml`" %}: 3. Ensure you have an [Uplink Payload Formatter](https://www.thethingsindustries.com/docs/integrations/payload-formatters/) for your device.
```yaml ![Payload Formatters](/images/integrations/thethingsnetwork/payload_formatters.png)
# Example configuration.yaml entry
thethingsnetwork: 4. You need an API key to be able to read the data from your application.
app_id: sensor-123 - The minimum required rights are `Read Application Traffic (uplink and downlink)`.
access_key: ttn-account-v2.xxxxxxxxxxx_yyyyyyyyyyy
``` ![API keys](/images/integrations/thethingsnetwork/apis_key.png)
{% include integrations/config_flow.md %}
{% configuration %}
app_id:
description: The Application ID.
required: true
type: string
access_key:
description: The access key.
required: true
type: string
{% endconfiguration %}
## Sensor ## Sensor
The `thethingsnetwork` sensor platform allows you to get data from a [The Things Network Storage Integration](https://www.thethingsnetwork.org/docs/applications/storage/). All uplink messages decoded by The Things Network (including a `decoded_payload` entry) will be processes by this integration. Each field in `decoded_payload` will be added as a Home Assistant sensor entity.
This platform requires that the [The Things Network integration](#configuration) is set up and the [The Things Network Storage Integration](https://www.thethingsnetwork.org/docs/applications/storage/) as well.
### Prerequisites
Visit the [The Things Network Console](https://console.thethingsnetwork.org/) website, log in with your The Things Network credentials, choose your application from **Applications** and go to **Integrations**.
Add a new integration.
<p class='img'>
<img src='/images/integrations/thethingsnetwork/add_integration.png' />
Add a The Things Network integration
</p>
Select **Data Storage**.
<p class='img'>
<img src='/images/integrations/thethingsnetwork/choose_integration.png' />
Choose a The Things Network integration
</p>
Click **Add integration** to finish the process.
<p class='img'>
<img src='/images/integrations/thethingsnetwork/confirm_integration.png' />
Add a The Things Network Data Storage integration
</p>
When done, the status of the integration should be **Running**. You could check the output after clicking on **go to platform** in an interactive web interface.
<p class='img'>
<img src='/images/integrations/thethingsnetwork/storage_integration.png' />
Add a The Things Network integration
</p>
Select **Devices** to get the ID of your device that you want to use.
<p class='img'>
<img src='/images/integrations/thethingsnetwork/devices.png' />
Devices overview
</p>
### Configuration
To enable this platform, add the following lines to your {% term "`configuration.yaml`" %}:
```yaml
# Example configuration.yaml entry
sensor:
- platform: thethingsnetwork
device_id: ha-demo
values:
current: ampere
voltage: V
```
{% configuration %}
device_id:
description: The ID of the device.
required: true
type: string
values:
description: The sensor values with their unit of measurement
required: true
type: list
{% endconfiguration %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 135 KiB