diff --git a/src/data/ws-area_registry.ts b/src/data/ws-area_registry.ts index 43e3d1f13f35..550b9a5db803 100644 --- a/src/data/ws-area_registry.ts +++ b/src/data/ws-area_registry.ts @@ -1,12 +1,17 @@ import { Connection, createCollection } from "home-assistant-js-websocket"; import { Store } from "home-assistant-js-websocket/dist/store"; +import { stringCompare } from "../common/string/compare"; import { debounce } from "../common/util/debounce"; import { AreaRegistryEntry } from "./area_registry"; const fetchAreaRegistry = (conn: Connection) => - conn.sendMessagePromise({ - type: "config/area_registry/list", - }); + conn + .sendMessagePromise({ + type: "config/area_registry/list", + }) + .then((areas) => + areas.sort((ent1, ent2) => stringCompare(ent1.name, ent2.name)) + ); const subscribeAreaRegistryUpdates = ( conn: Connection,