parent
e55ce61100
commit
ed2b9e5483
|
@ -6,7 +6,7 @@ import voluptuous as vol
|
|||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components import apcupsd
|
||||
from homeassistant.const import (TEMP_CELSIUS, CONF_RESOURCES)
|
||||
from homeassistant.const import (TEMP_CELSIUS, CONF_RESOURCES, POWER_WATT)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -57,7 +57,7 @@ SENSOR_TYPES = {
|
|||
'nombattv': ['Battery Nominal Voltage', 'V', 'mdi:flash'],
|
||||
'nominv': ['Nominal Input Voltage', 'V', 'mdi:flash'],
|
||||
'nomoutv': ['Nominal Output Voltage', 'V', 'mdi:flash'],
|
||||
'nompower': ['Nominal Output Power', 'W', 'mdi:flash'],
|
||||
'nompower': ['Nominal Output Power', POWER_WATT, 'mdi:flash'],
|
||||
'nomapnt': ['Nominal Apparent Power', 'VA', 'mdi:flash'],
|
||||
'numxfers': ['Transfer Count', '', 'mdi:counter'],
|
||||
'outcurnt': ['Output Current', 'A', 'mdi:flash'],
|
||||
|
@ -93,7 +93,7 @@ INFERRED_UNITS = {
|
|||
' Volts': 'V',
|
||||
' Ampere': 'A',
|
||||
' Volt-Ampere': 'VA',
|
||||
' Watts': 'W',
|
||||
' Watts': POWER_WATT,
|
||||
' Hz': 'Hz',
|
||||
' C': TEMP_CELSIUS,
|
||||
' Percent Load Capacity': '%',
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import POWER_WATT
|
||||
|
||||
from homeassistant.components.edp_redy import EdpRedyDevice, EDP_REDY
|
||||
|
||||
|
@ -29,7 +30,7 @@ async def async_setup_platform(
|
|||
|
||||
# Create a sensor for global active power
|
||||
devices.append(EdpRedySensor(session, ACTIVE_POWER_ID, "Power Home",
|
||||
'mdi:flash', 'W'))
|
||||
'mdi:flash', POWER_WATT))
|
||||
|
||||
async_add_entities(devices, True)
|
||||
|
||||
|
@ -89,7 +90,7 @@ class EdpRedyModuleSensor(EdpRedyDevice, Entity):
|
|||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement of this sensor."""
|
||||
return 'W'
|
||||
return POWER_WATT
|
||||
|
||||
async def async_update(self):
|
||||
"""Parse the data for this sensor."""
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (CONF_NAME, CONF_ID)
|
||||
from homeassistant.const import (CONF_NAME, CONF_ID, POWER_WATT)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components import enocean
|
||||
|
@ -59,4 +59,4 @@ class EnOceanSensor(enocean.EnOceanDevice, Entity):
|
|||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit of measurement."""
|
||||
return 'W'
|
||||
return POWER_WATT
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.components.homematic import ATTR_DISCOVER_DEVICES, HMDevice
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.const import STATE_UNKNOWN, POWER_WATT
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -24,7 +24,7 @@ HM_UNIT_HA_CAST = {
|
|||
'TEMPERATURE': '°C',
|
||||
'ACTUAL_TEMPERATURE': '°C',
|
||||
'BRIGHTNESS': '#',
|
||||
'POWER': 'W',
|
||||
'POWER': POWER_WATT,
|
||||
'CURRENT': 'mA',
|
||||
'VOLTAGE': 'V',
|
||||
'ENERGY_COUNTER': 'Wh',
|
||||
|
|
|
@ -5,7 +5,7 @@ from homeassistant.components.homematicip_cloud import (
|
|||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE,
|
||||
TEMP_CELSIUS)
|
||||
TEMP_CELSIUS, POWER_WATT)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -223,4 +223,4 @@ class HomematicipPowerSensor(HomematicipGenericDevice):
|
|||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Return the unit this state is expressed in."""
|
||||
return 'W'
|
||||
return POWER_WATT
|
||||
|
|
|
@ -5,7 +5,8 @@ from typing import Callable
|
|||
from homeassistant.components.isy994 import (
|
||||
ISY994_NODES, ISY994_WEATHER, ISYDevice)
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT, UNIT_UV_INDEX
|
||||
from homeassistant.const import (
|
||||
TEMP_CELSIUS, TEMP_FAHRENHEIT, UNIT_UV_INDEX, POWER_WATT)
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -75,7 +76,7 @@ UOM_FRIENDLY_NAME = {
|
|||
'69': 'gal',
|
||||
'71': UNIT_UV_INDEX,
|
||||
'72': 'V',
|
||||
'73': 'W',
|
||||
'73': POWER_WATT,
|
||||
'74': 'W/m²',
|
||||
'75': 'weekday',
|
||||
'76': 'Wind Direction (°)',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for monitoring juicenet/juicepoint/juicebox based EVSE sensors."""
|
||||
import logging
|
||||
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.const import TEMP_CELSIUS, POWER_WATT
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.juicenet import JuicenetDevice, DOMAIN
|
||||
|
||||
|
@ -14,7 +14,7 @@ SENSOR_TYPES = {
|
|||
'temperature': ['Temperature', TEMP_CELSIUS],
|
||||
'voltage': ['Voltage', 'V'],
|
||||
'amps': ['Amps', 'A'],
|
||||
'watts': ['Watts', 'W'],
|
||||
'watts': ['Watts', POWER_WATT],
|
||||
'charge_time': ['Charge time', 's'],
|
||||
'energy_added': ['Energy added', 'Wh']
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for MySensors sensors."""
|
||||
from homeassistant.components import mysensors
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT, POWER_WATT
|
||||
|
||||
SENSORS = {
|
||||
'V_TEMP': [None, 'mdi:thermometer'],
|
||||
|
@ -12,7 +12,7 @@ SENSORS = {
|
|||
'V_WEIGHT': ['kg', 'mdi:weight-kilogram'],
|
||||
'V_DISTANCE': ['m', 'mdi:ruler'],
|
||||
'V_IMPEDANCE': ['ohm', None],
|
||||
'V_WATT': ['W', None],
|
||||
'V_WATT': [POWER_WATT, None],
|
||||
'V_KWH': ['kWh', None],
|
||||
'V_FLOW': ['m', None],
|
||||
'V_VOLUME': ['m³', None],
|
||||
|
|
|
@ -6,7 +6,8 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, ATTR_NAME, ATTR_STATE, CONF_DEVICE, CONF_DEVICES,
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS)
|
||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS,
|
||||
POWER_WATT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
|
@ -40,8 +41,8 @@ DATA_TYPES = OrderedDict([
|
|||
('Barometer', ''),
|
||||
('Wind direction', ''),
|
||||
('Rain rate', ''),
|
||||
('Energy usage', 'W'),
|
||||
('Total usage', 'W'),
|
||||
('Energy usage', POWER_WATT),
|
||||
('Total usage', POWER_WATT),
|
||||
('Sound', ''),
|
||||
('Sensor Status', ''),
|
||||
('Counter value', ''),
|
||||
|
|
|
@ -3,6 +3,7 @@ from datetime import timedelta
|
|||
import logging
|
||||
|
||||
from homeassistant.components.sense import SENSE_DATA
|
||||
from homeassistant.const import POWER_WATT
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
|
@ -90,7 +91,7 @@ class Sense(Entity):
|
|||
self._state = None
|
||||
|
||||
if sensor_type == ACTIVE_TYPE:
|
||||
self._unit_of_measurement = 'W'
|
||||
self._unit_of_measurement = POWER_WATT
|
||||
else:
|
||||
self._unit_of_measurement = 'kWh'
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_CURRENCY
|
||||
from homeassistant.const import CONF_CURRENCY, POWER_WATT
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
|
@ -34,11 +34,11 @@ DEFAULT_PERIOD = 'year'
|
|||
DEFAULT_UTC_OFFSET = '0'
|
||||
|
||||
SENSOR_TYPES = {
|
||||
CONF_INSTANT: ['Energy Usage', 'W'],
|
||||
CONF_INSTANT: ['Energy Usage', POWER_WATT],
|
||||
CONF_AMOUNT: ['Energy Consumed', 'kWh'],
|
||||
CONF_BUDGET: ['Energy Budget', None],
|
||||
CONF_COST: ['Energy Cost', None],
|
||||
CONF_CURRENT_VALUES: ['Per-Device Usage', 'W']
|
||||
CONF_CURRENT_VALUES: ['Per-Device Usage', POWER_WATT]
|
||||
}
|
||||
|
||||
TYPES_SCHEMA = vol.In(SENSOR_TYPES)
|
||||
|
|
|
@ -10,7 +10,7 @@ import logging
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (CONF_ACCESS_TOKEN, CONF_NAME)
|
||||
from homeassistant.const import (CONF_ACCESS_TOKEN, CONF_NAME, POWER_WATT)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -27,7 +27,7 @@ ICON = 'mdi:gauge'
|
|||
|
||||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
|
||||
UNIT_OF_MEASUREMENT = 'W'
|
||||
UNIT_OF_MEASUREMENT = POWER_WATT
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
vol.Required(CONF_ACCESS_TOKEN): cv.string,
|
||||
|
|
|
@ -14,7 +14,7 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY, CONF_URL, CONF_VALUE_TEMPLATE, CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_ID, CONF_SCAN_INTERVAL, STATE_UNKNOWN)
|
||||
CONF_ID, CONF_SCAN_INTERVAL, STATE_UNKNOWN, POWER_WATT)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers import template
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -34,7 +34,7 @@ CONF_ONLY_INCLUDE_FEEDID = 'include_only_feed_id'
|
|||
CONF_SENSOR_NAMES = 'sensor_names'
|
||||
|
||||
DECIMALS = 2
|
||||
DEFAULT_UNIT = 'W'
|
||||
DEFAULT_UNIT = POWER_WATT
|
||||
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5)
|
||||
|
||||
|
|
|
@ -11,14 +11,15 @@ import voluptuous as vol
|
|||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.const import (CONF_IP_ADDRESS, CONF_MONITORED_CONDITIONS)
|
||||
from homeassistant.const import (
|
||||
CONF_IP_ADDRESS, CONF_MONITORED_CONDITIONS, POWER_WATT)
|
||||
|
||||
|
||||
REQUIREMENTS = ['envoy_reader==0.3']
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SENSORS = {
|
||||
"production": ("Envoy Current Energy Production", 'W'),
|
||||
"production": ("Envoy Current Energy Production", POWER_WATT),
|
||||
"daily_production": ("Envoy Today's Energy Production", "Wh"),
|
||||
"seven_days_production": ("Envoy Last Seven Days Energy Production", "Wh"),
|
||||
"lifetime_production": ("Envoy Lifetime Energy Production", "Wh"),
|
||||
|
|
|
@ -6,7 +6,7 @@ https://home-assistant.io/components/sensors.greeneye_monitor_temperature/
|
|||
"""
|
||||
import logging
|
||||
|
||||
from homeassistant.const import CONF_NAME, CONF_TEMPERATURE_UNIT
|
||||
from homeassistant.const import CONF_NAME, CONF_TEMPERATURE_UNIT, POWER_WATT
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from ..greeneye_monitor import (
|
||||
|
@ -33,7 +33,7 @@ DEPENDENCIES = ['greeneye_monitor']
|
|||
DATA_PULSES = 'pulses'
|
||||
DATA_WATT_SECONDS = 'watt_seconds'
|
||||
|
||||
UNIT_WATTS = 'W'
|
||||
UNIT_WATTS = POWER_WATT
|
||||
|
||||
COUNTER_ICON = 'mdi:counter'
|
||||
CURRENT_SENSOR_ICON = 'mdi:flash'
|
||||
|
|
|
@ -11,7 +11,7 @@ import requests.exceptions
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (CONF_API_KEY)
|
||||
from homeassistant.const import (CONF_API_KEY, POWER_WATT)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -148,7 +148,7 @@ class NeurioEnergy(Entity):
|
|||
self._state = None
|
||||
|
||||
if sensor_type == ACTIVE_TYPE:
|
||||
self._unit_of_measurement = 'W'
|
||||
self._unit_of_measurement = POWER_WATT
|
||||
elif sensor_type == DAILY_TYPE:
|
||||
self._unit_of_measurement = 'kWh'
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_PORT, CONF_NAME, CONF_USERNAME, CONF_PASSWORD,
|
||||
TEMP_CELSIUS, CONF_RESOURCES, CONF_ALIAS, ATTR_STATE, STATE_UNKNOWN)
|
||||
TEMP_CELSIUS, CONF_RESOURCES, CONF_ALIAS, ATTR_STATE, STATE_UNKNOWN,
|
||||
POWER_WATT)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -63,8 +64,8 @@ SENSOR_TYPES = {
|
|||
'ups.efficiency': ['Efficiency', '%', 'mdi:gauge'],
|
||||
'ups.power': ['Current Apparent Power', 'VA', 'mdi:flash'],
|
||||
'ups.power.nominal': ['Nominal Power', 'VA', 'mdi:flash'],
|
||||
'ups.realpower': ['Current Real Power', 'W', 'mdi:flash'],
|
||||
'ups.realpower.nominal': ['Nominal Real Power', 'W', 'mdi:flash'],
|
||||
'ups.realpower': ['Current Real Power', POWER_WATT, 'mdi:flash'],
|
||||
'ups.realpower.nominal': ['Nominal Real Power', POWER_WATT, 'mdi:flash'],
|
||||
'ups.beeper.status': ['Beeper Status', '', 'mdi:information-outline'],
|
||||
'ups.type': ['UPS Type', '', 'mdi:information-outline'],
|
||||
'ups.watchdog.status': ['Watchdog Status', '', 'mdi:information-outline'],
|
||||
|
|
|
@ -12,7 +12,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_API_KEY, CONF_MONITORED_CONDITIONS, CONF_NAME)
|
||||
CONF_API_KEY, CONF_MONITORED_CONDITIONS, CONF_NAME, POWER_WATT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -36,7 +36,7 @@ SENSOR_TYPES = {
|
|||
'mdi:solar-power'],
|
||||
'energy_today': ['lastDayData', "Energy today", 'Wh',
|
||||
'mdi:solar-power'],
|
||||
'current_power': ['currentPower', "Current Power", 'W',
|
||||
'current_power': ['currentPower', "Current Power", POWER_WATT,
|
||||
'mdi:solar-power']
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ import requests
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (CONF_HOST, CONF_NAME, CONF_PORT)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_NAME, CONF_PORT, POWER_WATT)
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -46,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
|
||||
dev = []
|
||||
for mtu in gateway.data:
|
||||
dev.append(Ted5000Sensor(gateway, name, mtu, 'W'))
|
||||
dev.append(Ted5000Sensor(gateway, name, mtu, POWER_WATT))
|
||||
dev.append(Ted5000Sensor(gateway, name, mtu, 'V'))
|
||||
|
||||
add_entities(dev)
|
||||
|
@ -58,7 +59,7 @@ class Ted5000Sensor(Entity):
|
|||
|
||||
def __init__(self, gateway, name, mtu, unit):
|
||||
"""Initialize the sensor."""
|
||||
units = {'W': 'power', 'V': 'voltage'}
|
||||
units = {POWER_WATT: 'power', 'V': 'voltage'}
|
||||
self._gateway = gateway
|
||||
self._name = '{} mtu{} {}'.format(name, mtu, units[unit])
|
||||
self._mtu = mtu
|
||||
|
@ -114,4 +115,4 @@ class Ted5000Gateway:
|
|||
voltage = int(doc["LiveData"]["Voltage"]["MTU%d" % mtu]
|
||||
["VoltageNow"])
|
||||
|
||||
self.data[mtu] = {'W': power, 'V': voltage / 10}
|
||||
self.data[mtu] = {POWER_WATT: power, 'V': voltage / 10}
|
||||
|
|
|
@ -11,7 +11,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_NAME, CONF_PORT, CONF_MONITORED_CONDITIONS)
|
||||
CONF_HOST, CONF_NAME, CONF_PORT, CONF_MONITORED_CONDITIONS, POWER_WATT)
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -31,10 +31,10 @@ DEFAULT_PORT = 80
|
|||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=1)
|
||||
|
||||
SENSOR_TYPES = {
|
||||
'average': ['Average', 'W', 'mdi:power-off'],
|
||||
'average': ['Average', POWER_WATT, 'mdi:power-off'],
|
||||
'consumption': ['Consumption', 'Wh', 'mdi:power-plug'],
|
||||
'max': ['Max', 'W', 'mdi:arrow-up'],
|
||||
'min': ['Min', 'W', 'mdi:arrow-down'],
|
||||
'max': ['Max', POWER_WATT, 'mdi:arrow-up'],
|
||||
'min': ['Min', POWER_WATT, 'mdi:arrow-down'],
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
|
|
|
@ -4,6 +4,7 @@ from datetime import timedelta
|
|||
|
||||
from homeassistant.components.smappee import DATA_SMAPPEE
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import POWER_WATT
|
||||
|
||||
DEPENDENCIES = ['smappee']
|
||||
|
||||
|
@ -12,9 +13,10 @@ _LOGGER = logging.getLogger(__name__)
|
|||
SENSOR_PREFIX = 'Smappee'
|
||||
SENSOR_TYPES = {
|
||||
'solar':
|
||||
['Solar', 'mdi:white-balance-sunny', 'local', 'W', 'solar'],
|
||||
['Solar', 'mdi:white-balance-sunny', 'local', POWER_WATT, 'solar'],
|
||||
'active_power':
|
||||
['Active Power', 'mdi:power-plug', 'local', 'W', 'active_power'],
|
||||
['Active Power', 'mdi:power-plug', 'local', POWER_WATT,
|
||||
'active_power'],
|
||||
'current':
|
||||
['Current', 'mdi:gauge', 'local', 'A', 'current'],
|
||||
'voltage':
|
||||
|
|
|
@ -5,7 +5,7 @@ from typing import Optional, Sequence
|
|||
from homeassistant.const import (
|
||||
DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_TIMESTAMP, MASS_KILOGRAMS,
|
||||
TEMP_CELSIUS, TEMP_FAHRENHEIT)
|
||||
TEMP_CELSIUS, TEMP_FAHRENHEIT, POWER_WATT)
|
||||
|
||||
from . import SmartThingsEntity
|
||||
from .const import DATA_BROKERS, DOMAIN
|
||||
|
@ -85,7 +85,7 @@ CAPABILITY_TO_SENSORS = {
|
|||
'ovenSetpoint': [
|
||||
Map('ovenSetpoint', "Oven Set Point", None, None)],
|
||||
'powerMeter': [
|
||||
Map('power', "Power Meter", 'W', None)],
|
||||
Map('power', "Power Meter", POWER_WATT, None)],
|
||||
'powerSource': [
|
||||
Map('powerSource', "Power Source", None, None)],
|
||||
'refrigerationSetpoint': [
|
||||
|
|
|
@ -12,7 +12,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
|
||||
from homeassistant.const import (
|
||||
CONF_HOST, CONF_PASSWORD, CONF_USERNAME)
|
||||
CONF_HOST, CONF_PASSWORD, CONF_USERNAME, POWER_WATT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE
|
||||
|
||||
|
@ -25,7 +25,7 @@ DEFAULT_HOST = 'fritz.box'
|
|||
|
||||
ATTR_CURRENT_CONSUMPTION = 'current_consumption'
|
||||
ATTR_CURRENT_CONSUMPTION_UNIT = 'current_consumption_unit'
|
||||
ATTR_CURRENT_CONSUMPTION_UNIT_VALUE = 'W'
|
||||
ATTR_CURRENT_CONSUMPTION_UNIT_VALUE = POWER_WATT
|
||||
|
||||
ATTR_TOTAL_CONSUMPTION = 'total_consumption'
|
||||
ATTR_TOTAL_CONSUMPTION_UNIT = 'total_consumption_unit'
|
||||
|
|
|
@ -5,7 +5,7 @@ from homeassistant.components import sensor, tellduslive
|
|||
from homeassistant.components.tellduslive.entry import TelldusLiveEntity
|
||||
from homeassistant.const import (
|
||||
DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE,
|
||||
TEMP_CELSIUS)
|
||||
TEMP_CELSIUS, POWER_WATT)
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -33,7 +33,7 @@ SENSOR_TYPES = {
|
|||
SENSOR_TYPE_WINDAVERAGE: ['Wind average', 'm/s', '', None],
|
||||
SENSOR_TYPE_WINDGUST: ['Wind gust', 'm/s', '', None],
|
||||
SENSOR_TYPE_UV: ['UV', 'UV', '', None],
|
||||
SENSOR_TYPE_WATT: ['Power', 'W', '', None],
|
||||
SENSOR_TYPE_WATT: ['Power', POWER_WATT, '', None],
|
||||
SENSOR_TYPE_LUMINANCE: ['Luminance', 'lx', None, DEVICE_CLASS_ILLUMINANCE],
|
||||
SENSOR_TYPE_DEW_POINT:
|
||||
['Dew Point', TEMP_CELSIUS, None, DEVICE_CLASS_TEMPERATURE],
|
||||
|
|
|
@ -7,7 +7,7 @@ at https://home-assistant.io/components/sensor.zha/
|
|||
import logging
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.const import TEMP_CELSIUS, POWER_WATT
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from .core.const import (
|
||||
DATA_ZHA, DATA_ZHA_DISPATCHERS, ZHA_DISCOVERY_NEW, HUMIDITY, TEMPERATURE,
|
||||
|
@ -69,8 +69,8 @@ UNIT_REGISTRY = {
|
|||
TEMPERATURE: TEMP_CELSIUS,
|
||||
PRESSURE: 'hPa',
|
||||
ILLUMINANCE: 'lx',
|
||||
METERING: 'W',
|
||||
ELECTRICAL_MEASUREMENT: 'W',
|
||||
METERING: POWER_WATT,
|
||||
ELECTRICAL_MEASUREMENT: POWER_WATT,
|
||||
GENERIC: None
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,9 @@ ATTR_DEVICE_CLASS = 'device_class'
|
|||
ATTR_TEMPERATURE = 'temperature'
|
||||
|
||||
# #### UNITS OF MEASUREMENT ####
|
||||
# Power units
|
||||
POWER_WATT = 'W'
|
||||
|
||||
# Temperature units
|
||||
TEMP_CELSIUS = '°C'
|
||||
TEMP_FAHRENHEIT = '°F'
|
||||
|
|
Loading…
Reference in New Issue