Independent directory, made by the developer of Vulpo. Not affiliated with Home Assistant or the Open Home Foundation.

About

SQL is a built-in Home Assistant integration that turns the results of SQL queries into sensors. Each sensor runs a query that must start with SELECT and uses a chosen column of the result as its state. Optional settings cover the unit of measurement, device class, state class and a value template that extracts a value from the result. The database URL can be left empty, in which case the Home Assistant Recorder database is queried. An action is also available that executes a SQL query and returns the result. Repair notices can appear when a query does a full table scan, and the integration works locally and is set up in the UI.

Automatic summary of Home Assistant's source code. Something wrong? Get in touch

Supports

  • Works locally Talks to your devices on your own network. No vendor cloud in between.

  • Set up in the UI Add it in Settings, Devices and services. Nothing to download.

  • Updated with Home Assistant Ships and updates with every Home Assistant release.

Provides

  • Sensors

Setting it up

It is added under Settings, Devices and services, with Add integration.

Connect

  • Database URLLeave empty to use Home Assistant Recorder database
  • NameName that will be used for config entry and also the sensor

Options

  • ColumnColumn for returned query to present as state
  • Select queryQuery to run, needs to start with 'SELECT'
  • Device classThe type/class of the sensor to set the icon in the frontend
  • State classThe state class of the sensor
  • Unit of measurementThe unit of measurement for the sensor (optional)
  • Value templateTemplate to extract a value from the payload (optional)

After setup

  • ColumnColumn for returned query to present as state
  • Select queryQuery to run, needs to start with 'SELECT'
  • Device classThe type/class of the sensor to set the icon in the frontend
  • State classThe state class of the sensor
  • Unit of measurementThe unit of measurement for the sensor (optional)
  • Value templateTemplate to extract a value from the payload (optional)

Texts from Home Assistant's source code, Apache License 2.0.

Actions

  • QueryExecutes a SQL query and returns the result.Fields: Database URL, Query

Troubleshooting

  • Repair noticesNotices it can show in Settings, Repairs:SQL query does full table scan

Shows in Vulpo

Chart card, Apple Watch.

Information

Installs
9.2k sharing analytics
Connection
Works locally
Upkeep
Part of Home Assistant
Category
DIY and makers, Web and data connectors
Kind
Built-in integration
Needs
Built into Home Assistant
Domain
sql

You might also like

Independent directory, made by the developer of Vulpo. Not affiliated with Home Assistant or the Open Home Foundation. About these numbers