geo_location

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

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

Overview

Package geolocation is Home Assistant's geo_location domain: its types.

Entity controls one geo_location entity over HTTP.

Home Assistant documents the domain here:

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

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

Control

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

Control

type Entity struct

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

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

List returns every geo_location entity the transport can see.

type State = entity.State[Attributes]

State is a snapshot of one geo_location entity.

State and values

type Attributes struct

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

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

FieldTypeWire keyDescription
Latitude*float64latitude

Latitude.

Longitude*float64longitude

Longitude.

Sourcestringsource

Source.