Replace util.get_local_ip in favor of components.network.async_get_source_ip() - part 4 (#58669)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Simone Chemelli 2021-11-15 18:18:57 +01:00 committed by GitHub
parent b3ffc1e183
commit 5fc51130ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 83 additions and 125 deletions

View file

@ -1,7 +1,6 @@
"""Sensor platform for local_ip."""
from homeassistant.components.network import async_get_source_ip
from homeassistant.components.network.const import PUBLIC_TARGET_IP
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME
@ -33,6 +32,4 @@ class IPSensor(SensorEntity):
async def async_update(self) -> None:
"""Fetch new state data for the sensor."""
self._attr_native_value = await async_get_source_ip(
self.hass, target_ip=PUBLIC_TARGET_IP
)
self._attr_native_value = await async_get_source_ip(self.hass)