A Home Assistant Integration to display Quebec's Hospital ER Wait
  • Python 88.2%
  • JavaScript 11.8%
Find a file
2026-11-06 22:48:09 -05:00
custom_components/qc_hospital_wait Initial import 2026-11-06 22:48:09 -05:00
docs/images Initial import 2026-11-06 22:48:09 -05:00
examples Initial import 2026-11-06 22:48:09 -05:00
scripts Initial import 2026-11-06 22:48:09 -05:00
tests Initial import 2026-11-06 22:48:09 -05:00
.gitignore Initial import 2026-11-06 22:48:09 -05:00
hacs.json Initial import 2026-11-06 22:48:09 -05:00
pyproject.toml Initial import 2026-11-06 22:48:09 -05:00
README.md Initial import 2026-11-06 22:48:09 -05:00
requirements_test.txt Initial import 2026-11-06 22:48:09 -05:00

Québec ER Wait Times logo

Québec ER Wait Times for Home Assistant

See how busy Québec emergency rooms are, right in Home Assistant. Pick the hospitals you care about and each one becomes a device with sensors for stretcher occupancy, patients waiting to see a doctor, average length of stay, and more. You can also follow regional totals or the Québec-wide total.

Data comes from the Ministère de la Santé et des Services sociaux (MSSS) through Données Québec, and is updated every hour. The integration is available in English and French.

In an emergency, call 911. For a minor health problem, call Info-Santé 811 first. A quiet ER on paper doesn't mean you'll be seen faster: the data doesn't show staffing or triage priority.

Example dashboard: one hospital in detail, nearby ERs compared, Québec and Montréal gauges, a busiest-first ranking, and occupancy trends

The example dashboard, built only from Home Assistant's own cards. Readings are real (6 November 2026, 6 PM snapshot). The graph history is simulated for this screenshot.

Installation

  1. In HACS, open the menu and choose Custom repositories.
  2. Add this repository's URL with the category Integration.
  3. Search for Québec ER Wait Times, install it, and restart Home Assistant.

Manual

Copy custom_components/qc_hospital_wait into your Home Assistant config/custom_components/ folder and restart.

Or build a zip from this repository:

python3 scripts/build_zip.py

This creates dist/qc_hospital_wait-<version>.zip. Copy it to your Home Assistant config folder (the one with configuration.yaml), unzip it there, and restart. The zip already contains the custom_components/qc_hospital_wait/ folders, so it lands in the right place. With the Terminal & SSH add-on, for example:

cd /config && unzip -o qc_hospital_wait-0.1.0.zip && rm qc_hospital_wait-0.1.0.zip

The integration's icon and logo show in Home Assistant 2026.3 and later. Older versions show a generic placeholder; everything else works the same.

Setup

  1. Go to Settings → Devices & services → Add integration and search for Québec ER Wait Times.
  2. Pick one or more emergency rooms. Type to search by hospital or region name. Regional totals and Ensemble du Québec are at the top of each region.

To change your picks later, open the integration and click Configure. You can also change the update interval there (default 15 minutes, from 5 to 120). Hospitals you remove are cleaned up along with their sensors.

Sensors

Each picked facility gets these sensors:

Sensor What it means
Stretcher occupancy Patients on stretchers ÷ functional stretchers, in %. Often over 100% because overflow stretchers count.
Patients on stretchers Patients on a stretcher right now, including those waiting for a hospital bed.
Functional stretchers Stretchers the ER is approved to run (excludes overflow).
Patients on stretchers over 24 h Patients who have been in the ER for 24 hours or more.
Patients on stretchers over 48 h Same, 48 hours or more.
Patients in the ER Everyone in the ER: waiting room and stretchers.
Patients waiting for a doctor Patients who haven't seen a doctor yet.
Average stay (walk-in) Average time from arrival to leaving for walk-in patients, yesterday, in hours.
Average stay (stretcher) Same, for stretcher patients, yesterday, in hours.
Data as of When the snapshot was taken (diagnostic).

Some hospitals sometimes report "no information available". Their sensors show unknown until data comes back.

How fresh is the data?

MSSS takes a snapshot on the hour and publishes it 45 minutes later. Données Québec copies it on its next hourly cycle, so readings are usually 1 to 2 hours old. Check the Data as of sensor to see the exact time. Polling more often than every 15 minutes won't get you newer data.

Dashboard examples

These use only cards that come with Home Assistant, including recent additions: tile features (bar gauge, trend graph), the distribution card, card naming, section backgrounds, the view footer and the shortcut card. They were checked against the current frontend in November 2026, so you'll need an up-to-date Home Assistant.

Entity IDs

Each sensor's ID is sensor.<hospital>_<sensor>, for example sensor.hopital_general_juif_stretcher_occupancy. The <sensor> part depends on the language Home Assistant was set to when you added the hospital:

