Does anyone have a Tp Link integration?
Im getting an invalid authentication error when I put the password for configuring.
Though I’m putting the right password. Does this integration work for all decos? I have a deco x20 and it doesnt have a Web portal. The router can only be managed through the app. So maybe this is what’s causing the issue?
The purpose of this is so that I can track presence when my phone is connected to the router. It means I’m home. Are there any alternative ways.
Do you know how I can set up a presence detection using the deco, so when my phone connects to the wifi, it can change the state to “home” or vice versa “away”
if you look at the integration, it should list the related entities. there should be a device_tracker.whatever for each connected device. this will change from home to away when you leave, and back to home when it re-connects
It seems the device tracker is not working properly. My phone was connected to the deco and the person tracking showed “home” but after turning off my phones wifi and disconnecting it from deco. The entity was still set to “home” rather than “away”. I waited for 5 minutes and still it did not chance.
However when I went to developer options and changed the device.tracker.phone entity to “not_home” Only then did the person tracking showed “away”
If “Allow person to login” is enabled, when you log in on a mobile app device, it attaches that mobile apps device tracker to the person logging in. So, it’s possible your testing method is being thwarted, because your phone’s GPS location ( or a tablet, etc) will still be reporting you as within the home zone. However, you should see that the device tracker has been added to the person entity…
If you want to do a quick test of the TP Link integration just create a test person entity, do not allow it to login, and add the phone’s router-based device tracker to it. Then repeat your “turn off the phone’s wifi” test.
It will register you as not_home sooner, but the drawback is false positive triggers of automations. It is very common for WiFi devices to fall off network every so often. Different devices will have their own settings for how long they wait to try to reconnect. If you set the “seconds to wait…” shorter than your device’s reconnect interval your person entity will occasionally switch from home to not_home, seemingly at random, and trigger any presence based automations you have.
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 }}”
The automation looks fine, but I couldn’t get it to trigger when adding new wifi devices.
The only thing I can see that you likely need to change is the notification service. Beyond that, there are a couple of tweaks that could be made to update the templates, but nothing critical.
Tweaked 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 is search('device_tracker.') and
id in integration_entities('tplink_deco') }}
action:
- alias: Wait a little while to make sure the entity has updated with new state
wait_template: "{{ not is_state(id, ['unknown', 'unavailable'] }}"
timeout:
minutes: 1
- service: notify.mobile_app_#YOUR_DEVICE#
data:
title: "{{ states[id].name }} 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 }}"
Yep it isnt working for me either. Like you said, I changed the entity of the phone in the automation. But when I register a new wifi device. Theres no notification message…