I’m using the SQL integration to pull some values from a database - however when I try to graph this in Lovelace with the history card I get a timeline view rather that the expected history graph. Can anyone explain why this is so and how I can fix it?
Welcome!
Make sure to add a ‘unit_of_measurement’ attribute to the sensor, does not matter what the text of the attribute is… “RPM”, “ppm”, “whatever”
# postgresql database size in megabytes
- platform: sql
db_url: !secret postgres_url
queries:
- name: Database Size
query: "SELECT (pg_database_size('homeassistant')/1024/1024) as db_size;"
column: 'db_size'
unit_of_measurement: MB
2 Likes
Brilliant - thankyou!
Would you like to share your sql sensor and card config, please?
I am doing an sql query which is returning one row of values (datetime & INT). My history graph says that there is no history to show.
Do I have to add the sql sensor to the recorder as well?