HomeAssistantApiClient

interface HomeAssistantApiClient

The client object for interacting with the Home Assistant WebSocket API.

Functions

Link copied to clipboard
abstract fun <ED> attachEventHandler(eventType: EventType, eventDataType: KClass<*>, eventHandler: EventHandlerFunction<ED>): Switchable

Attaches an EventHandlerFunction to the API client and starts the Home Assistant event subscription.

Link copied to clipboard
abstract fun connect()
Link copied to clipboard
abstract suspend fun emitEvent(eventType: String, eventData: Any? = null)

Emits a Home Assistant event with optional event data.

Link copied to clipboard
abstract fun setErrorResponseHandler(errorResponseHandler: (ErrorResponseData) -> Unit)

Attaches an error response handler to the API client.

Link copied to clipboard
abstract fun setEventHandlerExceptionHandler(f: (Throwable) -> Unit)

Overwrites the default event handler exception handler action.

Properties

Link copied to clipboard
abstract var connectionExceptionHandler: (Throwable) -> Unit

The action that gets executed when an exception occurs while connecting to Home Assistant.

Link copied to clipboard
abstract var observerExceptionHandler: (Throwable) -> Unit

The action that gets executed when the observer action executes with an exception.

Extensions

Link copied to clipboard
inline fun <ED> HomeAssistantApiClient.attachEventHandler(eventType: EventType, noinline eventHandler: EventHandlerFunction<ED>): Switchable
Link copied to clipboard
Link copied to clipboard
fun HomeAssistantApiClient.ContactSensor(objectId: ObjectId): ContactSensor
Link copied to clipboard
suspend fun HomeAssistantApiClient.createPersistentNotification(message: String, title: String? = null, notificationId: String? = null): Int
Link copied to clipboard
fun HomeAssistantApiClient.DayTime(objectId: ObjectId): DayTime
Link copied to clipboard
fun HomeAssistantApiClient.DimmableLight(objectId: ObjectId): DimmableLight
Link copied to clipboard
suspend fun HomeAssistantApiClient.dismissPersistentNotification(id: String): Int
Link copied to clipboard
fun HomeAssistantApiClient.InputBoolean(objectId: ObjectId): InputBoolean
Link copied to clipboard
fun HomeAssistantApiClient.InputDate(objectId: ObjectId): InputDate
Link copied to clipboard
fun HomeAssistantApiClient.InputDateTime(objectId: ObjectId): InputDateTime
Link copied to clipboard
fun HomeAssistantApiClient.InputNumber(objectId: ObjectId): InputNumber
Link copied to clipboard
fun HomeAssistantApiClient.InputSelect(objectId: ObjectId): InputSelect
Link copied to clipboard
fun HomeAssistantApiClient.InputText(objectId: ObjectId): InputText
Link copied to clipboard
fun HomeAssistantApiClient.InputTime(objectId: ObjectId): InputTime
Link copied to clipboard
fun HomeAssistantApiClient.LuminanceSensor(objectId: ObjectId): LuminanceSensor
Link copied to clipboard
suspend fun HomeAssistantApiClient.markPersistentNotificationAsRead(id: String): Int
Link copied to clipboard
fun HomeAssistantApiClient.MediaReceiver(objectId: ObjectId): MediaReceiver
fun HomeAssistantApiClient.MediaReceiver(entityId: EntityId): MediaReceiver
Link copied to clipboard
fun HomeAssistantApiClient.MotionSensor(objectId: ObjectId): MotionSensor
Link copied to clipboard
suspend fun HomeAssistantApiClient.notifyMobileApp(device: Device, message: String, title: String? = null): Int
suspend fun HomeAssistantApiClient.notifyMobileApp(device: Device, messageBuilder: MobileNotificationData.() -> Unit): Int
suspend fun HomeAssistantApiClient.notifyMobileApp(vararg devices: Device, title: String, message: String)
Link copied to clipboard
fun HomeAssistantApiClient.Person(objectId: ObjectId): Person
Link copied to clipboard
fun HomeAssistantApiClient.PositionableCover(objectId: ObjectId): PositionableCover
Link copied to clipboard
fun HomeAssistantApiClient.PowerMeasuringSwitch(objectId: ObjectId): PowerSwitch
Link copied to clipboard
suspend fun HomeAssistantApiClient.requestLocationUpdate(device: Device): Int
suspend fun HomeAssistantApiClient.requestLocationUpdate(vararg devices: Device)
Link copied to clipboard
fun HomeAssistantApiClient.RGBLight(objectId: ObjectId): RGBLight
Link copied to clipboard
fun HomeAssistantApiClient.RGBWLight(objectId: ObjectId): RGBWLight
Link copied to clipboard
fun HomeAssistantApiClient.Sun(): Sun
Link copied to clipboard
fun HomeAssistantApiClient.SwitchableLight(objectId: ObjectId): SwitchableLight
Link copied to clipboard
fun HomeAssistantApiClient.Television(objectId: ObjectId): Television
Link copied to clipboard
fun HomeAssistantApiClient.Thermostat(objectId: ObjectId): Thermostat