Versions in this module Expand all Collapse all v4 v4.0.0 Feb 6, 2024 Changes in this version + func FormatID(s string) string + func FormatName(s string) string + func MarshalConfig(e *EntityConfig) (*mqtt.Msg, error) + func MarshalState(e *EntityConfig) (*mqtt.Msg, error) + func MarshalSubscription(e *EntityConfig) (*mqtt.Subscription, error) + func PublishState(device MQTTDevice, client MQTTClient) error + func Register(device MQTTDevice, client MQTTClient) error + func Subscribe(device MQTTDevice, client MQTTClient) error + func UnRegister(device MQTTDevice, client MQTTClient) error + type Device struct + Connections []string + HWVersion string + Identifiers []string + Manufacturer string + Model string + Name string + SWVersion string + SuggestedArea string + URL string + type Entity struct + AttributesTemplate string + AttributesTopic string + CommandTopic string + Device *Device + DeviceClass string + EntityCategory string + Icon string + Name string + Origin *Origin + StateClass string + StateTopic string + UniqueID string + UnitOfMeasurement string + ValueTemplate string + type EntityConfig struct + App string + AttributesCallback func() (json.RawMessage, error) + CommandCallback func(MQTT.Client, MQTT.Message) + ConfigTopic string + Entity *Entity + StateCallback func() (json.RawMessage, error) + func NewEntityByID(id, app string) *EntityConfig + func NewEntityByName(name, app string) *EntityConfig + func (e *EntityConfig) AsBinarySensor() *EntityConfig + func (e *EntityConfig) AsButton() *EntityConfig + func (e *EntityConfig) AsSensor() *EntityConfig + func (e *EntityConfig) WithAttributesCallback(c func() (json.RawMessage, error)) *EntityConfig + func (e *EntityConfig) WithAttributesTemplate(t string) *EntityConfig + func (e *EntityConfig) WithAttributesTopic() *EntityConfig + func (e *EntityConfig) WithCommandCallback(c func(MQTT.Client, MQTT.Message)) *EntityConfig + func (e *EntityConfig) WithDefaultOriginInfo() *EntityConfig + func (e *EntityConfig) WithDeviceClass(d string) *EntityConfig + func (e *EntityConfig) WithDeviceInfo(d *Device) *EntityConfig + func (e *EntityConfig) WithIcon(i string) *EntityConfig + func (e *EntityConfig) WithOriginInfo(o *Origin) *EntityConfig + func (e *EntityConfig) WithStateCallback(c func() (json.RawMessage, error)) *EntityConfig + func (e *EntityConfig) WithStateClassMeasurement() *EntityConfig + func (e *EntityConfig) WithStateClassTotal() *EntityConfig + func (e *EntityConfig) WithStateClassTotalIncreasing() *EntityConfig + func (e *EntityConfig) WithUnits(u string) *EntityConfig + func (e *EntityConfig) WithValueTemplate(t string) *EntityConfig + type MQTTClient interface + Publish func(msgs ...*mqtt.Msg) error + Subscribe func(msgs ...*mqtt.Subscription) error + type MQTTDevice interface + Configuration func() []*mqtt.Msg + Name func() string + States func() []*mqtt.Msg + Subscriptions func() []*mqtt.Subscription + type Origin struct + Name string + URL string + Version 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/v12 github.com/joshuar/go-hass-anything/v2 github.com/joshuar/go-hass-anything/v3 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