mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Use EntityStateAttribute enum in Tankerkoenig (#176393)
This commit is contained in:
@@ -9,7 +9,7 @@ from homeassistant.components.binary_sensor import (
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE
|
||||
from homeassistant.const import EntityStateAttribute
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
@@ -56,8 +56,8 @@ class StationOpenBinarySensorEntity(TankerkoenigCoordinatorEntity, BinarySensorE
|
||||
self._attr_unique_id = f"{station.id}_status"
|
||||
if coordinator.show_on_map:
|
||||
self._attr_extra_state_attributes = {
|
||||
ATTR_LATITUDE: station.lat,
|
||||
ATTR_LONGITUDE: station.lng,
|
||||
EntityStateAttribute.LATITUDE: station.lat,
|
||||
EntityStateAttribute.LONGITUDE: station.lng,
|
||||
}
|
||||
|
||||
@property
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import override
|
||||
from aiotankerkoenig import GasType, Station
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity, SensorStateClass
|
||||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CURRENCY_EURO
|
||||
from homeassistant.const import CURRENCY_EURO, EntityStateAttribute
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
|
||||
|
||||
@@ -76,8 +76,8 @@ class FuelPriceSensor(TankerkoenigCoordinatorEntity, SensorEntity):
|
||||
ATTR_STATION_NAME,
|
||||
ATTR_STREET,
|
||||
ATTRIBUTION,
|
||||
ATTR_LATITUDE,
|
||||
ATTR_LONGITUDE,
|
||||
EntityStateAttribute.LATITUDE,
|
||||
EntityStateAttribute.LONGITUDE,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -104,8 +104,8 @@ class FuelPriceSensor(TankerkoenigCoordinatorEntity, SensorEntity):
|
||||
}
|
||||
|
||||
if coordinator.show_on_map:
|
||||
attrs[ATTR_LATITUDE] = station.lat
|
||||
attrs[ATTR_LONGITUDE] = station.lng
|
||||
attrs[EntityStateAttribute.LATITUDE] = station.lat
|
||||
attrs[EntityStateAttribute.LONGITUDE] = station.lng
|
||||
self._attr_extra_state_attributes = attrs
|
||||
|
||||
@property
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'opening',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Station Somewhere Street 1 Status',
|
||||
'latitude': 51.1,
|
||||
'longitude': 13.1,
|
||||
<EntityStateAttribute.LATITUDE: 'latitude'>: 51.1,
|
||||
<EntityStateAttribute.LONGITUDE: 'longitude'>: 13.1,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Station Somewhere Street 1 Super E10',
|
||||
'fuel_type': <GasType.E10: 'e10'>,
|
||||
'house_number': '1',
|
||||
'latitude': 51.1,
|
||||
'longitude': 13.1,
|
||||
<EntityStateAttribute.LATITUDE: 'latitude'>: 51.1,
|
||||
<EntityStateAttribute.LONGITUDE: 'longitude'>: 13.1,
|
||||
'postcode': 1234,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'station_name': 'Station ABC',
|
||||
@@ -24,8 +24,8 @@
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Station Somewhere Street 1 Super',
|
||||
'fuel_type': <GasType.E5: 'e5'>,
|
||||
'house_number': '1',
|
||||
'latitude': 51.1,
|
||||
'longitude': 13.1,
|
||||
<EntityStateAttribute.LATITUDE: 'latitude'>: 51.1,
|
||||
<EntityStateAttribute.LONGITUDE: 'longitude'>: 13.1,
|
||||
'postcode': 1234,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'station_name': 'Station ABC',
|
||||
@@ -41,8 +41,8 @@
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Station Somewhere Street 1 Diesel',
|
||||
'fuel_type': <GasType.DIESEL: 'diesel'>,
|
||||
'house_number': '1',
|
||||
'latitude': 51.1,
|
||||
'longitude': 13.1,
|
||||
<EntityStateAttribute.LATITUDE: 'latitude'>: 51.1,
|
||||
<EntityStateAttribute.LONGITUDE: 'longitude'>: 13.1,
|
||||
'postcode': 1234,
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'station_name': 'Station ABC',
|
||||
|
||||
Reference in New Issue
Block a user