services

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type AdaptiveLighting

type AdaptiveLighting struct {
	// contains filtered or unexported fields
}

func (AdaptiveLighting) SetManualControl

func (al AdaptiveLighting) SetManualControl(entityId string, enabled bool) error

Set manual control for an adaptive lighting entity.

type AlarmControlPanel

type AlarmControlPanel struct {
	// contains filtered or unexported fields
}

func (AlarmControlPanel) ArmAway

func (acp AlarmControlPanel) ArmAway(entityId string, serviceData ...map[string]any) error

Send the alarm the command for arm away. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) ArmHome

func (acp AlarmControlPanel) ArmHome(entityId string, serviceData ...map[string]any) error

Send the alarm the command for arm home. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) ArmNight

func (acp AlarmControlPanel) ArmNight(entityId string, serviceData ...map[string]any) error

Send the alarm the command for arm night. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) ArmVacation

func (acp AlarmControlPanel) ArmVacation(entityId string, serviceData ...map[string]any) error

Send the alarm the command for arm vacation. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) ArmWithCustomBypass

func (acp AlarmControlPanel) ArmWithCustomBypass(entityId string, serviceData ...map[string]any) error

Send the alarm the command for arm away. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) Disarm

func (acp AlarmControlPanel) Disarm(entityId string, serviceData ...map[string]any) error

Send the alarm the command for disarm. Takes an entityId and an optional map that is translated into service_data.

func (AlarmControlPanel) Trigger

func (acp AlarmControlPanel) Trigger(entityId string, serviceData ...map[string]any) error

Send the alarm the command for trigger. Takes an entityId and an optional map that is translated into service_data.

type BaseServiceRequest

type BaseServiceRequest struct {
	Id          int64          `json:"id"`
	RequestType string         `json:"type"` // hardcoded "call_service"
	Domain      string         `json:"domain"`
	Service     string         `json:"service"`
	ServiceData map[string]any `json:"service_data,omitempty"`
	// A pointer so an absent target is omitted. omitempty has no effect on a
	// struct value, so this used to send "target":{} on every call that names
	// no entity.
	Target *ServiceTarget `json:"target,omitempty"`
}

func NewBaseServiceRequest

func NewBaseServiceRequest(entityId string) BaseServiceRequest

func (*BaseServiceRequest) SetID added in v0.9.0

func (r *BaseServiceRequest) SetID(id int64)

SetID stamps the request with a connection-scoped id. The client calls this at send time, because an id is only meaningful on the connection that carries it and a request may outlive the one it was built for.

type Climate

type Climate struct {
	// contains filtered or unexported fields
}

func (Climate) SetFanMode

func (c Climate) SetFanMode(entityId string, fanMode string) error

func (Climate) SetTemperature

func (c Climate) SetTemperature(entityId string, serviceData types.SetTemperatureRequest) error

type Cover

type Cover struct {
	// contains filtered or unexported fields
}

func (Cover) Close

func (c Cover) Close(entityId string) error

Close all or specified cover. Takes an entityId.

func (Cover) CloseTilt

func (c Cover) CloseTilt(entityId string) error

Close all or specified cover tilt. Takes an entityId.

func (Cover) Open

func (c Cover) Open(entityId string) error

Open all or specified cover. Takes an entityId.

func (Cover) OpenTilt

func (c Cover) OpenTilt(entityId string) error

Open all or specified cover tilt. Takes an entityId.

func (Cover) SetPosition

func (c Cover) SetPosition(entityId string, serviceData ...map[string]any) error

Move to specific position all or specified cover. Takes an entityId and an optional map that is translated into service_data.

func (Cover) SetTiltPosition

func (c Cover) SetTiltPosition(entityId string, serviceData ...map[string]any) error

Move to specific position all or specified cover tilt. Takes an entityId and an optional map that is translated into service_data.

func (Cover) Stop

func (c Cover) Stop(entityId string) error

Stop a cover entity. Takes an entityId.

func (Cover) StopTilt

func (c Cover) StopTilt(entityId string) error

Stop a cover entity tilt. Takes an entityId.

func (Cover) Toggle

func (c Cover) Toggle(entityId string) error

Toggle a cover open/closed. Takes an entityId.

func (Cover) ToggleTilt

