This is a custom component for quering Prometheus values with Home Assistant.
- Install this Integration as a HACS custom repository or just copy the content of the custom_components folder.
- Add a query by navigating to Configuration -> Integrations -> Add Integration and search for PromQL
The integration will create a seperate sensor for each combination of labels.
You can also use complex PromQL queries like e.g.
100 - (avg by (instance) (irate(node_cpu_seconds_total{job="node",mode="idle"}[5m])) * 100)