Hi All.
I’m new to Home Assistant and I’m trying to find a way to build a sensor that will use the output of my dnsip sensor to tell me what ISP my public IP address belongs to. I have multiple internet connections and want to be able to see which one is active very quickly.
I was able to create a sensor to find my public IP and that is working well:
sensor dns_ip in my configuration.yaml file:
sensor dns_ip:
# Own public IPv4 address
- platform: dnsip
scan_interval: 10
I went down a few paths and I’m currently trying this in my configuration.yaml as well but I’m not getting any results (“Unavailable”):
sensor domain:
- platform: template
sensors:
domain_name:
friendly_name: 'Internet Service Provider'
value_template: >
import socket
{% set isp = socket.gethostbyaddr('sensor.myip') %}
{{ print(isp) }}
Thanks in advance!