Releases: home-assistant/home-assistant-js-websocket
Releases · home-assistant/home-assistant-js-websocket
3.2.1
3.2.0
Now possible to get collection objects, instead of just subscribing to them.
// Will only initialize one collection per connection.
getCollection<State>(
conn: Connection,
key: string,
fetchCollection: (conn: Connection) => Promise<State>,
subscribeUpdates: (
conn: Connection,
store: Store<State>
) => Promise<UnsubscribeFunc>,
): Collection<State>
// Returns object with following type
class Collection<State> {
state: State;
async refresh(): Promise<void>;
subscribe(subscriber: (state: State) => void): UnsubscribeFunc;
}You can also import the service, config and entities collections:
import { entitiesColl, servicesColl, configColl } from 'home-assistant-js-websocket';Commits
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
What's Changed
- fetch call add credentials:'same-origin' to avoid omit cookie (#54) @yulongying
3.1.1
3.0.0
Major rewrite, cleanup and typescriptation of this lib. See release notes of the RCs for the ins and outs.
3.0.0-rc5
Breaking change
The following methods have been removed from the connection object and can now be imported individually: conn.getStates(), conn.getConfig(), conn.getServices(), conn.callService().
Replace calls with:
import { getServices } from 'home-assistant-js-websocket';
const services = await getServices(conn);