func (c Cover) ToggleTilt(entityId string) error

Toggle a cover tilt open/closed. Takes an entityId.

type Event

type Event struct {
	// contains filtered or unexported fields
}

func (Event) Fire

func (e Event) Fire(eventType string, eventData ...map[string]any) error

Fire an event. Takes an event type and an optional map that is sent as `event_data`.

type FireEventRequest

type FireEventRequest struct {
	Id        int64          `json:"id"`
	Type      string         `json:"type"` // always set to "fire_event"
	EventType string         `json:"event_type"`
	EventData map[string]any `json:"event_data,omitempty"`
}

Fire an event

func (*FireEventRequest) SetID added in v0.9.0

func (r *FireEventRequest) SetID(id int64)

type HomeAssistant

type HomeAssistant struct {
	// contains filtered or unexported fields
}

func (*HomeAssistant) Toggle

func (ha *HomeAssistant) Toggle(entityId string, serviceData ...map[string]any) error

Toggle a Home Assistant entity. Takes an entityId and an optional map that is translated into service_data.

func (*HomeAssistant) TurnOff

func (ha *HomeAssistant) TurnOff(entityId string) error

TurnOff turns off a Home Assistant entity.

func (*HomeAssistant) TurnOn

func (ha *HomeAssistant) TurnOn(entityId string, serviceData ...map[string]any) error

TurnOn a Home Assistant entity. Takes an entityId and an optional map that is translated into service_data.

type InputBoolean

type InputBoolean struct {
	// contains filtered or unexported fields
}

func (InputBoolean) Reload

func (ib InputBoolean) Reload() error

func (InputBoolean) Toggle

func (ib InputBoolean) Toggle(entityId string) error

Toggle toggles an input boolean entity.

func (InputBoolean) TurnOff

func (ib InputBoolean) TurnOff(entityId string) error

TurnOff turns off an input boolean entity.

func (InputBoolean) TurnOn

func (ib InputBoolean) TurnOn(entityId string) error

TurnOn turns on an input boolean entity.

type InputButton

type InputButton struct {
	// contains filtered or unexported fields
}

func (InputButton) Press

func (ib InputButton) Press(entityId string) error

Press presses an input button entity.

func (InputButton) Reload

func (ib InputButton) Reload() error

type InputDatetime

type InputDatetime struct {
	// contains filtered or unexported fields
}

func (InputDatetime) Reload

func (ib InputDatetime) Reload() error

func (InputDatetime) Set

func (ib InputDatetime) Set(entityId string, value time.Time) error

type InputNumber

type InputNumber struct {
	// contains filtered or unexported fields
}

func (InputNumber) Decrement

func (ib InputNumber) Decrement(entityId string) error

func (InputNumber) Increment

func (ib InputNumber) Increment(entityId string) error

func (InputNumber) Reload

func (ib InputNumber) Reload() error

func (InputNumber) Set

func (ib InputNumber) Set(entityId string, value float32) error

type InputText

type InputText struct {
	// contains filtered or unexported fields
}

func (InputText) Reload

func (ib InputText) Reload() error

func (InputText) Set

func (ib InputText) Set(entityId string, value string) error

Set sets the value of an input text entity.

type Light

type Light struct {
	// contains filtered or unexported fields
}

func (Light) Toggle

func (l Light) Toggle(entityId string, serviceData ...map[string]any) error

Toggle a light entity. Takes an entityId and an optional map that is translated into service_data.

func (Light) TurnOff

func (l Light) TurnOff(entityId string) error

TurnOff turns off a light entity.

func (Light) TurnOn

func (l Light) TurnOn(entityId string, serviceData ...map[string]any) error

TurnOn a light entity. Takes an entityId and an optional map that is translated into service_data.

type Lock

type Lock struct {
	// contains filtered or unexported fields
}

func (Lock) Lock

func (l Lock) Lock(entityId string, serviceData ...map[string]any) error

Lock a lock entity. Takes an entityId and an optional map that is translated into service_data.

func (Lock) Unlock

func (l Lock) Unlock(entityId string, serviceData ...map[string]any) error

Unlock a lock entity. Takes an entityId and an optional map that is translated into service_data.

type MediaPlayer

