image_processing

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

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

Overview

Package imageprocessing is Home Assistant's image_processing domain: its types.

Entity controls one image_processing entity over HTTP.

Home Assistant documents the domain here:

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

Control

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

Commands

What each Entity method does on each transport. Home Assistant has no MQTT discovery for this domain.

MethodOver HTTP, calls
Scan image_processing.scan

Control

type Entity struct

Entity controls one image_processing 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 image_processing entity with the given id: an entity id over HTTP (the "image_processing." prefix may be omitted). It does no I/O.

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

List returns every image_processing entity the transport can see.

func (e *Entity) Scan(ctx context.Context) error

Scan calls image_processing.scan. It has no MQTT equivalent. Core describes the service: Processes an image immediately.

type State = entity.State[Attributes]

State is a snapshot of one image_processing entity.

State and values

type Attributes struct

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

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

FieldTypeWire keyDescription
DeviceClass*DeviceClassdevice_class
Faces[]anyfaces

Faces.

TotalFaces*inttotal_faces

Total faces.

DeviceClass

type DeviceClass string

DeviceClass is core's ImageProcessingDeviceClass.

ConstantValue
DeviceClassUnknown"Unknown"
DeviceClassAlpr"alpr"
DeviceClassFace"face"
DeviceClassOcr"ocr"
func DeviceClassFromString(s string) DeviceClass

DeviceClassFromString returns the DeviceClass spelled s, by its value or by the name of core's member, and DeviceClassUnknown for anything else.

func (v *DeviceClass) UnmarshalJSON(data []byte) error

UnmarshalJSON reads any spelling DeviceClassFromString accepts.