Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ To use the integration in your installation, add the following to your `configur
#### Configuration variables:
| Variable | Required | Type | Description |
| -------- | ---------- | ----------- | ----------- |
| `domain` | yes | string | The subdomain you are modifying the DNS configuration for |
| `domain` | yes | string | The subdomain/subdomains you are modifying the DNS configuration for |
| `username` | yes | string | The DynHost username |
| `password` | yes | string | Password for the DynHost username |
| `scan_interval` | no | time | How often to call the update service. (default: 10 minutes) |
| `scan_interval` | no | time | How often to call the update service (seconds). (default: 10 minutes) |

#### Basic Example:

Expand All @@ -22,4 +22,14 @@ ovh:
username: YOUR_USERNAME
password: YOUR_PASSWORD
```

#### Example with two domains and scan interval:
Suports multiple subdomains separated by a comma if they all use the same DynHost username and password.
```yaml
ovh:
domain: "subdomain1.domain.com,subdomain2.domain.com"
username: YOUR_USERNAME
password: YOUR_PASSWORD
scan_interval: 300
```
Based on the official [No-IP.com](https://github.com/home-assistant/core/tree/dev/homeassistant/components/no_ip) and [Mythic Beasts](https://github.com/home-assistant/core/blob/dev/homeassistant/components/mythicbeastsdns) integrations. Thanks to the creators!
14 changes: 8 additions & 6 deletions custom_components/ovh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,23 @@
async def async_setup(hass, config):
"""Initialize the OVH component."""
conf = config[DOMAIN]
domain = conf.get(CONF_DOMAIN)
domains = conf.get(CONF_DOMAIN)
user = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
interval = conf.get(CONF_SCAN_INTERVAL)
domains_list = domains.split(",")

session = async_get_clientsession(hass)

result = await _update_ovh(hass, session, domain, user, password)

if not result:
return False
for domain in domains_list:
result = await _update_ovh(hass, session, domain, user, password)
if not result:
return False

async def update_domain_interval(now):
"""Update the OVH entry."""
await _update_ovh(hass, session, domain, user, password)
for domain in domains_list:
await _update_ovh(hass, session, domain, user, password)

async_track_time_interval(hass, update_domain_interval, interval)

Expand Down