Add input_boolean reporting to Prometheus (#17966)
This commit is contained in:
parent
1aba4699b9
commit
e3a8f3a106
1 changed files with 9 additions and 0 deletions
|
@ -138,6 +138,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_input_boolean(self, state):
|
||||||
|
metric = self._metric(
|
||||||
|
'input_boolean_state',
|
||||||
|
self.prometheus_client.Gauge,
|
||||||
|
'State of the input boolean (0/1)',
|
||||||
|
)
|
||||||
|
value = state_helper.state_as_number(state)
|
||||||
|
metric.labels(**self._labels(state)).set(value)
|
||||||
|
|
||||||
def _handle_device_tracker(self, state):
|
def _handle_device_tracker(self, state):
|
||||||
metric = self._metric(
|
metric = self._metric(
|
||||||
'device_tracker_state',
|
'device_tracker_state',
|
||||||
|
|
Loading…
Add table
Reference in a new issue