Sensor English French
Stretcher occupancy stretcher_occupancy taux_d_occupation_des_civieres
Patients on stretchers patients_on_stretchers patients_sur_civiere
Functional stretchers functional_stretchers civieres_fonctionnelles
Over 24 h patients_on_stretchers_over_24_h patients_sur_civiere_depuis_plus_de_24_h
Over 48 h patients_on_stretchers_over_48_h patients_sur_civiere_depuis_plus_de_48_h
Patients in the ER patients_in_the_er patients_presents_a_l_urgence
Waiting for a doctor patients_waiting_for_a_doctor patients_en_attente_d_un_medecin
Average stay (walk-in) average_stay_walk_in duree_moyenne_de_sejour_ambulatoire
Average stay (stretcher) average_stay_stretcher duree_moyenne_de_sejour_civiere
Data as of data_as_of donnees_en_date_de

Totals use montreal_total_regional (and so on for each region) and ensemble_du_quebec. If in doubt, check Settings → Entities.

A card: your ER at a glance

A tile with a bar gauge and a two-day trend line. The gauge goes to 250% because busy ERs are often well over 100%.

Tile card for Hôpital Général Juif at 260.4%, with a full orange bar gauge and a trend line
type: tile
entity: sensor.hopital_general_juif_stretcher_occupancy
name:
  type: device
icon: mdi:hospital-building
color: deep-orange
features_position: bottom
features:
  - type: bar-gauge
    min: 0
    max: 250
  - type: trend-graph
    hours_to_show: 48
    detail: false

A section: everything about your ER

A tinted section with the snapshot time in the heading, a warning that only appears when the ER is over 150%, and every sensor laid out in pairs. To add it, edit your dashboard, create a section, open its menu, choose Edit in YAML and paste this in.

Section for Hôpital Général Juif: a very-busy warning, occupancy with gauge and trend, patients waiting and in the ER, average stays, and patients on stretchers over 24 and 48 hours
type: grid
background:
  color: deep-orange
  opacity: 15
cards:
  - type: heading
    heading: Hôpital Général Juif
    icon: mdi:hospital-building
    badges:
      - type: entity
        entity: sensor.hopital_general_juif_data_as_of
        show_state: true
  - type: markdown
    text_only: true
    content: >-
      <ha-alert alert-type="warning" title="This ER is very busy">
      Over 150% of its stretchers are in use. For something minor,
      call Info-Santé 811 first.</ha-alert>
    visibility:
      - condition: numeric_state
        entity: sensor.hopital_general_juif_stretcher_occupancy
        above: 150
  - type: tile
    entity: sensor.hopital_general_juif_stretcher_occupancy
    name:
      type: entity
    color: deep-orange
    features:
      - type: bar-gauge
        min: 0
        max: 250
      - type: trend-graph
        hours_to_show: 48
        detail: false
    grid_options:
      columns: full
  - type: tile
    entity: sensor.hopital_general_juif_patients_waiting_for_a_doctor
    name: Waiting
    color: amber
    features:
      - type: trend-graph
  - type: tile
    entity: sensor.hopital_general_juif_patients_in_the_er
    name: In the ER
    color: blue
    features:
      - type: trend-graph
  - type: heading
    heading: Average stay yesterday
    heading_style: subtitle
  - type: tile
    entity: sensor.hopital_general_juif_average_stay_walk_in
    name: Walk-in
    icon: mdi:walk
    color: teal
  - type: tile
    entity: sensor.hopital_general_juif_average_stay_stretcher
    name: On a stretcher
    color: indigo
  - type: heading
    heading: On a stretcher for
    heading_style: subtitle
  - type: tile
    entity: sensor.hopital_general_juif_patients_on_stretchers_over_24_h
    name: Over 24 h
    color: red
  - type: tile
    entity: sensor.hopital_general_juif_patients_on_stretchers_over_48_h
    name: Over 48 h
    color: pink

A section: your ERs, shortest wait first

Every hospital you picked, ranked by average walk-in stay yesterday, with a bar to compare and how many people are waiting right now. MSSS doesn't publish a "time to see a doctor", so walk-in stay (arrival to leaving) is the closest measure. You don't need to edit it: it finds your hospitals on its own, in English or French, and skips regional totals.

Ranking of three Montréal hospitals by walk-in stay, with medals, bars and patients waiting
type: grid
background:
  color: teal
  opacity: 15
