Versions in this module Expand all Collapse all v12 v12.0.0 Oct 10, 2024 Changes in this version + var ErrNoCommandCallback = errors.New("no command callback function") + var ErrNoStateCallback = errors.New("no state callback function") + var HomeAssistantTopic = "homeassistant" + type AttributeOption func(*EntityAttributes) *EntityAttributes + func AttributesCallback(c func(args ...any) (json.RawMessage, error)) AttributeOption + func AttributesTemplate(t string) AttributeOption + type ButtonEntity struct + ButtonType string + PayloadPress string + func NewButtonEntity() *ButtonEntity + func (e *ButtonEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *ButtonEntity) WithAttributes(options ...AttributeOption) *ButtonEntity + func (e *ButtonEntity) WithButtonType(buttonType ButtonType) *ButtonEntity + func (e *ButtonEntity) WithCommand(options ...CommandOption) *ButtonEntity + func (e *ButtonEntity) WithDetails(options ...DetailsOption) *ButtonEntity + func (e *ButtonEntity) WithPressPayload(payload string) *ButtonEntity + type ButtonType int + const ButtonTypeIdentify + const ButtonTypeNone + const ButtonTypeRestart + const ButtonTypeUpdate + func (i ButtonType) String() string + type CameraEntity struct + Topic string + func NewCameraEntity() *CameraEntity + func (e *CameraEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *CameraEntity) WithAttributes(options ...AttributeOption) *CameraEntity + func (e *CameraEntity) WithDetails(options ...DetailsOption) *CameraEntity + func (e *CameraEntity) WithEncoding(options ...EncodingOption) *CameraEntity + type CommandOption func(*EntityCommand) *EntityCommand + func CommandCallback(callback func(p *paho.Publish)) CommandOption + type DetailsOption func(*EntityDetails) *EntityDetails + func App(app string) DetailsOption + func AsDiagnostic() DetailsOption + func DefaultOriginInfo() DetailsOption + func DeviceInfo(d *Device) DetailsOption + func ID(id string) DetailsOption + func Icon(icon string) DetailsOption + func Name(name string) DetailsOption + func NotEnabledByDefault() DetailsOption + func OriginInfo(o *Origin) DetailsOption + type Device struct + Connections []string + HWVersion string + Identifiers []string + Manufacturer string + Model string + Name string + SWVersion string + SuggestedArea string + URL string + type EncodingOption func(*EntityEncoding) *EntityEncoding + func WithBase64ImageEncoding() EncodingOption + func WithEncoding(encoding string) EncodingOption + func WithImageEncoding(encoding string) EncodingOption + type EntityAttributes struct + AttributesTemplate string + AttributesTopic string + func WithAttributesOptions(options ...AttributeOption) *EntityAttributes + func (e *EntityAttributes) MarshalAttributes(args ...any) (*mqttapi.Msg, error) + type EntityAvailability struct + AvailabilityTemplate string + AvailabilityTopic string + PayloadAvailable string + PayloadNotAvailable string + type EntityCommand struct + CommandTopic string + func WithCommandOptions(options ...CommandOption) *EntityCommand + func (e *EntityCommand) MarshalSubscription() (*mqttapi.Subscription, error) + type EntityDetails struct + Category string + Device *Device + Enabled bool + Icon string + Name string + Origin *Origin + UniqueID string + func WithDetails(entityType EntityType, options ...DetailsOption) *EntityDetails + type EntityEncoding struct + Encoding string + ImageEncoding string + func WithEncodingOptions(options ...EncodingOption) *EntityEncoding + type EntityState struct + DeviceClass string + StateClass string + StateTopic string + SuggestedPrecision uint + UnitOfMeasurement string + ValueTemplate string + func WithStateOptions(options ...StateOption) *EntityState + func (e *EntityState) MarshalState(args ...any) (*mqttapi.Msg, error) + type EntityType int + const BinarySensor + const Button + const Camera + const Image + const Number + const Sensor + const Switch + const Text + const Unknown + func (i EntityType) String() string + type ImageEntity struct + ContentType string + ImageTopic string + URLTemplate string + URLTopic string + func NewImageEntity() *ImageEntity + func (e *ImageEntity) GetImageTopic() string + func (e *ImageEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *ImageEntity) WithAttributes(options ...AttributeOption) *ImageEntity + func (e *ImageEntity) WithContentType(contentType string) *ImageEntity + func (e *ImageEntity) WithDetails(options ...DetailsOption) *ImageEntity + func (e *ImageEntity) WithEncoding(options ...EncodingOption) *ImageEntity + func (e *ImageEntity) WithMode(mode ImageMode) *ImageEntity + func (e *ImageEntity) WithURLTemplate(template string) *ImageEntity + type ImageMode int + const ModeImage + const ModeURL + type NumberEntity struct + Max T + Min T + Mode string + Optimistic bool + ResetPayload string + Step T + func NewNumberEntity[T constraints.Ordered]() *NumberEntity[T] + func (e *NumberEntity[T]) MarshalConfig() (*mqttapi.Msg, error) + func (e *NumberEntity[T]) OptimisticMode() *NumberEntity[T] + func (e *NumberEntity[T]) WithAttributes(options ...AttributeOption) *NumberEntity[T] + func (e *NumberEntity[T]) WithCommand(options ...CommandOption) *NumberEntity[T] + func (e *NumberEntity[T]) WithDetails(options ...DetailsOption) *NumberEntity[T] + func (e *NumberEntity[T]) WithMax(max T) *NumberEntity[T] + func (e *NumberEntity[T]) WithMin(min T) *NumberEntity[T] + func (e *NumberEntity[T]) WithMode(mode NumberMode) *NumberEntity[T] + func (e *NumberEntity[T]) WithResetPayload(payload string) *NumberEntity[T] + func (e *NumberEntity[T]) WithState(options ...StateOption) *NumberEntity[T] + func (e *NumberEntity[T]) WithStep(step T) *NumberEntity[T] + type NumberMode int + const NumberAuto + const NumberBox + const NumberSlider + func (i NumberMode) String() string + type Origin struct + Name string + URL string + Version string + type SensorEntity struct + ForceUpdate bool + LastResetValueTemplate string + StateExpiry int + func NewBinarySensorEntity() *SensorEntity + func NewSensorEntity() *SensorEntity + func (e *SensorEntity) ForcedUpdates() *SensorEntity + func (e *SensorEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *SensorEntity) WithAttributes(options ...AttributeOption) *SensorEntity + func (e *SensorEntity) WithDetails(options ...DetailsOption) *SensorEntity + func (e *SensorEntity) WithLastResetValueTemplate(template string) *SensorEntity + func (e *SensorEntity) WithState(options ...StateOption) *SensorEntity + func (e *SensorEntity) WithStateExpiry(expiry time.Duration) *SensorEntity + type StateOption func(*EntityState) *EntityState + func DeviceClass(class string) StateOption + func StateCallback(callback func(args ...any) (json.RawMessage, error)) StateOption + func StateClassMeasurement() StateOption + func StateClassTotal() StateOption + func StateClassTotalIncreasing() StateOption + func SuggestedPrecision(p uint) StateOption + func Units(u string) StateOption + func ValueTemplate(t string) StateOption + type SwitchEntity struct + Optimistic bool + PayloadOff string + PayloadOn string + StateOff string + StateOn string + func NewSwitchEntity() *SwitchEntity + func (e *SwitchEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *SwitchEntity) OptimisticMode() *SwitchEntity + func (e *SwitchEntity) WithAttributes(options ...AttributeOption) *SwitchEntity + func (e *SwitchEntity) WithCommand(options ...CommandOption) *SwitchEntity + func (e *SwitchEntity) WithDetails(options ...DetailsOption) *SwitchEntity + func (e *SwitchEntity) WithOffPayload(payload string) *SwitchEntity + func (e *SwitchEntity) WithOnPayload(payload string) *SwitchEntity + func (e *SwitchEntity) WithState(options ...StateOption) *SwitchEntity + func (e *SwitchEntity) WithStateOff(payload string) *SwitchEntity + func (e *SwitchEntity) WithStateOn(payload string) *SwitchEntity + type TextEntity struct + Max int + Min int + Mode string + Pattern string + func NewTextEntity() *TextEntity + func (e *TextEntity) MarshalConfig() (*mqttapi.Msg, error) + func (e *TextEntity) WithAttributes(options ...AttributeOption) *TextEntity + func (e *TextEntity) WithCommand(options ...CommandOption) *TextEntity + func (e *TextEntity) WithDetails(options ...DetailsOption) *TextEntity + func (e *TextEntity) WithMax(max int) *TextEntity + func (e *TextEntity) WithMin(min int) *TextEntity + func (e *TextEntity) WithMode(mode TextEntityMode) *TextEntity + func (e *TextEntity) WithPattern(pattern string) *TextEntity + func (e *TextEntity) WithState(options ...StateOption) *TextEntity + type TextEntityMode int + const Password + const PlainText + func (i TextEntityMode) String() string Other modules containing this package github.com/joshuar/go-hass-anything github.com/joshuar/go-hass-anything/v10 github.com/joshuar/go-hass-anything/v11 github.com/joshuar/go-hass-anything/v2 github.com/joshuar/go-hass-anything/v3 github.com/joshuar/go-hass-anything/v4 github.com/joshuar/go-hass-anything/v5 github.com/joshuar/go-hass-anything/v6 github.com/joshuar/go-hass-anything/v7 github.com/joshuar/go-hass-anything/v8 github.com/joshuar/go-hass-anything/v9