Commit graph

55 commits

Author SHA1 Message Date
Erik Montnemery
5dfb9cddd6
Sort manifests 8 (#87029) 2023-02-08 20:13:46 +01:00
Franck Nijhof
e738924780
Enable Ruff SIM105 (#86759)
* Enable Ruff SIM105

* Adjust existing cases
2023-01-26 21:06:22 -05:00
Matt Gerega
2215adf5cf
Add support for covers in Prometheus metrics (#83763)
fixes undefined
2022-12-27 11:25:33 +01:00
Michael
8a3fc2e82b
Fix attribute check in prometheus exporter (#84321)
* fix attribute check

* add test
2022-12-20 16:32:00 -08:00
epenet
ba043c9ebb
Use UnitOfTemperature in integrations (p-s) (#84308) 2022-12-20 18:47:27 +01:00
epenet
ac7b4e7569
Make temperature conversions private (#79349) 2022-09-30 11:07:10 +02:00
epenet
24c26dc032
Use unit_conversion in components (#79204)
* Use unit_conversion in components

* Two more
2022-09-28 16:05:31 +02:00
epenet
ff356205bf
Use platform constants from root (#78032) 2022-09-08 12:24:45 +02:00
epenet
e2568d8375
Import climate constants from root [m-z] (#78020) 2022-09-08 10:34:44 +02:00
epenet
bdba3e193e
Use climate enums in prometheus (#70772) 2022-04-26 11:43:45 +02:00
J. Nick Koston
5b755b74fb
Add loggers to integration manifest.json (#65083) 2022-01-28 13:37:53 -08:00
alim4r
3e0e9e54bf
Fix duplicate metrics in prometheus (#61355)
* Fix duplicate metrics in prometheus

* Fix duplicate prometheus metrics for entities with multiple labelsets
- Move friendly_name detection to state_changed event
- Add additional test case

* Add review suggestions for prometheus friendly name update

* Remove commented out code in prometheus

* Update prometheus tests for deleted metrics

* Add review suggestions for prometheus
- Remove unnecessary firendly_name check in handle_entity_registry_updated
- Add assert in test
2022-01-25 08:05:52 -08:00
Renat Nurgaliyev
d11f2b5151
Add HVAC modes of climate entities to Prometheus exporter (#62144) 2022-01-19 14:49:29 +01:00
Jevgeni Kiski
6af99882c5
Prometheus to support input_number (#58964)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2022-01-04 18:52:43 +01:00
Renat Nurgaliyev
f71d49230d
Add counter entities support to Prometheus component (#62410) 2022-01-04 17:34:05 +01:00
epenet
0d7b531285
Add init type hints [p-q] (#63191)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2022-01-02 16:35:23 +01:00
alim4r
7d256f56c5
Refactor Prometheus tests (#60451)
* Removed prometheus from .coveragerc

* Update prometheus tests with handler categories

* Updated prometheus metrics to use the current registry
- don't use the registry created on import (needed for tests)

* Reset the prometheus CollectorRegistry before every test

* Update prometheus metrics generation
- Use latest registry when generating a response

* Add default collectors when resetting the registry

* Move entities to the specific prometheus test case

* Refactor body generation for prometheus tests

* Add test case for sensors without unit after rebase

* Fix prometheus tests
- Wait for events in prometheus tests
- Add workaround for demo platform dependecy conversation (aiohttp frozen router)

* Added prometheus tests for attribute metrics

* Added prometheus tests for binary_sensor

* Add prometheus test for input_boolean

* Add prometheus test for lights

* Add prometheus test for lock

* Add prometheus test for sensor fahrenheit conversion

* Fix prometheus test for input_number
2021-12-08 20:18:21 +01:00
alim4r
42389fc81b
Support numeric sensors with no unit_of_measurement in prometheus (#60157) 2021-11-24 22:30:08 +01:00
alim4r
e180f1e302
Add input_number state to prometheus metrics (#56507)
* Add input_number to prometheus metrics

* Add prometheus input_number tests

* Removed unused import from test
2021-11-17 19:35:48 -08:00
Marc Mueller
4513ee4ea5
Use assignment expressions 12 (#57937) 2021-10-20 14:34:08 -07:00
Matt Zimmerman
515a47212e
Add target high/low temperatures to prometheus integration (#50071)
* add target high/low temperatures to prometheus integration

* use labels

* Revert "use labels"

This reverts commit 09c56d6359.

* fix naming

* tests

* cleanup

* use three separate metrics

* fix descriptions
2021-08-04 07:42:47 +02:00
Anton Tolchanov
80aaebb761
Rename Prometheus metrics to conform with naming guidelines (#50156) 2021-07-26 20:52:30 +02:00
Christopher Masto
5d3f3c756f
Fix Fahrenheit to Celsius conversion in Prometheus exporter (#52212)
const.TEMP_FAHRENHEIT is "°F", but _unit_string converts this to "c",
so the comparison never succeeds and we end up with temperatures in F
but labeled C.
2021-06-28 09:19:49 +02:00
Franck Nijhof
055cdc64c0
Add support for IoT class in manifest (#46935) 2021-04-15 10:21:38 +02:00
Antoine Meillet
4dc0cdbb5f
Ignore STATE_UNKNOWN in prometheus (#47840)
Giving a value of 0 by default can lead to erroneous
data being exported. For example, if a MQTT temperature
sensor is in `STATE_UNKNOWN` (which can happen after a
HASS restart), a temperature of 0°C will be exported.
Some user might prefer no value rather than a wrong one.
2021-03-16 16:11:51 +01:00
tkdrob
ab53b49d3f
Clean up constants (#46948)
* Clean up constants

* clean up humidifier constants

* fix tests

* fix prometheus tests

Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
2021-03-02 12:52:00 +01:00
Ville Skyttä
5e90a4d000
Use more state attribute name constants (#40428) 2020-09-21 23:03:39 +02:00
springstan
d2b1918e9c
Drop UNIT_ prefix for percentage constant (#39383) 2020-09-05 21:09:14 +02:00
Franck Nijhof
1c2ebdf307
Upgrade black to 20.8b1 (#39287) 2020-08-27 13:56:20 +02:00
Martin Weinelt
2e4b4dc188
prometheus: Reduce loglevel of failed float conversion to debug (#37936)
It creates alot of useless noise currently.

Fixes #30186
2020-07-17 20:18:35 +02:00
Eric Severance
16a947aa5f
Add generic unavailable and last_updated metrics for prometheus (#37456)
* Add generic unavailable and last_updated metrics for prometheus

* Updated with feedback from the code review
2020-07-12 21:27:33 +02:00
Shulyaka
872140123d
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 commit 58e509d767.

* Revert "handle dependencies"

This reverts commit 74bd523e08.

* Revert "add humidifier dependency"

This reverts commit 8840b378e5.
2020-07-08 20:42:45 -04:00
Anton Tolchanov
6ca476fe21
Add prometheus metric naming guidelines (#37149)
* Add prometheus metric naming guidelines.

* Update homeassistant/components/prometheus/README.md

Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>

Co-authored-by: Martin Weinelt <mweinelt@users.noreply.github.com>
2020-07-05 19:00:37 +02:00
craiggenner
212660330f
Cope with attribute errors being converted (#36911) 2020-06-19 05:36:56 +02:00
Anton Tolchanov
0bf64e9a2c
Add @knyar as a codeowner for prometheus integration (#36487) 2020-06-05 21:29:06 +02:00
Anton Tolchanov
d14112748c
Add a Prometheus metric for HVAC action (#31945) 2020-06-03 11:53:21 +02:00
Martin Weinelt
acfd907c50
Expose switch attributes in Prometheus component (#35216) 2020-06-02 22:47:49 +02:00
Nacho Barrientos
a55c6c5f47
Make prometheus light state report robust (#36134) 2020-05-27 09:59:40 +02:00
springstan
f1a0ca7cd3
Add and use percentage constant (#32094)
* Add and use percentage constant

* Fix pylint error and broken test
2020-02-28 11:46:48 -08:00
Christian Clauss
df7d2b3aeb
Fix typos found by codespell (#31243)
* Fix typos found by codespell

* Fix typos found by codespell

* codespell: Furture  ==> Future

* Update test_config_flow.py

* Update __init__.py

* Spellcheck: successfull  ==> successful

* Codespell: unsuccesful  ==> unsuccessful

* Codespell: cant  ==> can't

* Codespell: firware ==> firmware

* Codespell: mimick  ==> mimic
2020-01-31 08:33:00 -08:00
Joe Gross
3b4c3e6e17 Fix prometheus component to fully sanitize Unicode characters (#31037)
* Fix prometheus component to fully santize Unicode characters.

Sanitization used isdigit() to match numerics but that also matches 
Unicode "digit" characters that require special handling, like 
superscripts. Failures would look like this:

ValueError: Invalid metric name: sensor_unit_u0x23_per_m³

Changed sanitize to use string.digits, which matches only ascii digits, 
and added test.

See 
https://stackoverflow.com/questions/44891070/whats-the-difference-between-str-isdigit-isnumeric-and-isdecimal-in-python 
for discussion.

https://docs.python.org/3/library/stdtypes.html#str.isdigit

https://docs.python.org/3.7/library/string.html#string.digits

* fix formatting to comply with black
2020-01-22 01:03:42 +01:00
Franck Nijhof
a84741392b
Format all manifests with prettier (#30521) 2020-01-06 21:28:23 +01:00
springstan
4f8200d15a Ignore state of climate entities in prometheus (#29346) 2019-12-03 12:54:25 -08:00
Diefferson Koderer Môro
2d36e9c08e Move imports in prometheus component (#28086) 2019-10-21 22:35:43 -07:00
Franck Nijhof
c7da781efc Update documentation link URL for integrations in all manifests (#27114) 2019-10-02 09:25:44 -07:00
Andrew Rowson
770eeaf82f Encode prometheus metric names per the prom spec (#26639)
Referencing issue #26418.

Prometheus metric names can only contain chars a-zA-Z0-9, : and _
(https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels).

HA currently generates invalid prometheus names, e.g. if the unit for a
sensor is a non-ASCII character containing  ° or μ. To resolve, we need
to sanitize the name before creating, replacing non-valid characters
with a valid representation. In this case, I've used
"u{unicode-hex-code}".

Also updated the test case to make sure that the ° case is handled.
2019-09-19 12:51:49 +02:00
Per Osbäck
e9705af055 Prometheus metrics naming based on device_class and unit_of_measurement (#24103)
* - Change how we extract the metrics for sensors
- Add component filtering as seen in influxdb
- Add metric override as seen in influxdb
- Add more unit tests with actual device data

* Extract sensor metric logic to separate handlers

* Update prometheus dependency

* Format using black

* Format using black

* Fix flake8

* Move sensor metric handler list to init

* Use f strings instead of .format
2019-08-10 14:35:04 +02:00
Paulus Schoutsen
4de97abc3a Black 2019-07-31 12:25:30 -07:00
cgtobi
2c07bfb9e0 Remove dependencies and requirements (#23024)
* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit fe7171b4cd.

* Remove dependencies and requirements

* Revert "Remove dependencies and requirements"

This reverts commit 391355ee2c.

* Remove dependencies and requirements

* Fix flake8 complaints

* Fix more flake8 complaints

* Revert non-component removals
2019-04-12 10:13:30 -07:00
Paulus Schoutsen
cfe4cf30ad
Add manifests (#22699)
* Add manifests

* Update auto name

* Update codeowners

* Add requirements from platforms

* Minor cleanup

* Incorporate changes from awarecan PR
2019-04-03 21:14:45 -07:00