Hi everyone,
I’m trying to set up custom SQL sensors in Home Assistant to pull data from my MySQL/MariaDB database. I’ve tried configuring the configuration.yaml
file, but the sensors aren’t showing up. I’ve confirmed the query works in DBeaver, but I’m stuck on the integration side.
Here’s the query I’m using:
sensor:
- platform: sql
db_url: sqlite:////homeassistant/energy_readings.db
queries:
- name: Energy Readings Total
query: SELECT readingsTotal FROM energy_readings ORDER BY timestamp DESC LIMIT 1
column: readingsTotal
unit_of_measurement: kWh
Any advice on debugging or tips for getting the sensor to display would be appreciated!