Skip to content
Merged
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
4 changes: 2 additions & 2 deletions homeassistant/components/vallox/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def name(self):
return self._name

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit_of_measurement

Expand All @@ -161,7 +161,7 @@ def available(self):
return self._available

@property
def state(self):
def native_value(self):
"""Return the state."""
return self._state

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/vasttrafik/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def extra_state_attributes(self):
return self._attributes

@property
def state(self):
def native_value(self):
"""Return the next departure time."""
return self._state

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/velbus/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ def device_class(self):
return self._module.get_class(self._channel)

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
if self._is_counter:
return self._module.get_counter_state(self._channel)
return self._module.get_state(self._channel)

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit this state is expressed in."""
if self._is_counter:
return self._module.get_counter_unit(self._channel)
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/vera/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def __init__(
self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)

@property
def state(self) -> str:
def native_value(self) -> str:
"""Return the name of the sensor."""
return self.current_value

@property
def unit_of_measurement(self) -> str | None:
def native_unit_of_measurement(self) -> str | None:
"""Return the unit of measurement of this entity, if any."""

if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
Expand Down
12 changes: 6 additions & 6 deletions homeassistant/components/verisure/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class VerisureThermometer(CoordinatorEntity, SensorEntity):
coordinator: VerisureDataUpdateCoordinator

_attr_device_class = DEVICE_CLASS_TEMPERATURE
_attr_unit_of_measurement = TEMP_CELSIUS
_attr_native_unit_of_measurement = TEMP_CELSIUS

def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
Expand Down Expand Up @@ -84,7 +84,7 @@ def device_info(self) -> DeviceInfo:
}

@property
def state(self) -> str | None:
def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["climate"][self.serial_number]["temperature"]

Expand All @@ -104,7 +104,7 @@ class VerisureHygrometer(CoordinatorEntity, SensorEntity):
coordinator: VerisureDataUpdateCoordinator

_attr_device_class = DEVICE_CLASS_HUMIDITY
_attr_unit_of_measurement = PERCENTAGE
_attr_native_unit_of_measurement = PERCENTAGE

def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
Expand Down Expand Up @@ -137,7 +137,7 @@ def device_info(self) -> DeviceInfo:
}

@property
def state(self) -> str | None:
def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["climate"][self.serial_number]["humidity"]

Expand All @@ -156,7 +156,7 @@ class VerisureMouseDetection(CoordinatorEntity, SensorEntity):

coordinator: VerisureDataUpdateCoordinator

_attr_unit_of_measurement = "Mice"
_attr_native_unit_of_measurement = "Mice"

def __init__(
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
Expand Down Expand Up @@ -186,7 +186,7 @@ def device_info(self) -> DeviceInfo:
}

@property
def state(self) -> str | None:
def native_value(self) -> str | None:
"""Return the state of the entity."""
return self.coordinator.data["mice"][self.serial_number]["detections"]

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/versasense/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def name(self):
return self._name

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
return self._state

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/version/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,5 @@ def __init__(
async def async_update(self):
"""Get the latest version information."""
await self.data.async_update()
self._attr_state = self.data.api.version
self._attr_native_value = self.data.api.version
self._attr_extra_state_attributes = self.data.api.version_data
4 changes: 2 additions & 2 deletions homeassistant/components/viaggiatreno/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def name(self):
return self._name

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
return self._state

Expand All @@ -113,7 +113,7 @@ def icon(self):
return self._icon

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._unit

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/vicare/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,12 @@ def icon(self):
return self._sensor[CONF_ICON]

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
return self._state

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self._sensor[CONF_UNIT_OF_MEASUREMENT]

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/vilfo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def name(self):
return f"{parent_device_name} {sensor_name}"

@property
def state(self):
def native_value(self):
"""Return the state."""
return self._state

Expand All @@ -82,7 +82,7 @@ def unique_id(self):
return self._unique_id

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity."""
return SENSOR_TYPES[self.sensor_type].get(ATTR_UNIT)

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/volkszaehler/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def icon(self):
return SENSOR_TYPES[self.type][2]

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit the value is expressed in."""
return SENSOR_TYPES[self.type][1]

Expand All @@ -107,7 +107,7 @@ def available(self):
return self.vz_api.available

@property
def state(self):
def native_value(self):
"""Return the state of the resources."""
return self._state

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/volvooncall/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class VolvoSensor(VolvoEntity, SensorEntity):
"""Representation of a Volvo sensor."""

@property
def state(self):
def native_value(self):
"""Return the state."""
return self.instrument.state

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return self.instrument.unit
4 changes: 2 additions & 2 deletions homeassistant/components/vultr/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ def icon(self):
return self._icon

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement to present the value in."""
return self._units

