Newbie help with setting dynamic IP address from TPLink Switch

Hi All,

I have an issue at the moment I can’t solve…

I have a TPLink H110 smart plug that needs to remain on DHCP…
Since I wanted to configure it once I thought it might be a good idea to set up an nmap tracker

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.0/24
    home_interval: 10
    exclude:
    - 192.168.1.1
    - 192.168.1.100

That works, returning the ip address for the device I want to track.
This is where my lack of experience kicks in…

I first tried creating a template to extract the IP address

hs110:
    friendly_name_template: "HS110: IP Address"
    value_template: "{{ state_attr('device_tracker.50c7bf4e1495','ip') }}"

And that works but when I attempted to set it in my device tracker it failed to do anything…

switch:
 - platform: tplink
   host: sensor.hs110

I also tried making the call directly…

switch:
 - platform: tplink
   host: "{{  state_attr('device_tracker.50c7bf4e1495','ip') }}"

But neither of them worked…

So I’m kind of out of options, what am I doing wrong?

Regards,

Paul

I don’t believe passing template values is supported in the configuration like you are attempting.

Additionally, the configuration is read at startup and not checked again. What you are attempting won’t work.

Assign a static IP.

1 Like

The right fix for this is to set a DHCP reservation in your router for the switch.

Thanks!!! I guess Ill just have to bite the bullet and configure them to stay put