Documentation
¶
Index ¶
- func AnnounceDevice(client mqtt.Client, prefix string, nodeid string, objectid string, ...) error
- func ConsumeDiscoveredConfigs(client mqtt.Client, consumer ConfigConsumer, errs chan error)
- func Discover(client mqtt.Client, prefix string) (chan DiscoveredConfig, error)
- func GetDiscoveryTopic(c IConfig, prefix string, nodeID string, objectID string) string
- func GetDiscoveryWildcard(prefix string) string
- func GetPayload(c IConfig) ([]byte, error)
- type BasicConfig
- type BinarySensor
- type ConfigConsumer
- type Cover
- type DInput
- type Device
- type DiscoveredConfig
- type HVAC
- type IConfig
- type Light
- type Sensor
- type Switch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnounceDevice ¶ added in v0.0.2
func AnnounceDevice(client mqtt.Client, prefix string, nodeid string, objectid string, device IConfig) error
<discovery_prefix>/<component>/[<node_id>/]<object_id>/config
func ConsumeDiscoveredConfigs ¶ added in v0.0.2
func ConsumeDiscoveredConfigs(client mqtt.Client, consumer ConfigConsumer, errs chan error)
func GetDiscoveryTopic ¶
func GetDiscoveryWildcard ¶
func GetPayload ¶
Types ¶
type BasicConfig ¶
type BasicConfig struct { Device *Device `json:"device,omitempty"` UniqueID string `json:"unique_id,omitempty"` }
func (*BasicConfig) GetBasic ¶ added in v0.0.7
func (c *BasicConfig) GetBasic() *BasicConfig
type BinarySensor ¶ added in v0.0.5
type BinarySensor struct { BasicConfig Name string `json:"name,omitempty"` ValueTemplate string `json:"value_template,omitempty"` DeviceClass string `json:"device_class,omitempty"` Topic string `json:"state_topic"` Icon string `json:"icon,omitempty"` PayLoadOff any `json:"payload_off,omitempty"` PayLoadOn any `json:"payload_on,omitempty"` }
func (*BinarySensor) Consume ¶ added in v0.0.5
func (c *BinarySensor) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*BinarySensor) GetComponent ¶ added in v0.0.5
func (*BinarySensor) GetComponent() string
type ConfigConsumer ¶
type ConfigConsumer interface { ConsumeCover(c *Cover, nodeID string, objectID string) ConsumeDInput(c *DInput, nodeID string, objectID string) ConsumeHVAC(c *HVAC, nodeID string, objectID string) ConsumeSwitch(c *Switch, nodeID string, objectID string) ConsumeSensor(c *Sensor, nodeID string, objectID string) ConsumeLight(c *Light, nodeID string, objectID string) ConsumeBinarySensor(c *BinarySensor, nodeID string, objectID string) }
type Cover ¶
type Cover struct { BasicConfig CommandTopic string `json:"command_topic,omitempty"` Name string `json:"name,omitempty"` PositionTopic string `json:"position_topic,omitempty"` PositionOpen int `json:"position_open"` PositionClosed int `json:"position_closed"` }
func (*Cover) Consume ¶ added in v0.0.2
func (c *Cover) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*Cover) GetComponent ¶
type DInput ¶
type DInput struct { BasicConfig Name string `json:"name"` StateTopic string `json:"state_topic"` }
func (*DInput) Consume ¶ added in v0.0.2
func (c *DInput) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*DInput) GetComponent ¶
type DiscoveredConfig ¶ added in v0.0.2
type HVAC ¶
type HVAC struct { BasicConfig Name string `json:"name,omitempty"` ActionTopic string `json:"action_topic,omitempty"` CurrentTemperatureTopic string `json:"current_temperature_topic,omitempty"` TemperatreCommandTopic string `json:"temperature_command_topic,omitempty"` //TemperatureUnit string `json:"temperature_unit,omitempty"` TemperatureStateTopic string `json:"temperature_state_topic,omitempty"` MaxTemp float64 `json:"max_temp,omitempty"` MinTemp float64 `json:"min_temp,omitempty"` TempStep float64 `json:"temp_step,omitempty"` Modes []string `json:"modes,omitempty"` ModeCommandTopic string `json:"mode_command_topic,omitempty"` }
func (*HVAC) Consume ¶ added in v0.0.2
func (c *HVAC) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*HVAC) GetComponent ¶
type IConfig ¶
type IConfig interface { GetComponent() string Consume(consumer ConfigConsumer, nodeID string, objectID string) GetBasic() *BasicConfig }
func ProcessConfig ¶
type Light ¶
type Light struct { BasicConfig CommandTopic string `json:"command_topic,omitempty"` Name string `json:"name,omitempty"` Brightness bool `json:"brightness,omitempty"` BrightnessCommandTopic string `json:"brightness_command_topic,omitempty"` BrightnessScale int32 `json:"brightness_scale"` BrightnessStateTopic string `json:"brightness_state_topic,omitempty"` ColorTemp bool `json:"color_temp,omitempty"` OnCommandType string `json:"on_command_type,omitempty"` StateTopic string `json:"state_topic,omitempty"` Effect bool `json:"effect,omitempty"` EffectList []string `json:"effect_list,omitempty"` HS bool `json:"hs,omitempty"` JsonAttributesTopic string `json:"json_attributes_topic,omitempty"` Schema string `json:"schema,omitempty"` XY bool `json:"xy,omitempty"` }
func (*Light) Consume ¶ added in v0.0.2
func (c *Light) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*Light) GetComponent ¶
type Sensor ¶
type Sensor struct { BasicConfig Name string `json:"name,omitempty"` UnitOfMeasurement string `json:"unit_of_measurement"` Topic string `json:"state_topic"` Icon string `json:"icon,omitempty"` StateClass string `json:"state_class,omitempty"` ValueTemplate string `json:"value_template,omitempty"` DeviceClass string `json:"device_class,omitempty"` }
https://www.home-assistant.io/integrations/sensor.mqtt/
func (*Sensor) Consume ¶ added in v0.0.2
func (c *Sensor) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*Sensor) GetComponent ¶
type Switch ¶
type Switch struct { BasicConfig CommandTopic string `json:"command_topic,omitempty"` Name string `json:"name,omitempty"` StateTopic string `json:"state_topic,omitempty"` ValueTemplate string `json:"value_template,omitempty"` PayLoadOff any `json:"payload_off,omitempty"` PayLoadOn any `json:"payload_on,omitempty"` }
https://www.home-assistant.io/integrations/switch.mqtt/
func (*Switch) Consume ¶ added in v0.0.2
func (c *Switch) Consume(consumer ConfigConsumer, nodeID string, objectID string)
func (*Switch) GetComponent ¶
Click to show internal directories.
Click to hide internal directories.