Home Assistant

Using QueryCal with Home Assistant #

QueryCal runs a MySQL-compatible server that you can connect to using any MySQL client. This means you can use it as a Home Asssistant sensor using the built-in SQL integration.

For example, here’s how you can set up a sensor for the number of calendar events today:

# Example configuration.yaml
sensor:
  - platform: sql
    db_url: mysql://user_id:access_token@querycal.com/events
    queries:
      - name: Number of calendar events today
        query: "SELECT count(*) as event_count FROM events WHERE date(start) = date('now')"
        column: "event_count"
Although QueryCal is set up as a MySQL datasource, an SQLite database engine is still used to execute your query. You won’t be able to use any MySQL-specific features in your queries.