cards:
  - type: heading
    heading: Shortest walk-in stay
    icon: mdi:sort-clock-ascending
  - type: markdown
    grid_options:
      columns: full
    content: |
      {%- set walk_in = ('average_stay_walk_in', 'duree_moyenne_de_sejour_ambulatoire') -%}
      {%- set waiting = ('patients_waiting_for_a_doctor', 'patients_en_attente_d_un_medecin') -%}
      {%- set ns = namespace(rows=[]) -%}
      {%- for entity_id in integration_entities('qc_hospital_wait')
            if entity_id.endswith(walk_in) and states(entity_id) | is_number
            and device_attr(entity_id, 'manufacturer') -%}
        {%- set device = device_id(entity_id) -%}
        {%- set waiting_id = device_entities(device) | select('search', waiting | join('$|') ~ '$') | first -%}
        {%- set ns.rows = ns.rows + [dict(
              name=device_attr(device, 'name_by_user') or device_attr(device, 'name'),
              stay=states(entity_id) | float,
              waiting=states(waiting_id) if waiting_id else '–')] -%}
      {%- endfor -%}
      {%- set rows = ns.rows | sort(attribute='stay') -%}
      {%- set longest = rows | map(attribute='stay') | max if rows else 1 -%}
      | | Emergency room | Walk-in stay | Waiting |
      |:-:|:--|:--|--:|
      {%- for row in rows %}
      {%- set minutes = (row.stay * 60) | round | int %}
      {%- set filled = [(row.stay / longest * 10) | round | int, 1] | max %}
      | {{ ['🥇', '🥈', '🥉'][loop.index0] if loop.index <= 3 else loop.index }} | {{ row.name }} | {{ minutes // 60 }} h {{ '%02d' | format(minutes % 60) }} {{ '▰' * filled ~ '▱' * (10 - filled) }} | {{ row.waiting }} |
      {%- endfor %}

      <sub>Walk-in stay: average time from arrival to leaving, yesterday. Waiting: people not yet seen by a doctor, right now.</sub>

Tip: add column_span: 3 to the section to stretch it across the top of your dashboard, like in the full dashboard below.

A full dashboard

examples/dashboard.yaml is a complete sections dashboard. Create a new dashboard, open the Raw configuration editor and paste it in. It has:

  • A header with the snapshot time and badges for Québec, Montréal, patients waiting province-wide, and a tap-to-call Info-Santé 811 button.
  • At a glance: two leaderboards across the top: the "shortest wait first" ranking above, and a Busiest right now table that ranks every ER you follow by occupancy. Both find the sensors on their own, so they work in any language and don't need editing.
  • The "your ER" section above.
  • Nearby ERs: three hospitals side by side with inline bar gauges, plus a distribution bar showing where people are waiting for a doctor.
  • Trends: occupancy over 48 hours and the daily average walk-in stay over 30 days.
  • Province: needle gauges for Québec and Montréal.
  • A sticky footer: "Not an emergency? Call Info-Santé 811".

The green, orange and red bands (under 90%, up to 120%, above) are our own choice, not an official scale.

On a phone, the sections stack and the 811 footer stays on screen:

The dashboard on a phone: header badges, the hospital section, and the Info-Santé 811 footer

Optional: a pulsing alert

The alert card and alert badge only accept on/off entities, so first create a template binary sensor: Settings → Devices & services → Helpers → Create helper → Template → Binary sensor. Name it JGH ER overloaded, set the device class to Problem, and use this state template:

{{ states('sensor.hopital_general_juif_stretcher_occupancy') | float(0) > 150 }}

Then add an alert card that pulses only while it's on:

type: alert
entity: binary_sensor.jgh_er_overloaded
name: Hôpital Général Juif is overloaded
alert_color: deep-orange
pulse: true
visibility:
  - condition: state
    entity: binary_sensor.jgh_er_overloaded
    state: "on"

Automation example

Notify when your ER is overloaded

automation:
  - alias: "ER overloaded"
    triggers:
      - trigger: numeric_state
        entity_id: sensor.hopital_de_matane_stretcher_occupancy
        above: 150
    actions:
      - action: notify.notify
        data:
          message: "Hôpital de Matane ER is at {{ states('sensor.hopital_de_matane_stretcher_occupancy') }}% occupancy."

Troubleshooting

  • "... is no longer reported" repair: a hospital you picked dropped out of the data. This is often temporary. If it stays, remove it in the integration options.
  • Sensors unavailable: Données Québec couldn't be reached. The integration retries on its own.
  • Diagnostics: open the integration, click the three dots, and choose Download diagnostics when reporting a problem.

Development

python3 -m venv .venv
.venv/bin/pip install -r requirements_test.txt
.venv/bin/pytest
.venv/bin/ruff check . && .venv/bin/ruff format --check .

To regenerate the screenshots in this README, see scripts/screenshots.

The icon and logo live in custom_components/qc_hospital_wait/brand/. To change them, edit scripts/brand/icon.svg (the wordmark text and colors are at the top of make_brand.py), then run:

.venv/bin/python scripts/brand/make_brand.py

Data and license

Emergency room data: © Gouvernement du Québec, MSSS, published on Données Québec under CC BY 4.0. Every sensor carries this attribution. This project isn't affiliated with the Government of Québec, Santé Québec or MSSS.