Commit Graph

4 Commits

Author SHA1 Message Date
Grégoire Seux
85d4acb229 Migrate to SensorEntity base class
Goal is to be usable as a source of energy in the energy dashboard.
Starting with HA 2021.9 (still in beta), sensors will be have long term
stats and be usable in energy dashboard.
It also gives a better integration with base classes of home assistant
and decrease code in this custom component.

Change-Id: Ide1967ac181c0cf7f093cff539aae2b1cdccd9b4
2021-08-29 21:14:40 +02:00
Grégoire Seux
f40cf1bfec Support unique_id
Support is a bit fragile since we don't really have a serial number to
base on. However we have a reasonnable default (source prometheus +
expression) and a way for user to specify id easily if they to change
the prometheus query.
2021-08-29 21:14:40 +02:00
Grégoire Seux
4fbe9c5660 Support state class propoerty for sensor
Fix lfasci/homeassistant-prometheus-query#5

Goal is to make a first pass to allow to be exposed in the energy
dashboard.
This requires usage of HA version 2021.9 (which is beta at time of
writing) if we want to allow total_increase state_class
2021-08-29 21:14:40 +02:00
William Johansson
0c73f9932f Create custom_components root directory 2021-07-07 18:37:48 +02:00