From c595cf016f0e6e56d2990a8bc08e9749b8a0edf5 Mon Sep 17 00:00:00 2001 From: Richard Mitchell Date: Sat, 23 Feb 2019 17:13:27 +0000 Subject: [PATCH] Support the person component in Prometheus (#21363) --- homeassistant/components/prometheus/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/homeassistant/components/prometheus/__init__.py b/homeassistant/components/prometheus/__init__.py index 65c1fbc4eb0..9053a872134 100644 --- a/homeassistant/components/prometheus/__init__.py +++ b/homeassistant/components/prometheus/__init__.py @@ -151,6 +151,15 @@ class PrometheusMetrics: value = state_helper.state_as_number(state) 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): metric = self._metric( 'light_state',