ai_task

Go types for Home Assistant's ai_task domain: control over HTTP.

Control: HTTP
import "github.com/taumatix/homeassistant-go/domains/aitask"

Overview

Package aitask is Home Assistant's ai_task domain: its types.

Entity controls one ai_task entity over HTTP.

No method for ai_task.evaluate, ai_task.generate_data and ai_task.generate_image, which only answer with data: call api.Client.CallServiceForResponse.

No method for ai_task.clear_images, which target no entity: call api.Client.CallService.

Home Assistant documents the domain here:

Integration: https://www.home-assistant.io/integrations/ai_task/

Entity model (developers): https://contributors.home-assistant.io/core/entities/ai-task/

Control

// client is an *api.Client
target := aitask.Get(client, "my_ai_task")
state, err := target.State(ctx)

Commands

Services without a method

Call these with the REST or WebSocket client.

ServiceWhy
ai_task.clear_imagesit targets no entity
ai_task.evaluateit only answers with data
ai_task.generate_datait only answers with data
ai_task.generate_imageit only answers with data

Control

type Entity struct

Entity controls one ai_task entity over HTTP (api.Client). State and Subscribe come from the embedded Handle.

Embeds entity.Handle[Attributes], whose methods it has too.

func Get(transport entity.Transport, id string) *Entity

Get returns the ai_task entity with the given id: an entity id over HTTP (the "ai_task." prefix may be omitted). It does no I/O.

func List(ctx context.Context, transport entity.Transport) ([]*Entity, error)

List returns every ai_task entity the transport can see.

type State = entity.State[Attributes]

State is a snapshot of one ai_task entity.

State and values

type Attributes struct

Attributes are the state attributes of a ai_task entity, under the names Home Assistant publishes them with.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
SupportedFeaturesFeaturesupported_features

A set of Feature flags.

type ChoiceAnswer struct

ChoiceAnswer is core's ChoiceAnswer.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
Choicestringchoice
Probabilitiesmap[string]float64probabilities
Typestringtype
type EvaluationTaskResult struct

EvaluationTaskResult is core's EvaluationTaskResult.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
Answersmap[string]anyanswers

Feature

type Feature uint64

Feature is a set of ai_task supported features, with the values of core's AITaskEntityFeature: the supported_features attribute decodes into it.

ConstantValue
FeatureUnknown0
FeatureGenerateData1 << 0
FeatureSupportAttachments1 << 1
FeatureGenerateImage1 << 2
FeatureEvaluate1 << 3
func FeatureFromString(s string) Feature

FeatureFromString returns the Feature spelled s, by its value or by the name of core's member, and FeatureUnknown for anything else.

type GenDataTaskResult struct

GenDataTaskResult is core's GenDataTaskResult.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
ConversationIdstringconversation_id
Dataanydata
type NoulAnswer struct

NoulAnswer is core's NoulAnswer.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
Noulfloat64noul
Typestringtype
type ScoreAnswer struct

ScoreAnswer is core's ScoreAnswer.

See: https://www.home-assistant.io/integrations/ai_task/

FieldTypeWire keyDescription
Probabilities[]float64probabilities
Scorefloat64score
Typestringtype