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:
parent
b3ffc1e183
commit
5fc51130ea
21 changed files with 83 additions and 125 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue