mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Support the person component in Prometheus (#21363)
This commit is contained in:
parent
d027965304
commit
c595cf016f
@ -151,6 +151,15 @@ class PrometheusMetrics:
|
|||||||
value = state_helper.state_as_number(state)
|
value = state_helper.state_as_number(state)
|
||||||
metric.labels(**self._labels(state)).set(value)
|
metric.labels(**self._labels(state)).set(value)
|
||||||
|
|
||||||
|
def _handle_person(self, state):
|
||||||
|
metric = self._metric(
|
||||||
|
'person_state',
|
||||||
|
self.prometheus_client.Gauge,
|
||||||
|
'State of the person (0/1)',
|
||||||
|
)
|
||||||
|
value = state_helper.state_as_number(state)
|
||||||
|
metric.labels(**self._labels(state)).set(value)
|
||||||
|
|
||||||
def _handle_light(self, state):
|
def _handle_light(self, state):
|
||||||
metric = self._metric(
|
metric = self._metric(
|
||||||
'light_state',
|
'light_state',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user