diff --git a/CODEOWNERS b/CODEOWNERS index 8af5a8216a6e27..d76b0abc8a8080 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -96,6 +96,7 @@ homeassistant/components/eight_sleep/* @mezz64 homeassistant/components/elgato/* @frenck homeassistant/components/elv/* @majuss homeassistant/components/emby/* @mezz64 +homeassistant/components/emoncms/* @borpin homeassistant/components/enigma2/* @fbradyirl homeassistant/components/enocean/* @bdurrer homeassistant/components/entur_public_transport/* @hfurubotten diff --git a/homeassistant/components/emoncms/manifest.json b/homeassistant/components/emoncms/manifest.json index 83833d4f79bc5c..b9c012d6e730b0 100644 --- a/homeassistant/components/emoncms/manifest.json +++ b/homeassistant/components/emoncms/manifest.json @@ -4,5 +4,5 @@ "documentation": "https://www.home-assistant.io/integrations/emoncms", "requirements": [], "dependencies": [], - "codeowners": [] + "codeowners": ["@borpin"] } diff --git a/homeassistant/components/emoncms/sensor.py b/homeassistant/components/emoncms/sensor.py index 4f214d697f31e1..c07544058402ff 100644 --- a/homeassistant/components/emoncms/sensor.py +++ b/homeassistant/components/emoncms/sensor.py @@ -37,7 +37,6 @@ DECIMALS = 2 DEFAULT_UNIT = POWER_WATT - MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=5) ONLY_INCL_EXCL_NONE = "only_include_exclude_or_none" @@ -73,7 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): url = config.get(CONF_URL) sensorid = config.get(CONF_ID) value_template = config.get(CONF_VALUE_TEMPLATE) - unit_of_measurement = config.get(CONF_UNIT_OF_MEASUREMENT) + config_unit = config.get(CONF_UNIT_OF_MEASUREMENT) exclude_feeds = config.get(CONF_EXCLUDE_FEEDID) include_only_feeds = config.get(CONF_ONLY_INCLUDE_FEEDID) sensor_names = config.get(CONF_SENSOR_NAMES) @@ -105,6 +104,12 @@ def setup_platform(hass, config, add_entities, discovery_info=None): if sensor_names is not None: name = sensor_names.get(int(elem["id"]), None) + unit = elem.get("unit") + if unit: + unit_of_measurement = unit + else: + unit_of_measurement = config_unit + sensors.append( EmonCmsSensor( hass,