home-assistant.io/source/_components/sensor.dnsip.markdown
Daniel Perna e400b36940 Documentation: sensor.dnsip (#2135)
* Create sensor.dnsip.markdown

* Update sensor.dnsip.markdown

* Update sensor.dnsip.markdown

* Update sensor.dnsip.markdown

* Removed logo

* Added resolver_ipv6 parameter

* Added missing italics

* Typo and description

* Addressing suggested changes

* Update sensor.dnsip.markdown

Fix HA version marker.
2017-03-07 19:44:14 +01:00

51 lines
1.9 KiB
Markdown

---
layout: page
title: "DNS IP"
description: "Instructions on how to integrate a DNS IP sensor into Home Assistant."
date: 2017-02-25 11:05
sidebar: true
comments: false
sharing: true
footer: true
ha_category: Sensor
ha_iot_class: "Cloud Polling"
ha_release: "0.40"
---
The `dnsip` sensor will expose an IP address, fetched via DNS resolution, as its value. There are two operational modes:
1. When you enable the sensor with minimal configuration, it will query [OpenDNS](https://www.opendns.com/)' nameserver with the hostname `myip.opendns.com`, which will resolve to your external/public IP address.
2. If you specify a `hostname`, a regular DNS lookup will be performed, providing you the IP the hostname resolves to.
You may also override the nameserver that is being used by setting the `resolver` parameter to any nameserver you like.
To enable this sensor, add the following lines to your `configuration.yaml` file:
```yaml
# Example configuration.yaml entry
sensor:
- platform: dnsip
```
Configuration variables:
- **hostname** (*Optional*): The hostname for which to perform the DNS query. Default: `myip.opendns.com` (special hostname that resolves to your public IP)
- **resolver** (*Optional*): The DNS server to target the query at. Default: `208.67.222.222` (OpenDNS)
- **ipv6** (*Optional*): Set this to `true` or `false` if IPv6 should be used. When resolving the public IP, this will be the IP of the machine HASS is running on.
- **resolver_ipv6** (*Optional*): The IPv6 DNS server to target the query at. Default: `2620:0:ccc::2` (OpenDNS)
- **scan_interval** (*Optional*): Defines number of seconds for polling interval. Default: `120` seconds.
#### {% linkable_title Extended example %}
```yaml
# Example configuration.yaml entry
sensor:
# Own public IPv4 address
- platform: dnsip
# Resolve IP address of home-assistant.io via Google DNS
- platform: dnsip
hostname: home-assistant.io
resolver: 8.8.8.8
```