What type of database are you using?
Here is my config:
recorder:
purge_interval: 1
purge_keep_days: 5
db_url: mysql://hass_db:[email protected]:3306/hass_db?charset=utf8
Check information_schema.tables in MySQL and see if there’s anything in there.
I have no idea how to check that.
Configuration of the DB is done via phpMyAdmin with the following interface options:
Looks like the sensor queries a sqlite database.
Have you tried it with the db_url
?
EDIT:
Same problem here.
Works when providing the db_url.
No difference if the db_url is in configuration.yaml or provided in secrets.yaml.
The sensor does not read it.
cc @dgomes
Yes, same when I provide the URL.
It has something to do with the table query but, I have no idea what the query should be.
**no such table:** information_schema.tables [SQL: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1024, 1) "value" FROM information_schema.tables WHERE table_schema="hass_db" GROUP BY table_schema LIMIT 1;'] (Background on this error at: http://sqlalche.me/e/e3q8)
Very strange since I’ve got the very same scenario (MySQL db in my QNAP accessed external from HA on a RPI3)
Can you run the query in phpMyAdmin while logged as user: hass_db ?
You are indeed missing the table. Here’s a list of mine:
As you can see, the table information_schema
is present in my setup. I’m just not sure how it got there, to be quite honest…
remove the ’ from the beginning and end
I actualy have that as well"
Yeah, I just realised your printscreen shows what’s inside hass_db. My bad…
You logged into phpMyAdmin with which user ?
My guess is you don’t have permission to query the information_schema.tables
Is your SQL Sensor working with the default config?
The default db_url literally points to the default sqlite file (not to the currently used db_url in the recorder)
Point being that it makes life easier for newbies, but the sensor is NOT exclusive to the recorder DB
This means the user/password used in the db_url can’t see the information_schema.tables
can you try with user root ?
This assures that the SQL query is right… the issue has to be on the db_url / user / password