meine
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
Home Assistant TP-Link Deco Custom Component
git clone https://github.com/amosyuen/ha-tplink-deco.gitamosyuen/ha-tplink-decoThis integration provides local polling control and diagnostics for TP-Link Deco systems within Home Assistant.
Two types of sensors are available:
Use raw for:
Use smoothed for:
Pause / resume polling:
tplink_deco.pause_pollingtplink_deco.resume_pollingSwitch entity:
switch.deco_pollingAdjustable polling interval:
Configurable:
tplink_deco.pause_pollingtplink_deco.resume_pollingtplink_deco.reboot_decoswitch.deco_pollingselect.polling_intervalcustom_components/tplink_deco to your Home Assistant config folderThis integration is a local polling integration that logs into the admin web UI for TP-Link Deco routers. Currently the only feature implemented is device trackers for active devices.
Device trackers are added for both decos and clients. The device tracker state marks whether the device is connected to the deco. If a device is not present, the previous values for attributes are saved except for down_kilobytes_per_s and up_kilobytes_per_s.
| Attribute | Example Values (comma separated) |
|---|---|
| mac | 1A-B2-C3-4D-56-EF |
| ip_address | 192.168.0.100 |
| device_type | client, deco |
| connection_type | wired, band5, band2_4 |
| Attribute | Example Values (comma separated) |
|---|---|
| interface | main, guest |
| down_kilobytes_per_s | 10.25 |
| up_kilobytes_per_s | 11.75 |
| deco_device | living_room |
| deco_mac | 1A-B2-C3-4D-56-EF |
| Attribute | Example Values (comma separated) |
|---|---|
| hw_version | 2.0 |
| sw_version | 1.5.1 Build 20210204 Rel. 50164 |
| device_model | x60 |
| internet_online | false, true |
| master | false, true |
| bssid_band2_4 | A1:B2:C3:D4:E5:F6 |
| bssid_band5 | A1:B2:C3:D4:E5:F6 |
| signal_band2_4 | 3 |
| signal_band2_4 | 4 |
| deco_device | living_room |
| deco_mac | 1A-B2-C3-4D-56-EF |
Note: deco_device and deco_mac will only be set for non-master decos.
A device is created for each deco. Each device contains the device_tracker entities for itself and any clients connected to it. Non-master deco devices will indicate that they are connected via the master deco device.
Reboots the specified decos. Example yaml:
service: tplink_deco.reboot_deco
target:
device_id:
- ef41562be18e5e3057e232ffb26de9bb
- d7f96b1f312d83f195b35ecdfbb3b02b
{% if not installed %}
configuration.yaml).custom_components directory (folder) there, you need to create it.custom_components directory (folder) create a new folder called tplink_deco.custom_components/tplink_deco/ directory (folder) in this repository.{% endif %}
Config is done in the HA integrations UI.
The IP address of the main deco which you visit in the browser to see the web admin page. Example: http://192.168.0.1. Some decos use https, so if you have trouble connection, try using https e.g. https://192.168.0.1.
The login credentials MUST be the deco owner credentials and the username should be left as admin. Manager credentials will NOT work.
Also whenever the owner logs in, all other sessions for the owner will be logged out. So if you log in with the owner credentials in the mobile app, it will cause the integration to be logged out, sometimes resulting in 403 errors. Since the integration has built in retry on auth errors, the integration will re-login, but that will logout your mobile app login session.
Recommend that you create a separate manager account with full permissions to manage the router manually in the mobile app and use the owner credentials only for this integration. If you need to use the owner account to do some manual management, recommend disabling this integration temporarily. Steps to create a manager account:
How many seconds to wait until request times out. You can increase this if you get a lot of timeout errors from your router.
Note: The router also has its own timeout so increasing this may not help.
How many times to retry timeout errors for one request. You can increase this if you get a lot of timeout errors from your router.
Turn off this config option if your browser gives you a warning that the SSL certificate is self-signed when you visit the router host IP in your browser.
Prefix to prepend to client name. Example: Value of "Client" for "Laptop" client will result in "Client Laptop".
Postfix to append to client name. Example: Value of "Client" for "Laptop" client will result in "Laptop Client".
Prefix to prepend to deco name. Example: Value of "Deco" for "Living Room" deco will result in "Deco Living Room".
Postfix to append to deco name. Example: Value of "Deco" for "Living Room" deco will result in "Living Room Deco".
If you prefer new entities to be disabled by default:
You can get notified by new entities by listening to the entity_registry_updated event. Here's an example automation:
- alias: Notify New Wifi Device
mode: parallel
max: 100
trigger:
- platform: event
event_type: entity_registry_updated
event_data:
action: create
variables:
id: "{{ trigger.event.data.entity_id }}"
condition:
- condition: template
value_template: "{{ id.split('.')[0] == 'device_tracker' }}"
- condition: template
value_template: "{{ id in integration_entities('tplink_deco') }}"
action:
- alias: Wait a little while to make sure the entity has updated with new state
wait_template: "{{ states(id) not in ['unknown', 'unavailable'] }}"
timeout:
minutes: 1
- service: notify.mobile_app_phone
data:
title: "{{ state_attr(id, 'friendly_name') or id }} connected to WiFi"
message: >-
{{ id }} connected to
{{ state_attr(id, 'interface') }}
{{
state_attr(id, 'connection_type')
| regex_replace('band', '')
| regex_replace('_', '.')
| regex_replace('$', 'G')
}}
through
{{ state_attr(id, 'deco_device') }}
data:
group: wifi-new-device
clickAction: "entityId:{{ id }}"
Resulting notification looks like:
title: "Amos Phone connected to WiFi" message: "device_tracker.amos_phone_wifi connected to main 5G through Guest Room"
Some routers give a lot of timeout errors like Timeout fetching tplink_deco, which cause the devices to be unavailable. This is a problem with the router. Potential mitigations:
You may see extra devices show up under the Tp-Link deco integration as per #73. This is expected because the entities use macs for their unique ID. If there is another integration that exposes the same device using their mac, Home Assistant will combine the info from devices that have the same unique ID. This is working as intended since they represent the same device.
If you want to contribute to this please read the Contribution guidelines
This project was generated from @oncleben31's Home Assistant Custom Component Cookiecutter template.
Code template was mainly taken from @Ludeeus's integration_blueprint template
more like this
meine 🌒 - A CLI file manager and system utility built with Textual. It combines intuitive command parsing with rich t…
Create and add progress bars, Office365 Files and Dropbox Paper papers by labels and link them to your Todoist tasks.
search projects, people, and tags