mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Add and use currency cent constant (#40261)
This commit is contained in:
parent
7de1fe7416
commit
b088830382
@ -1,7 +1,7 @@
|
|||||||
"""Support for August sensors."""
|
"""Support for August sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.const import ENERGY_KILO_WATT_HOUR
|
from homeassistant.const import CURRENCY_CENT, ENERGY_KILO_WATT_HOUR
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import CONF_LOADZONE, DOMAIN
|
from .const import CONF_LOADZONE, DOMAIN
|
||||||
@ -29,7 +29,7 @@ class GriddyPriceSensor(CoordinatorEntity):
|
|||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
"""Return the unit of measurement."""
|
"""Return the unit of measurement."""
|
||||||
return f"¢/{ENERGY_KILO_WATT_HOUR}"
|
return f"{CURRENCY_CENT}/{ENERGY_KILO_WATT_HOUR}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -46,6 +46,7 @@ from homeassistant.components.switch import DOMAIN as SWITCH
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
AREA_SQUARE_METERS,
|
AREA_SQUARE_METERS,
|
||||||
CONCENTRATION_PARTS_PER_MILLION,
|
CONCENTRATION_PARTS_PER_MILLION,
|
||||||
|
CURRENCY_CENT,
|
||||||
CURRENCY_DOLLAR,
|
CURRENCY_DOLLAR,
|
||||||
DEGREE,
|
DEGREE,
|
||||||
ENERGY_KILO_WATT_HOUR,
|
ENERGY_KILO_WATT_HOUR,
|
||||||
@ -401,7 +402,7 @@ UOM_FRIENDLY_NAME = {
|
|||||||
UOM_DOUBLE_TEMP: UOM_DOUBLE_TEMP,
|
UOM_DOUBLE_TEMP: UOM_DOUBLE_TEMP,
|
||||||
"102": "kWs",
|
"102": "kWs",
|
||||||
"103": CURRENCY_DOLLAR,
|
"103": CURRENCY_DOLLAR,
|
||||||
"104": "¢",
|
"104": CURRENCY_CENT,
|
||||||
"105": LENGTH_INCHES,
|
"105": LENGTH_INCHES,
|
||||||
"106": f"mm/{TIME_DAYS}",
|
"106": f"mm/{TIME_DAYS}",
|
||||||
"107": "", # raw 1-byte unsigned value
|
"107": "", # raw 1-byte unsigned value
|
||||||
|
@ -7,7 +7,7 @@ from nsw_fuel import FuelCheckClient, FuelCheckError
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import ATTR_ATTRIBUTION
|
from homeassistant.const import ATTR_ATTRIBUTION, CURRENCY_CENT, VOLUME_LITERS
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
@ -179,7 +179,7 @@ class StationPriceSensor(Entity):
|
|||||||
@property
|
@property
|
||||||
def unit_of_measurement(self) -> str:
|
def unit_of_measurement(self) -> str:
|
||||||
"""Return the units of measurement."""
|
"""Return the units of measurement."""
|
||||||
return "¢/L"
|
return f"{CURRENCY_CENT}/{VOLUME_LITERS}"
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update current conditions."""
|
"""Update current conditions."""
|
||||||
|
@ -384,6 +384,7 @@ DEGREE = "°"
|
|||||||
# Currency units
|
# Currency units
|
||||||
CURRENCY_EURO = "€"
|
CURRENCY_EURO = "€"
|
||||||
CURRENCY_DOLLAR = "$"
|
CURRENCY_DOLLAR = "$"
|
||||||
|
CURRENCY_CENT = "¢"
|
||||||
|
|
||||||
# Temperature units
|
# Temperature units
|
||||||
TEMP_CELSIUS = f"{DEGREE}C"
|
TEMP_CELSIUS = f"{DEGREE}C"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user