radio_frequency

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

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

Overview

Package radiofrequency is Home Assistant's radio_frequency domain: its types.

Entity controls one radio_frequency entity over HTTP.

Home Assistant documents the domain here:

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

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

Control

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

Control

type Entity struct

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

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

List returns every radio_frequency entity the transport can see.

type State = entity.State[Attributes]

State is a snapshot of one radio_frequency entity.

State and values

type Attributes struct

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

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

FieldTypeWire keyDescription
DeviceClass*DeviceClassdevice_class

DeviceClass

type DeviceClass string

DeviceClass is core's RadioFrequencyDeviceClass.

ConstantValue
DeviceClassUnknown"Unknown"
DeviceClassTransmitter"transmitter"
DeviceClassReceiver"receiver"
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.