mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add humidifier support to prometheus (#37112)
* Add humidifier support to promethease * add humidifier dependency * handle dependencies * wrong place * applied suggestions from code review * fix typo * Revert "wrong place" This reverts commit58e509d767. * Revert "handle dependencies" This reverts commit74bd523e08. * Revert "add humidifier dependency" This reverts commit8840b378e5.
This commit is contained in:
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
||||
import pytest
|
||||
|
||||
from homeassistant import setup
|
||||
from homeassistant.components import climate, sensor
|
||||
from homeassistant.components import climate, humidifier, sensor
|
||||
from homeassistant.components.demo.sensor import DemoSensor
|
||||
import homeassistant.components.prometheus as prometheus
|
||||
from homeassistant.const import (
|
||||
@@ -44,6 +44,10 @@ async def prometheus_client(loop, hass, hass_client):
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await setup.async_setup_component(
|
||||
hass, humidifier.DOMAIN, {"humidifier": [{"platform": "demo"}]}
|
||||
)
|
||||
|
||||
sensor1 = DemoSensor(
|
||||
None, "Television Energy", 74, None, ENERGY_KILO_WATT_HOUR, None
|
||||
)
|
||||
@@ -120,6 +124,31 @@ async def test_view(prometheus_client): # pylint: disable=redefined-outer-name
|
||||
'friendly_name="HeatPump"} 25.0' in body
|
||||
)
|
||||
|
||||
assert (
|
||||
'humidifier_target_humidity_percent{domain="humidifier",'
|
||||
'entity="humidifier.humidifier",'
|
||||
'friendly_name="Humidifier"} 68.0' in body
|
||||
)
|
||||
|
||||
assert (
|
||||
'humidifier_state{domain="humidifier",'
|
||||
'entity="humidifier.dehumidifier",'
|
||||
'friendly_name="Dehumidifier"} 1.0' in body
|
||||
)
|
||||
|
||||
assert (
|
||||
'humidifier_mode{domain="humidifier",'
|
||||
'entity="humidifier.hygrostat",'
|
||||
'friendly_name="Hygrostat",'
|
||||
'mode="home"} 1.0' in body
|
||||
)
|
||||
assert (
|
||||
'humidifier_mode{domain="humidifier",'
|
||||
'entity="humidifier.hygrostat",'
|
||||
'friendly_name="Hygrostat",'
|
||||
'mode="eco"} 0.0' in body
|
||||
)
|
||||
|
||||
assert (
|
||||
'humidity_percent{domain="sensor",'
|
||||
'entity="sensor.outside_humidity",'
|
||||
|
||||
Reference in New Issue
Block a user