API Reference

Server-sent Events

Receive push updates from the Konnected device using the Event Source API

Receive real-time updates from the Konnected device when sensor states change by using the Event Source Web API provided by ESPHome. Create an EventSource instance and connect to the /events endpoint on the device to subscribe to server-sent events.

When state updates occur, a state event will be sent with the state payload that's the same as the REST API payloads described in these API docs. For example, when the door sensor on zone 1 opens:

{"id":"binary_sensor-zone1","name":"Zone 1","value":true,"state":"ON"}	

when the garage door opens:

{"id":"cover-garage_door","value":1,"state":"OPEN","current_operation":"IDLE"}

Inspect in Chrome

You can view the server-sent event stream from the device easily in Chrome browser. Open the device's internal webpage at its IP address, open Chrome inspector, navigate to Network and reload the page. Now click on the events network request in the list. Click on the EventStream tab to view the stream of events from the Event Source Web API

Server-sent events vs. polling

For the best user experience and device performance, subscribing to server-sent events should be preferred over polling the API endpoints to retrieve state. Server-sent events use a single persistent connection and are faster and less resource-intensive than repeatedly opening a new HTTP connection every time a client polls for updates. Server-sent events are triggered in real-time that can lead to a faster experience for the end-user.