File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
custom_components/prometheus_sensor Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
13from dataclasses import dataclass
24import logging
3- from typing import Final , Optional
5+ from typing import TYPE_CHECKING , Final , Optional
46from urllib .parse import urljoin
57
68import aiohttp
79
810from homeassistant .const import STATE_PROBLEM , STATE_UNKNOWN
11+ from homeassistant .helpers .reload import async_setup_reload_service
12+
13+ if TYPE_CHECKING :
14+ from homeassistant .core import HomeAssistant
15+ from homeassistant .helpers .typing import ConfigType
16+
17+ from .const import DOMAIN , PLATFORMS
918
1019_LOGGER : Final = logging .getLogger (__name__ )
1120
1221
22+ async def async_setup (hass : HomeAssistant , config : ConfigType ) -> bool :
23+ """Set up the prometheus-sensor integration."""
24+ await async_setup_reload_service (hass , DOMAIN , PLATFORMS )
25+ return True
26+
27+
1328@dataclass (frozen = True )
1429class QueryResult :
1530 value : Optional [float ] = None
Original file line number Diff line number Diff line change 11from datetime import timedelta
22from typing import Final
33
4+ DOMAIN = "prometheus_sensor"
5+ PLATFORMS = ["binary_sensor" , "sensor" ]
6+
47# Match the default scrape_interval in Prometheus
58SCAN_INTERVAL : Final = timedelta (seconds = 15 )
69
You can’t perform that action at this time.
0 commit comments