type MediaPlayer struct {
	// contains filtered or unexported fields
}

func (MediaPlayer) ClearPlaylist

func (mp MediaPlayer) ClearPlaylist(entityId string) error

Send the media player the command to clear players playlist. Takes an entityId.

func (MediaPlayer) Join

func (mp MediaPlayer) Join(entityId string, serviceData ...map[string]any) error

Group players together. Only works on platforms with support for player groups. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) Next

func (mp MediaPlayer) Next(entityId string) error

Send the media player the command for next track. Takes an entityId.

func (MediaPlayer) Pause

func (mp MediaPlayer) Pause(entityId string) error

Send the media player the command for pause. Takes an entityId.

func (MediaPlayer) Play

func (mp MediaPlayer) Play(entityId string) error

Send the media player the command for play. Takes an entityId.

func (MediaPlayer) PlayMedia

func (mp MediaPlayer) PlayMedia(entityId string, serviceData ...map[string]any) error

Send the media player the command to play a media. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) PlayPause

func (mp MediaPlayer) PlayPause(entityId string) error

Toggle media player play/pause state. Takes an entityId.

func (MediaPlayer) Previous

func (mp MediaPlayer) Previous(entityId string) error

Send the media player the command for previous track. Takes an entityId.

func (MediaPlayer) RepeatSet

func (mp MediaPlayer) RepeatSet(entityId string, serviceData ...map[string]any) error

Set repeat mode. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) Seek

func (mp MediaPlayer) Seek(entityId string, serviceData ...map[string]any) error

Send the media player the command to seek in current playing media. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) SelectSoundMode

func (mp MediaPlayer) SelectSoundMode(entityId string, serviceData ...map[string]any) error

Select a sound mode. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) SelectSource

func (mp MediaPlayer) SelectSource(entityId string, serviceData ...map[string]any) error

Select a source. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) Shuffle

func (mp MediaPlayer) Shuffle(entityId string, serviceData ...map[string]any) error

Toggle shuffle state. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) Stop

func (mp MediaPlayer) Stop(entityId string) error

Send the media player the stop command. Takes an entityId.

func (MediaPlayer) Toggle

func (mp MediaPlayer) Toggle(entityId string) error

Toggle a media player on/off. Takes an entityId.

func (MediaPlayer) TurnOff

func (mp MediaPlayer) TurnOff(entityId string) error

Turn off a media player. Takes an entityId.

func (MediaPlayer) TurnOn

func (mp MediaPlayer) TurnOn(entityId string) error

Turn on a media player. Takes an entityId.

func (MediaPlayer) Unjoin

func (mp MediaPlayer) Unjoin(entityId string) error

Separate a player from a group. Only works on platforms with support for player groups. Takes an entityId.

func (MediaPlayer) VolumeDown

func (mp MediaPlayer) VolumeDown(entityId string) error

Send the media player the command for volume down. Takes an entityId.

func (MediaPlayer) VolumeMute

func (mp MediaPlayer) VolumeMute(entityId string, serviceData ...map[string]any) error

Mute a media player. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) VolumeSet

func (mp MediaPlayer) VolumeSet(entityId string, serviceData ...map[string]any) error

Set volume level. Takes an entityId and an optional map that is translated into service_data.

func (MediaPlayer) VolumeUp

func (mp MediaPlayer) VolumeUp(entityId string) error

Send the media player the command for volume up. Takes an entityId.

type Notify

type Notify struct {
	// contains filtered or unexported fields
}

func (*Notify) Notify

func (ha *Notify) Notify(reqData types.NotifyRequest) error

Notify sends a notification. Takes a types.NotifyRequest.

type Number

type Number struct {
	// contains filtered or unexported fields
}

func (Number) MustSetValue

func (ib Number) MustSetValue(entityId string, value float32)

func (Number) SetValue

func (ib Number) SetValue(entityId string, value float32) error

type Scene

type Scene struct {
	// contains filtered or unexported fields
}

func (Scene) Apply

func (s Scene) Apply(serviceData ...map[string]any) error

Apply a scene. Takes map that is translated into service_data.

func (Scene) Create

func (s Scene) Create(entityId string, serviceData ...map[string]any) error

Create a scene entity. Takes an entityId and an optional map that is translated into service_data.