@property
def state(self):
def native_value(self):
"""Return the value of this given sensor type."""
try:
return round(float(self.data.get(self._condition)), 2)
Expand Down
8 changes: 4 additions & 4 deletions homeassistant/components/wallbox/sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Home Assistant component for accessing the Wallbox Portal API. The sensor component creates multiple sensors regarding wallbox performance."""

from homeassistant.helpers.entity import Entity
from homeassistant.components.sensor import SensorEntity
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import (
Expand Down Expand Up @@ -28,7 +28,7 @@ async def async_setup_entry(hass, config, async_add_entities):
)


class WallboxSensor(CoordinatorEntity, Entity):
class WallboxSensor(CoordinatorEntity, SensorEntity):
"""Representation of the Wallbox portal."""

def __init__(self, coordinator, idx, ent, config):
Expand All @@ -46,12 +46,12 @@ def name(self):
return self._name

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
return self.coordinator.data[self._ent]

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of the sensor."""
return self._unit

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/waqi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def icon(self):
return "mdi:cloud"

@property
def state(self):
def native_value(self):
"""Return the state of the device."""
if self._data is not None:
return self._data.get("aqi")
Expand All @@ -146,7 +146,7 @@ def unique_id(self):
return self.uid

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return "AQI"

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/waterfurnace/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def name(self):
return self._name

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
return self._state

Expand All @@ -111,7 +111,7 @@ def icon(self):
return self._icon

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the units of measurement."""
return self._unit_of_measurement

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/waze_travel_time/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ def name(self):
return self._name

@property
def state(self):
def native_value(self):
"""Return the state of the sensor."""
if self._waze_data.duration is not None:
return round(self._waze_data.duration)

return None

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement."""
return TIME_MINUTES

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/websocket_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ def name(self) -> str:
return "Connected clients"

@property
def state(self) -> int:
def native_value(self) -> int:
"""Return current API count."""
return self.count

@property
def unit_of_measurement(self) -> str:
def native_unit_of_measurement(self) -> str:
"""Return the unit of measurement."""
return "clients"

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/whois/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def icon(self):
return "mdi:calendar-clock"

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement to present the value in."""
return TIME_DAYS

@property
def state(self):
def native_value(self):
"""Return the expiration days for hostname."""
return self._state

Expand Down
6 changes: 3 additions & 3 deletions homeassistant/components/wiffi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def device_class(self):
return self._device_class

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity."""
return self._unit_of_measurement

@property
def state(self):
def native_value(self):
"""Return the value of the entity."""
return self._value

Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(self, device, metric, options):
self.reset_expiration_date()

@property
def state(self):
def native_value(self):
"""Return the value of the entity."""
return self._value

Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/wink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def async_added_to_hass(self):
self.hass.data[DOMAIN]["entities"]["sensor"].append(self)

@property
def state(self):
def native_value(self):
"""Return the state."""
state = None
if self.capability == "humidity":
Expand All @@ -82,7 +82,7 @@ def state(self):
return state

@property
def unit_of_measurement(self):
def native_unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
return self._unit_of_measurement

Expand Down
Loading