func (Scene) Reload

func (s Scene) Reload() error

Reload the scenes.

func (Scene) TurnOn

func (s Scene) TurnOn(entityId string, serviceData ...map[string]any) error

TurnOn a scene entity. Takes an entityId and an optional map that is translated into service_data.

type Script

type Script struct {
	// contains filtered or unexported fields
}

func (Script) Reload

func (s Script) Reload(entityId string) error

Reload a script that was created in the HA UI.

func (Script) Toggle

func (s Script) Toggle(entityId string) error

Toggle a script that was created in the HA UI.

func (Script) TurnOff

func (s Script) TurnOff() error

TurnOff a script that was created in the HA UI.

func (Script) TurnOn

func (s Script) TurnOn(entityId string) error

TurnOn a script that was created in the HA UI.

type ServiceTarget added in v0.9.0

type ServiceTarget struct {
	EntityId string `json:"entity_id,omitempty"`
}

ServiceTarget names what a service call acts on.

type Switch

type Switch struct {
	// contains filtered or unexported fields
}

func (Switch) Toggle

func (s Switch) Toggle(entityId string) error

Toggle toggles a switch entity.

func (Switch) TurnOff

func (s Switch) TurnOff(entityId string) error

TurnOff turns off a switch entity.

func (Switch) TurnOn

func (s Switch) TurnOn(entityId string) error

TurnOn turns on a switch entity.

type TTS

type TTS struct {
	// contains filtered or unexported fields
}

func (TTS) ClearCache

func (tts TTS) ClearCache() error

Remove all text-to-speech cache files and RAM cache.

func (TTS) CloudSay

func (tts TTS) CloudSay(entityId string, serviceData ...map[string]any) error

Say something using text-to-speech on a media player with cloud. Takes an entityId and an optional map that is translated into service_data.

func (TTS) GoogleTranslateSay

func (tts TTS) GoogleTranslateSay(entityId string, serviceData ...map[string]any) error

Say something using text-to-speech on a media player with google_translate. Takes an entityId and an optional map that is translated into service_data.

type Vacuum

type Vacuum struct {
	// contains filtered or unexported fields
}

func (Vacuum) CleanSpot

func (v Vacuum) CleanSpot(entityId string) error

Tell the vacuum cleaner to do a spot clean-up. Takes an entityId.

func (Vacuum) Locate

func (v Vacuum) Locate(entityId string) error

Locate the vacuum cleaner robot. Takes an entityId.

func (Vacuum) Pause

func (v Vacuum) Pause(entityId string) error

Pause the cleaning task. Takes an entityId.

func (Vacuum) ReturnToBase

func (v Vacuum) ReturnToBase(entityId string) error

Tell the vacuum cleaner to return to its dock. Takes an entityId.

func (Vacuum) SendCommand

func (v Vacuum) SendCommand(entityId string, serviceData ...map[string]any) error

Send a raw command to the vacuum cleaner. Takes an entityId and an optional map that is translated into service_data.

func (Vacuum) SetFanSpeed

func (v Vacuum) SetFanSpeed(entityId string, serviceData ...map[string]any) error

Set the fan speed of the vacuum cleaner. Takes an entityId and an optional map that is translated into service_data.

func (Vacuum) Start

func (v Vacuum) Start(entityId string) error

Start or resume the cleaning task. Takes an entityId.

func (Vacuum) StartPause

func (v Vacuum) StartPause(entityId string) error

Start, pause, or resume the cleaning task. Takes an entityId.

func (Vacuum) Stop

func (v Vacuum) Stop(entityId string) error

Stop the current cleaning task. Takes an entityId.

func (Vacuum) TurnOff

func (v Vacuum) TurnOff(entityId string) error

Stop the current cleaning task and return to home. Takes an entityId.

func (Vacuum) TurnOn

func (v Vacuum) TurnOn(entityId string) error

Start a new cleaning task. Takes an entityId.

type ZWaveJS

type ZWaveJS struct {
	// contains filtered or unexported fields
}

func (ZWaveJS) BulkSetPartialConfigParam

func (zw ZWaveJS) BulkSetPartialConfigParam(entityId string, parameter int, value any) error

ZWaveJS bulk_set_partial_config_parameters service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL