cmdHassio

package
v0.0.0-...-391253a Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const LabelAlarmControlPanel = "alarm_control_panel"
View Source
const LabelBinarySensor = "binary_sensor"
View Source
const LabelButton = "button"
View Source
const LabelCamera = "camera"
View Source
const LabelClimate = "climate"
View Source
const LabelCover = "cover"
View Source
const LabelDeviceTracker = "device_tracker"
View Source
const LabelDeviceTrigger = "device_trigger"
View Source
const LabelFan = "fan"
View Source
const LabelHumidifier = "humidifier"
View Source
const LabelLight = "light"
View Source
const LabelLock = "lock"
View Source
const LabelNumber = "number"
View Source
const LabelScene = "scene"
View Source
const LabelSelect = "select"
View Source
const LabelSensor = "sensor"
View Source
const LabelSiren = "siren"
View Source
const LabelSwitch = "switch"
View Source
const LabelTag = "tag"
View Source
const LabelText = "text"
View Source
const LabelUpdate = "update"
View Source
const LabelVacuum = "vacuum"
View Source
const OptionDebug = "mqtt_debug"
View Source
const OptionDisabled = "Disabled"
View Source
const OptionEnabled = "Enabled"
View Source
const OptionLogLevel = "mqtt_loglevel"

Variables

This section is empty.

Functions

func JoinStrings

func JoinStrings(args ...string) string

func JoinStringsForId

func JoinStringsForId(args ...string) string

func JoinStringsForName

func JoinStringsForName(sep string, args ...string) string

func JoinStringsForTopic

func JoinStringsForTopic(args ...string) string

func SetDefault

func SetDefault(value string, def string) string

Types

type AlarmControlPanel

type AlarmControlPanel struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// If defined, specifies a code to enable or disable the alarm in the frontend. Note that the code is validated locally and blocks sending MQTT messages to the remote device. For remote code validation, the code can be configured to either of the special values REMOTE_CODE (numeric code) or REMOTE_CODE_TEXT (text code). In this case, local code validation is bypassed but the frontend will still show a numeric or text code dialog. Use command_template to send the code to the remote device. Example configurations for remote code validation can be found here.
	Code String `json:"code,omitempty"`

	// If true the code is required to arm the alarm. If false the code is not validated.
	CodeArmRequired Boolean `json:"code_arm_required,omitempty" default:"true"`

	// If true the code is required to disarm the alarm. If false the code is not validated.
	CodeDisarmRequired Boolean `json:"code_disarm_required,omitempty" default:"true"`

	// If true the code is required to trigger the alarm. If false the code is not validated.
	CodeTriggerRequired Boolean `json:"code_trigger_required,omitempty" default:"true"`

	// The template used for the command payload. Available variables: action and code.
	CommandTemplate String `json:"command_template,omitempty" default:"action"`

	// The MQTT topic to publish commands to change the alarm state.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this alarm panel is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the alarm.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload to set armed-away mode on your Alarm Panel.
	PayloadArmAway String `json:"payload_arm_away,omitempty" default:"ARM_AWAY"`

	// The payload to set armed-home mode on your Alarm Panel.
	PayloadArmHome String `json:"payload_arm_home,omitempty" default:"ARM_HOME"`

	// The payload to set armed-night mode on your Alarm Panel.
	PayloadArmNight String `json:"payload_arm_night,omitempty" default:"ARM_NIGHT"`

	// The payload to set armed-vacation mode on your Alarm Panel.
	PayloadArmVacation String `json:"payload_arm_vacation,omitempty" default:"ARM_VACATION"`

	// The payload to set armed-custom-bypass mode on your Alarm Panel.
	PayloadArmCustomBypass String `json:"payload_arm_custom_bypass,omitempty" default:"ARM_CUSTOM_BYPASS"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload to disarm your Alarm Panel.
	PayloadDisarm String `json:"payload_disarm,omitempty" default:"DISARM"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload to trigger the alarm on your Alarm Panel.
	PayloadTrigger String `json:"payload_trigger,omitempty" default:"TRIGGER"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty" required:"true"`

	// An ID that uniquely identifies this alarm panel. If two alarm panels have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract the value.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*AlarmControlPanel) Json

func (c *AlarmControlPanel) Json() string

type Availability

type Availability struct {
	// payload_available string (optional, default: online)
	// The payload that represents the available state.
	PayloadAvailable string `json:"payload_available,omitempty" required:"false"`

	// payload_not_available string (optional, default: offline)
	// The payload that represents the unavailable state.
	PayloadNotAvailable string `json:"payload_not_available,omitempty" required:"false"`

	// topic string REQUIRED
	// An MQTT topic subscribed to receive availability (online/offline) updates.
	Topic string `json:"topic,omitempty" required:"true"`

	// value_template template (optional)
	// Defines a template to extract device’s availability from the topic.
	// To determine the devices’ availability result of this template will be compared to payload_available and payload_not_available.
	ValueTemplate string `json:"value_template,omitempty" required:"false"`
}

Availability - availability list (optional) A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.

type BinarySensor

type BinarySensor struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive birth and LWT messages from the MQTT device. If availability is not defined, the binary sensor will always be considered available and its state will be on, off or unknown. If availability is defined, the binary sensor will be considered as unavailable by default and the sensor’s initial state will be unavailable. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Information about the device this binary sensor is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Sets the class of the device, changing the device state and icon that is displayed on the frontend.
	DeviceClass DeviceClass `json:"device_class,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// If set, it defines the number of seconds after the sensor’s state expires, if it’s not updated. After expiry, the sensor’s state becomes unavailable. Default the sensors state never expires.
	ExpireAfter Integer `json:"expire_after,omitempty"`

	// Sends update events (which results in update of state object’s last_changed) even if the sensor’s state hasn’t changed. Useful if you want to have meaningful value graphs in history or want to create an automation that triggers on every incoming state message (not only when the sensor’s new state is different to the current one).
	ForceUpdate Boolean `json:"force_update,omitempty" default:"false"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the binary sensor.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// For sensors that only send on state updates (like PIRs), this variable sets a delay in seconds after which the sensor’s state will be updated back to off.
	OffDelay Integer `json:"off_delay,omitempty"`

	// The string that represents the online state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The string that represents the offline state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The string that represents the off state. It will be compared to the message in the state_topic (see value_template for details)
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The string that represents the on state. It will be compared to the message in the state_topic (see value_template for details)
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The maximum QoS level to be used when receiving messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// The MQTT topic subscribed to receive sensor’s state.
	StateTopic String `json:"state_topic,omitempty" required:"true"`

	// An ID that uniquely identifies this sensor. If two sensors have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template that returns a string to be compared to payload_on/payload_off or an empty string, in which case the MQTT message will be removed. Remove this option when payload_on and payload_off are sufficient to match your payloads (i.e no pre-processing of original message is required).
	ValueTemplate String `json:"value_template,omitempty"`
}

func (*BinarySensor) Json

func (c *BinarySensor) Json() string

type Boolean

type Boolean bool

type Button

type Button struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish commands to trigger the button.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this button is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The type/class of the button to set the icon in the frontend.
	DeviceClass DeviceClass `json:"device_class,omitempty" default:"None"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the published messages.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name to use when displaying this button.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload To send to trigger the button.
	PayloadPress String `json:"payload_press,omitempty" default:"PRESS"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// An ID that uniquely identifies this button entity. If two buttons have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Button) Json

func (c *Button) Json() string

type Camera

type Camera struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Information about the device this camera is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received. Set to "" to disable decoding of incoming payload. Use image_encoding to enable Base64 decoding on topic.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// The encoding of the image payloads received. Set to "b64" to enable base64 decoding of image payload. If not set, the image payload must be raw binary data.
	ImageEncoding String `json:"image_encoding,omitempty" default:"None"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Implies force_update of the current sensor state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the camera.
	Name String `json:"name,omitempty"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The MQTT topic to subscribe to.
	Topic String `json:"topic,omitempty" required:"true"`

	// An ID that uniquely identifies this camera. If two cameras have the same unique ID Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Camera) Json

func (c *Camera) Json() string

type Climate

type Climate struct {
	// A template to render the value received on the action_topic with.
	ActionTemplate Template `json:"action_template,omitempty"`

	// The MQTT topic to subscribe for changes of the current action. If this is set, the climate graph uses the value received as data source. Valid values: off, heating, cooling, drying, idle, fan.
	ActionTopic String `json:"action_topic,omitempty"`

	// The MQTT topic to publish commands to switch auxiliary heat.
	AuxCommandTopic String `json:"aux_command_topic,omitempty"`

	// A template to render the value received on the aux_state_topic with.
	AuxStateTemplate Template `json:"aux_state_template,omitempty"`

	// The MQTT topic to subscribe for changes of the auxiliary heat mode. If this is not set, the auxiliary heat mode works in optimistic mode (see below).
	AuxStateTopic String `json:"aux_state_topic,omitempty"`

	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// A template with which the value received on current_temperature_topic will be rendered.
	CurrentTemperatureTemplate Template `json:"current_temperature_template,omitempty"`

	// The MQTT topic on which to listen for the current temperature.
	CurrentTemperatureTopic String `json:"current_temperature_topic,omitempty"`

	// Information about the device this HVAC device is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// A template to render the value sent to the fan_mode_command_topic with.
	FanModeCommandTemplate Template `json:"fan_mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the fan mode.
	FanModeCommandTopic String `json:"fan_mode_command_topic,omitempty"`

	// A template to render the value received on the fan_mode_state_topic with.
	FanModeStateTemplate Template `json:"fan_mode_state_template,omitempty"`

	// The MQTT topic to subscribe for changes of the HVAC fan mode. If this is not set, the fan mode works in optimistic mode (see below).
	FanModeStateTopic String `json:"fan_mode_state_topic,omitempty"`

	// A list of supported fan modes.
	FanModes List `json:"fan_modes,omitempty"`

	// Default: [“auto”, “low”, “medium”, “high”]
	// Set the initial target temperature.
	Initial Integer `json:"initial,omitempty" default:"21"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// Maximum set point available.
	MaxTemp Float `json:"max_temp,omitempty"`

	// Minimum set point available.
	MinTemp Float `json:"min_temp,omitempty"`

	// A template to render the value sent to the mode_command_topic with.
	ModeCommandTemplate Template `json:"mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the HVAC operation mode.
	ModeCommandTopic String `json:"mode_command_topic,omitempty"`

	// A template to render the value received on the mode_state_topic with.
	ModeStateTemplate Template `json:"mode_state_template,omitempty"`

	// The MQTT topic to subscribe for changes of the HVAC operation mode. If this is not set, the operation mode works in optimistic mode (see below).
	ModeStateTopic String `json:"mode_state_topic,omitempty"`

	// A list of supported modes. Needs to be a subset of the default values.
	Modes List `json:"modes,omitempty"`

	// Default: [“auto”, “off”, “cool”, “heat”, “dry”, “fan_only”]
	// The name of the HVAC.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents disabled state.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents enabled state.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The MQTT topic to publish commands to change the power state. This is useful if your device has a separate power toggle in addition to mode.
	PowerCommandTopic String `json:"power_command_topic,omitempty"`

	// The desired precision for this device. Can be used to match your actual thermostat’s precision. Supported values are 0.1, 0.5 and 1.0.
	Precision Float `json:"precision,omitempty"`

	// Default: 0.1 for Celsius and 1.0 for Fahrenheit.
	// Defines a template to generate the payload to send to preset_mode_command_topic.
	PresetModeCommandTemplate Template `json:"preset_mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the preset mode.
	PresetModeCommandTopic String `json:"preset_mode_command_topic,omitempty"`

	// The MQTT topic subscribed to receive climate speed based on presets. When preset ‘none’ is received or None the preset_mode will be reset.
	PresetModeStateTopic String `json:"preset_mode_state_topic,omitempty"`

	// Defines a template to extract the preset_mode value from the payload received on preset_mode_state_topic.
	PresetModeValueTemplate String `json:"preset_mode_value_template,omitempty"`

	// List of preset modes this climate is supporting. Common examples include eco, away, boost, comfort, home, sleep and activity.
	PresetModes List `json:"preset_modes,omitempty"`

	// The maximum QoS level to be used when receiving and publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// Defines if published messages should have the retain flag set.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// A template to render the value sent to the swing_mode_command_topic with.
	SwingModeCommandTemplate Template `json:"swing_mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the swing mode.
	SwingModeCommandTopic String `json:"swing_mode_command_topic,omitempty"`

	// A template to render the value received on the swing_mode_state_topic with.
	SwingModeStateTemplate Template `json:"swing_mode_state_template,omitempty"`

	// The MQTT topic to subscribe for changes of the HVAC swing mode. If this is not set, the swing mode works in optimistic mode (see below).
	SwingModeStateTopic String `json:"swing_mode_state_topic,omitempty"`

	// A list of supported swing modes - (optional, default: [“on”, “off”])
	SwingModes List `json:"swing_modes,omitempty"`

	// A template to render the value sent to the temperature_command_topic with.
	TemperatureCommandTemplate Template `json:"temperature_command_template,omitempty"`

	// The MQTT topic to publish commands to change the target temperature.
	TemperatureCommandTopic String `json:"temperature_command_topic,omitempty"`

	// A template to render the value sent to the temperature_high_command_topic with.
	TemperatureHighCommandTemplate Template `json:"temperature_high_command_template,omitempty"`

	// The MQTT topic to publish commands to change the high target temperature.
	TemperatureHighCommandTopic String `json:"temperature_high_command_topic,omitempty"`

	// A template to render the value received on the temperature_high_state_topic with.
	TemperatureHighStateTemplate Template `json:"temperature_high_state_template,omitempty"`

	// The MQTT topic to subscribe for changes in the target high temperature. If this is not set, the target high temperature works in optimistic mode (see below).
	TemperatureHighStateTopic String `json:"temperature_high_state_topic,omitempty"`

	// A template to render the value sent to the temperature_low_command_topic with.
	TemperatureLowCommandTemplate Template `json:"temperature_low_command_template,omitempty"`

	// The MQTT topic to publish commands to change the target low temperature.
	TemperatureLowCommandTopic String `json:"temperature_low_command_topic,omitempty"`

	// A template to render the value received on the temperature_low_state_topic with.
	TemperatureLowStateTemplate Template `json:"temperature_low_state_template,omitempty"`

	// The MQTT topic to subscribe for changes in the target low temperature. If this is not set, the target low temperature works in optimistic mode (see below).
	TemperatureLowStateTopic String `json:"temperature_low_state_topic,omitempty"`

	// A template to render the value received on the temperature_state_topic with.
	TemperatureStateTemplate Template `json:"temperature_state_template,omitempty"`

	// The MQTT topic to subscribe for changes in the target temperature. If this is not set, the target temperature works in optimistic mode (see below).
	TemperatureStateTopic String `json:"temperature_state_topic,omitempty"`

	// Defines the temperature unit of the device, C or F. If this is not set, the temperature unit is set to the system temperature unit.
	TemperatureUnit String `json:"temperature_unit,omitempty"`

	// Step size for temperature set point.
	TempStep Float `json:"temp_step,omitempty" default:"1"`

	// An ID that uniquely identifies this HVAC device. If two HVAC devices have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Default template to render the payloads on all *_state_topics with.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Climate) Json

func (c *Climate) Json() string

type Config

type Config struct {
	Entry        string       `json:"~,omitempty" required:"false"`
	Name         string       `json:"name,omitempty" required:"false"`
	UniqueId     string       `json:"unique_id,omitempty" required:"false"`
	StateTopic   string       `json:"state_topic,omitempty" required:"true"`
	DeviceConfig DeviceConfig `json:"device,omitempty" required:"false"`
}

func (*Config) Json

func (c *Config) Json() string

type Cover

type Cover struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive birth and LWT messages from the MQTT cover device. If an availability topic is not defined, the cover availability state will always be available. If an availability topic is defined, the cover availability state will be unavailable by default. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish commands to control the cover.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this cover is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Sets the class of the device, changing the device state and icon that is displayed on the frontend.
	DeviceClass String `json:"device_class,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the cover.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if switch works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: false if state or position topic defined, else true.
	// The payload that represents the online state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The command payload that closes the cover.
	PayloadClose String `json:"payload_close,omitempty" default:"CLOSE"`

	// The payload that represents the offline state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The command payload that opens the cover.
	PayloadOpen String `json:"payload_open,omitempty" default:"OPEN"`

	// The command payload that stops the cover.
	PayloadStop String `json:"payload_stop,omitempty" default:"STOP"`

	// Number which represents closed position.
	PositionClosed Integer `json:"position_closed,omitempty" default:"0"`

	// Number which represents open position.
	PositionOpen Integer `json:"position_open,omitempty" default:"100"`

	// Defines a template that can be used to extract the payload for the position_topic topic. Within the template the following variables are available: entity_id, position_open; position_closed; tilt_min; tilt_max. The entity_id can be used to reference the entity’s attributes with help of the states template function;
	PositionTemplate String `json:"position_template,omitempty"`

	// The MQTT topic subscribed to receive cover position messages.
	PositionTopic String `json:"position_topic,omitempty"`

	// The maximum QoS level to be used when receiving and publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// Defines if published messages should have the retain flag set.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// Defines a template to define the position to be sent to the set_position_topic topic. Incoming position value is available for use in the template {{ position }}. Within the template the following variables are available: entity_id, position, the target position in percent; position_open; position_closed; tilt_min; tilt_max. The entity_id can be used to reference the entity’s attributes with help of the states template function;
	SetPositionTemplate String `json:"set_position_template,omitempty"`

	// The MQTT topic to publish position commands to. You need to set position_topic as well if you want to use position topic. Use template if position topic wants different values than within range position_closed - position_open. If template is not defined and position_closed != 100 and position_open != 0 then proper position value is calculated from percentage position.
	SetPositionTopic String `json:"set_position_topic,omitempty"`

	// The payload that represents the closed state.
	StateClosed String `json:"state_closed,omitempty" default:"closed"`

	// The payload that represents the closing state.
	StateClosing String `json:"state_closing,omitempty" default:"closing"`

	// The payload that represents the open state.
	StateOpen String `json:"state_open,omitempty" default:"open"`

	// The payload that represents the opening state.
	StateOpening String `json:"state_opening,omitempty" default:"opening"`

	// The payload that represents the stopped state (for covers that do not report open/closed state).
	StateStopped String `json:"state_stopped,omitempty" default:"stopped"`

	// The MQTT topic subscribed to receive cover state messages. State topic can only read (open, opening, closed, closing or stopped) state.
	StateTopic String `json:"state_topic,omitempty"`

	// The value that will be sent on a close_cover_tilt command.
	TiltClosedValue Integer `json:"tilt_closed_value,omitempty" default:"0"`

	// Defines a template that can be used to extract the payload for the tilt_command_topic topic. Within the template the following variables are available: entity_id, tilt_position, the target tilt position in percent; position_open; position_closed; tilt_min; tilt_max. The entity_id can be used to reference the entity’s attributes with help of the states template function;
	TiltCommandTemplate String `json:"tilt_command_template,omitempty"`

	// The MQTT topic to publish commands to control the cover tilt.
	TiltCommandTopic String `json:"tilt_command_topic,omitempty"`

	// The maximum tilt value.
	TiltMax Integer `json:"tilt_max,omitempty" default:"100"`

	// The minimum tilt value.
	TiltMin Integer `json:"tilt_min,omitempty" default:"0"`

	// The value that will be sent on an open_cover_tilt command.
	TiltOpenedValue Integer `json:"tilt_opened_value,omitempty" default:"100"`

	// Flag that determines if tilt works in optimistic mode.
	TiltOptimistic Boolean `json:"tilt_optimistic,omitempty"`

	// Default: true if tilt_status_topic is not defined, else false
	// Defines a template that can be used to extract the payload for the tilt_status_topic topic. Within the template the following variables are available: entity_id, position_open; position_closed; tilt_min; tilt_max. The entity_id can be used to reference the entity’s attributes with help of the states template function;
	TiltStatusTemplate String `json:"tilt_status_template,omitempty"`

	// The MQTT topic subscribed to receive tilt status update values.
	TiltStatusTopic String `json:"tilt_status_topic,omitempty"`

	// An ID that uniquely identifies this cover. If two covers have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template that can be used to extract the payload for the state_topic topic.
	ValueTemplate String `json:"value_template,omitempty"`
}

func (*Cover) Json

func (c *Cover) Json() string

type Device

type Device struct {
	// configuration_url string (optional)
	// A link to the webpage that can manage the configuration of this device. Can be either an HTTP or HTTPS link.
	ConfigurationUrl string `json:"configuration_url,omitempty" required:"false"`

	// hw_version string (optional)
	// The hardware version of the device.
	HwVersion string `json:"hw_version,omitempty" required:"false"`

	// connections list (optional)
	// A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier].
	// For example the MAC address of a network interface: "connections": ["mac", "02:5b:26:a8:dc:12"].
	Connections [][]string `json:"connections,omitempty" required:"false"`

	// identifiers list | string (optional)
	// A list of IDs that uniquely identify the device. For example a serial number.
	Identifiers []string `json:"identifiers,omitempty" required:"false"`

	// manufacturer string (optional)
	// The manufacturer of the device.
	Manufacturer string `json:"manufacturer,omitempty" required:"false"`

	// model string (optional)
	// The model of the device.
	Model string `json:"model,omitempty" required:"false"`

	// name string (optional)
	// The name of the device.
	Name string `json:"name,omitempty" required:"false"`

	// suggested_area string (optional)
	// Suggest an area if the device isn’t in one yet.
	SuggestedArea string `json:"suggested_area,omitempty" required:"false"`

	// sw_version string (optional)
	// The firmware version of the device.
	SwVersion string `json:"sw_version,omitempty" required:"false"`

	// via_device string (optional)
	// Identifier of a device that routes messages between this device and Home Assistant.
	// Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.
	ViaDevice string `json:"via_device,omitempty" required:"false"`
}

Device - device map (optional) Information about the device this Select is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.

type DeviceClass

type DeviceClass string

type DeviceConfig

type DeviceConfig struct {
	Identifiers  []string `json:"identifiers,omitempty" required:"false"`
	SwVersion    string   `json:"sw_version,omitempty" required:"false"`
	Name         string   `json:"name,omitempty" required:"false"`
	Manufacturer string   `json:"manufacturer,omitempty" required:"false"`
	Model        string   `json:"model,omitempty" required:"false"`
}

type DeviceTracker

type DeviceTracker struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Information about the device this device tracker is a part of that ties it into the device registry. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as device_tracker attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the MQTT device_tracker.
	Name String `json:"name,omitempty"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload value that represents the ‘home’ state for the device.
	PayloadHome String `json:"payload_home,omitempty" default:"home"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload value that represents the ‘not_home’ state for the device.
	PayloadNotHome String `json:"payload_not_home,omitempty" default:"not_home"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// Attribute of a device tracker that affects state when being used to track a person. Valid options are gps, router, bluetooth, or bluetooth_le.
	SourceType String `json:"source_type,omitempty"`

	// The MQTT topic subscribed to receive device tracker state changes.
	StateTopic String `json:"state_topic,omitempty" required:"true"`

	// An ID that uniquely identifies this device_tracker. If two device_trackers have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template that returns a device tracker state.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*DeviceTracker) Json

func (c *DeviceTracker) Json() string

type DeviceTrigger

type DeviceTrigger struct {
	// The type of automation, must be ‘trigger’.
	AutomationType String `json:"automation_type,omitempty" required:"true"`

	// Optional payload to match the payload being sent over the topic.
	Payload String `json:"payload,omitempty"`

	// The maximum QoS level to be used when receiving messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// The MQTT topic subscribed to receive trigger events.
	Topic String `json:"topic,omitempty" required:"true"`

	// The type of the trigger, e.g. button_short_press. Entries supported by the frontend: button_short_press, button_short_release, button_long_press, button_long_release, button_double_press, button_triple_press, button_quadruple_press, button_quintuple_press. If set to an unsupported value, will render as subtype type, e.g. button_1 spammed with type set to spammed and subtype set to button_1
	Type String `json:"type,omitempty" required:"true"`

	// The subtype of the trigger, e.g. button_1. Entries supported by the frontend: turn_on, turn_off, button_1, button_2, button_3, button_4, button_5, button_6. If set to an unsupported value, will render as subtype type, e.g. left_button pressed with type set to button_short_press and subtype set to left_button
	Subtype String `json:"subtype,omitempty" required:"true"`

	// Information about the device this device trigger is a part of to tie it into the device registry. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty" required:"true"`

	// Defines a template to extract the value.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*DeviceTrigger) Json

func (c *DeviceTrigger) Json() string

type EntityConfig

type EntityConfig struct {
	// Type          string
	Name    string
	SubName string

	ParentId   string
	ParentName string

	UniqueId    string
	FullId      string
	Units       string
	ValueName   string
	DeviceClass string
	StateClass  string
	Icon        string

	Value         *valueTypes.UnitValue
	Point         *api.Point
	ValueTemplate string

	UpdateFreq             string
	LastReset              string
	LastResetValueTemplate string

	IgnoreUpdate bool

	Options []string
	// contains filtered or unexported fields
}

func (*EntityConfig) FixConfig

func (config *EntityConfig) FixConfig()

func (*EntityConfig) IsAlarmControlPanel

func (config *EntityConfig) IsAlarmControlPanel() bool

func (*EntityConfig) IsBinarySensor

func (config *EntityConfig) IsBinarySensor() bool

func (*EntityConfig) IsButton

func (config *EntityConfig) IsButton() bool

func (*EntityConfig) IsCamera

func (config *EntityConfig) IsCamera() bool

func (*EntityConfig) IsClimate

func (config *EntityConfig) IsClimate() bool

func (*EntityConfig) IsCover

func (config *EntityConfig) IsCover() bool

func (*EntityConfig) IsDeviceTracker

func (config *EntityConfig) IsDeviceTracker() bool

func (*EntityConfig) IsDeviceTrigger

func (config *EntityConfig) IsDeviceTrigger() bool

func (*EntityConfig) IsFan

func (config *EntityConfig) IsFan() bool

func (*EntityConfig) IsHumidifier

func (config *EntityConfig) IsHumidifier() bool

func (*EntityConfig) IsLight

func (config *EntityConfig) IsLight() bool

func (*EntityConfig) IsLock

func (config *EntityConfig) IsLock() bool

func (*EntityConfig) IsNumber

func (config *EntityConfig) IsNumber() bool

func (*EntityConfig) IsScene

func (config *EntityConfig) IsScene() bool

func (*EntityConfig) IsSelect

func (config *EntityConfig) IsSelect() bool

func (*EntityConfig) IsSensor

func (config *EntityConfig) IsSensor() bool

func (*EntityConfig) IsSiren

func (config *EntityConfig) IsSiren() bool

func (*EntityConfig) IsSwitch

func (config *EntityConfig) IsSwitch() bool

func (*EntityConfig) IsTag

func (config *EntityConfig) IsTag() bool

func (*EntityConfig) IsText

func (config *EntityConfig) IsText() bool

func (*EntityConfig) IsUpdate

func (config *EntityConfig) IsUpdate() bool

func (*EntityConfig) IsVacuum

func (config *EntityConfig) IsVacuum() bool

type Fan

type Fan struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish commands to change the fan state.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this fan is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the fan.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if fan works in optimistic mode
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state topic defined, else false.
	// Defines a template to generate the payload to send to oscillation_command_topic.
	OscillationCommandTemplate Template `json:"oscillation_command_template,omitempty"`

	// The MQTT topic to publish commands to change the oscillation state.
	OscillationCommandTopic String `json:"oscillation_command_topic,omitempty"`

	// The MQTT topic subscribed to receive oscillation state updates.
	OscillationStateTopic String `json:"oscillation_state_topic,omitempty"`

	// Defines a template to extract a value from the oscillation.
	OscillationValueTemplate String `json:"oscillation_value_template,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents the stop state.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents the running state.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The payload that represents the oscillation off state.
	PayloadOscillationOff String `json:"payload_oscillation_off,omitempty" default:"oscillate_off"`

	// The payload that represents the oscillation on state.
	PayloadOscillationOn String `json:"payload_oscillation_on,omitempty" default:"oscillate_on"`

	// A special payload that resets the percentage state attribute to None when received at the percentage_state_topic.
	PayloadResetPercentage String `json:"payload_reset_percentage,omitempty" default:"None"`

	// A special payload that resets the preset_mode state attribute to None when received at the preset_mode_state_topic.
	PayloadResetPresetMode String `json:"payload_reset_preset_mode,omitempty" default:"None"`

	// Defines a template to generate the payload to send to percentage_command_topic.
	PercentageCommandTemplate Template `json:"percentage_command_template,omitempty"`

	// The MQTT topic to publish commands to change the fan speed state based on a percentage.
	PercentageCommandTopic String `json:"percentage_command_topic,omitempty"`

	// The MQTT topic subscribed to receive fan speed based on percentage.
	PercentageStateTopic String `json:"percentage_state_topic,omitempty"`

	// Defines a template to extract the percentage value from the payload received on percentage_state_topic.
	PercentageValueTemplate String `json:"percentage_value_template,omitempty"`

	// Defines a template to generate the payload to send to preset_mode_command_topic.
	PresetModeCommandTemplate Template `json:"preset_mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the preset mode.
	PresetModeCommandTopic String `json:"preset_mode_command_topic,omitempty"`

	// The MQTT topic subscribed to receive fan speed based on presets.
	PresetModeStateTopic String `json:"preset_mode_state_topic,omitempty"`

	// Defines a template to extract the preset_mode value from the payload received on preset_mode_state_topic.
	PresetModeValueTemplate String `json:"preset_mode_value_template,omitempty"`

	// List of preset modes this fan is capable of running at. Common examples include auto, smart, whoosh, eco and breeze.
	PresetModes List `json:"preset_modes,omitempty"(optional, default: [])`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"true"`

	// The maximum of numeric output range (representing 100 %). The number of speeds within the speed_range / 100 will determine the percentage_step.
	SpeedRangeMax Integer `json:"speed_range_max,omitempty" default:"100"`

	// The minimum of numeric output range (off not included, so speed_range_min - 1 represents 0 %). The number of speeds within the speed_range / 100 will determine the percentage_step.
	SpeedRangeMin Integer `json:"speed_range_min,omitempty" default:"1"`

	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty"`

	// Defines a template to extract a value from the state.
	StateValueTemplate String `json:"state_value_template,omitempty"`

	// An ID that uniquely identifies this fan. If two fans have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Fan) Json

func (c *Fan) Json() string

type Fields

type Fields map[string]string

type Float

type Float float64

type Humidifier

type Humidifier struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish commands to change the humidifier state.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this humidifier is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The device class of the MQTT device. Must be either humidifier or dehumidifier.
	DeviceClass String `json:"device_class,omitempty" default:"humidifier"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The minimum target humidity percentage that can be set.
	MaxHumidity Integer `json:"max_humidity,omitempty" default:"100"`

	// The maximum target humidity percentage that can be set.
	MinHumidity Integer `json:"min_humidity,omitempty" default:"0"`

	// The name of the humidifier.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if humidifier works in optimistic mode
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state topic defined, else false.
	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents the stop state.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents the running state.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// A special payload that resets the target_humidity state attribute to None when received at the target_humidity_state_topic.
	PayloadResetHumidity String `json:"payload_reset_humidity,omitempty" default:"None"`

	// A special payload that resets the mode state attribute to None when received at the mode_state_topic.
	PayloadResetMode String `json:"payload_reset_mode,omitempty" default:"None"`

	// Defines a template to generate the payload to send to target_humidity_command_topic.
	TargetHumidityCommandTemplate Template `json:"target_humidity_command_template,omitempty"`

	// The MQTT topic to publish commands to change the humidifier target humidity state based on a percentage.
	TargetHumidityCommandTopic String `json:"target_humidity_command_topic,omitempty" required:"true"`

	// The MQTT topic subscribed to receive humidifier target humidity.
	TargetHumidityStateTopic String `json:"target_humidity_state_topic,omitempty"`

	// Defines a template to extract a value for the humidifier target_humidity state.
	TargetHumidityStateTemplate String `json:"target_humidity_state_template,omitempty"`

	// Defines a template to generate the payload to send to mode_command_topic.
	ModeCommandTemplate Template `json:"mode_command_template,omitempty"`

	// The MQTT topic to publish commands to change the mode on the humidifier. This attribute ust be configured together with the modes attribute.
	ModeCommandTopic String `json:"mode_command_topic,omitempty"`

	// The MQTT topic subscribed to receive the humidifier mode.
	ModeStateTopic String `json:"mode_state_topic,omitempty"`

	// Defines a template to extract a value for the humidifier mode state.
	ModeStateTemplate String `json:"mode_state_template,omitempty"`

	// List of available modes this humidifier is capable of running at. Common examples include normal, eco, away, boost, comfort, home, sleep, auto and baby. These examples offer built-in translations but other custom modes are allowed as well. This attribute ust be configured together with the mode_command_topic attribute.
	Modes List `json:"modes,omitempty"(optional, default: [])`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"true"`

	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty"`

	// Defines a template to extract a value from the state.
	StateValueTemplate String `json:"state_value_template,omitempty"`

	// An ID that uniquely identifies this humidifier. If two humidifiers have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Humidifier) Json

func (c *Humidifier) Json() string

type Icon

type Icon string

type Integer

type Integer int64

type Light

type Light struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish commands to change the light’s brightness.
	BrightnessCommandTopic String `json:"brightness_command_topic,omitempty"`

	// Defines a template to compose message which will be sent to brightness_command_topic. Available variables: value.
	BrightnessCommandTemplate String `json:"brightness_command_template,omitempty"`

	// Defines the maximum brightness value (i.e., 100%) of the MQTT device.
	BrightnessScale Integer `json:"brightness_scale,omitempty" default:"255"`

	// The MQTT topic subscribed to receive brightness state updates.
	BrightnessStateTopic String `json:"brightness_state_topic,omitempty"`

	// Defines a template to extract the brightness value.
	BrightnessValueTemplate String `json:"brightness_value_template,omitempty"`

	// The MQTT topic subscribed to receive color mode updates. If this is not configured, color_mode will be automatically set according to the last received valid color or color temperature
	ColorModeStateTopic String `json:"color_mode_state_topic,omitempty"`

	// Defines a template to extract the color mode.
	ColorModeValueTemplate String `json:"color_mode_value_template,omitempty"`

	// Defines a template to compose message which will be sent to color_temp_command_topic. Available variables: value.
	ColorTempCommandTemplate String `json:"color_temp_command_template,omitempty"`

	// The MQTT topic to publish commands to change the light’s color temperature state. The color temperature command slider has a range of 153 to 500 mireds (micro reciprocal degrees).
	ColorTempCommandTopic String `json:"color_temp_command_topic,omitempty"`

	// The MQTT topic subscribed to receive color temperature state updates.
	ColorTempStateTopic String `json:"color_temp_state_topic,omitempty"`

	// Defines a template to extract the color temperature value.
	ColorTempValueTemplate String `json:"color_temp_value_template,omitempty"`

	// The MQTT topic to publish commands to change the switch state.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this light is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// The MQTT topic to publish commands to change the light’s effect state.
	EffectCommandTopic String `json:"effect_command_topic,omitempty"`

	// Defines a template to compose message which will be sent to effect_command_topic. Available variables: value.
	EffectCommandTemplate String `json:"effect_command_template,omitempty"`

	// The MQTT topic subscribed to receive effect state updates.
	EffectStateTopic String `json:"effect_state_topic,omitempty"`

	// Defines a template to extract the effect value.
	EffectValueTemplate String `json:"effect_value_template,omitempty"`

	// The MQTT topic to publish commands to change the light’s color state in HS format (Hue Saturation). Range for Hue: 0° .. 360°, Range of Saturation: 0..100. Note: Brightness is sent separately in the brightness_command_topic.
	HsCommandTopic String `json:"hs_command_topic,omitempty"`

	// The MQTT topic subscribed to receive color state updates in HS format. Note: Brightness is received separately in the brightness_state_topic.
	HsStateTopic String `json:"hs_state_topic,omitempty"`

	// Defines a template to extract the HS value.
	HsValueTemplate String `json:"hs_value_template,omitempty"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The maximum color temperature in mireds.
	MaxMireds Integer `json:"max_mireds,omitempty"`

	// The minimum color temperature in mireds.
	MinMireds Integer `json:"min_mireds,omitempty"`

	// The name of the light.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Defines when on the payload_on is sent. Using last (the default) will send any style (brightness, color, etc) topics first and then a payload_on to the command_topic. Using first will send the payload_on and then any style topics. Using brightness will only send brightness commands instead of the payload_on to turn the light on.
	OnCommandType String `json:"on_command_type,omitempty"`

	// Flag that defines if switch works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state topic defined, else false.
	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents disabled state.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents enabled state.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// Defines a template to compose message which will be sent to rgb_command_topic. Available variables: red, green and blue.
	RgbCommandTemplate String `json:"rgb_command_template,omitempty"`

	// The MQTT topic to publish commands to change the light’s RGB state.
	RgbCommandTopic String `json:"rgb_command_topic,omitempty"`

	// The MQTT topic subscribed to receive RGB state updates. The expected payload is the RGB values separated by commas, for example, 255,0,127.
	RgbStateTopic String `json:"rgb_state_topic,omitempty"`

	// Defines a template to extract the RGB value.
	RgbValueTemplate String `json:"rgb_value_template,omitempty"`

	// Defines a template to compose message which will be sent to rgbw_command_topic. Available variables: red, green, blue and white.
	RgbwCommandTemplate String `json:"rgbw_command_template,omitempty"`

	// The MQTT topic to publish commands to change the light’s RGBW state.
	RgbwCommandTopic String `json:"rgbw_command_topic,omitempty"`

	// The MQTT topic subscribed to receive RGBW state updates. The expected payload is the RGBW values separated by commas, for example, 255,0,127,64.
	RgbwStateTopic String `json:"rgbw_state_topic,omitempty"`

	// Defines a template to extract the RGBW value.
	RgbwValueTemplate String `json:"rgbw_value_template,omitempty"`

	// Defines a template to compose message which will be sent to rgbww_command_topic. Available variables: red, green, blue, cold_white and warm_white.
	RgbwwCommandTemplate String `json:"rgbww_command_template,omitempty"`

	// The MQTT topic to publish commands to change the light’s RGBWW state.
	RgbwwCommandTopic String `json:"rgbww_command_topic,omitempty"`

	// The MQTT topic subscribed to receive RGBWW state updates. The expected payload is the RGBWW values separated by commas, for example, 255,0,127,64,32.
	RgbwwStateTopic String `json:"rgbww_state_topic,omitempty"`

	// Defines a template to extract the RGBWW value.
	RgbwwValueTemplate String `json:"rgbww_value_template,omitempty"`

	// The schema to use. Must be default or omitted to select the default schema.
	Schema String `json:"schema,omitempty" default:"default"`

	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty"`

	// Defines a template to extract the state value. The template should match the payload on and off values, so if your light uses power on to turn on, your state_value_template string should return power on when the switch is on. For example if the message is just on, your state_value_template should be power .
	StateValueTemplate String `json:"state_value_template,omitempty"`

	// An ID that uniquely identifies this light. If two lights have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// The MQTT topic to publish commands to change the light to white mode with a given brightness.
	WhiteCommandTopic String `json:"white_command_topic,omitempty"`

	// Defines the maximum white level (i.e., 100%) of the MQTT device.
	WhiteScale Integer `json:"white_scale,omitempty" default:"255"`

	// The MQTT topic to publish commands to change the light’s XY state.
	XyCommandTopic String `json:"xy_command_topic,omitempty"`

	// The MQTT topic subscribed to receive XY state updates.
	XyStateTopic String `json:"xy_state_topic,omitempty"`

	// Defines a template to extract the XY value.
	XyValueTemplate String `json:"xy_value_template,omitempty"`
}

func (*Light) Json

func (c *Light) Json() string

type List

type List []string

type Lock

type Lock struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish commands to change the lock state.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this lock is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the lock.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if lock works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state_topic defined, else false.
	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload sent to the lock to lock it.
	PayloadLock String `json:"payload_lock,omitempty" default:"LOCK"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload sent to the lock to unlock it.
	PayloadUnlock String `json:"payload_unlock,omitempty" default:"UNLOCK"`

	// The payload sent to the lock to open it.
	PayloadOpen String `json:"payload_open,omitempty" default:"OPEN"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The payload sent to by the lock when it’s locked.
	StateLocked String `json:"state_locked,omitempty" default:"LOCKED"`

	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty"`

	// The payload sent to by the lock when it’s unlocked.
	StateUnlocked String `json:"state_unlocked,omitempty" default:"UNLOCKED"`

	// An ID that uniquely identifies this lock. If two locks have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract a value from the payload.
	ValueTemplate String `json:"value_template,omitempty"`
}

func (*Lock) Json

func (c *Lock) Json() string

type Mqtt

type Mqtt struct {
	ClientId     string        `json:"client_id"`
	Username     string        `json:"username"`
	Password     string        `json:"password"`
	Host         string        `json:"host"`
	Port         string        `json:"port"`
	Timeout      time.Duration `json:"timeout"`
	EntityPrefix string        `json:"entity_prefix"`

	DeviceName     string
	LastRefresh    time.Time             `json:"-"`
	SungrowDevices getDeviceList.Devices `json:"-"`
	SungrowPsIds   map[valueTypes.PsId]bool
	MqttDevices    map[string]Device
	Prefix         string
	UserOptions    Options
	// contains filtered or unexported fields
}

func New

func New(req Mqtt) *Mqtt

func (*Mqtt) AlarmControlPanelPublishConfig

func (m *Mqtt) AlarmControlPanelPublishConfig(config EntityConfig) error

func (*Mqtt) AlarmControlPanelPublishValue

func (m *Mqtt) AlarmControlPanelPublishValue(config EntityConfig) error

func (*Mqtt) BinarySensorPublishConfig

func (m *Mqtt) BinarySensorPublishConfig(config EntityConfig) error

func (*Mqtt) BinarySensorPublishValue

func (m *Mqtt) BinarySensorPublishValue(config EntityConfig) error

func (*Mqtt) ButtonPublishConfig

func (m *Mqtt) ButtonPublishConfig(config EntityConfig) error

func (*Mqtt) ButtonPublishValue

func (m *Mqtt) ButtonPublishValue(config EntityConfig) error

func (*Mqtt) CameraPublishConfig

func (m *Mqtt) CameraPublishConfig(config EntityConfig) error

func (*Mqtt) CameraPublishValue

func (m *Mqtt) CameraPublishValue(config EntityConfig) error

func (*Mqtt) ClimatePublishConfig

func (m *Mqtt) ClimatePublishConfig(config EntityConfig) error

func (*Mqtt) ClimatePublishValue

func (m *Mqtt) ClimatePublishValue(config EntityConfig) error

func (*Mqtt) Connect

func (m *Mqtt) Connect() error

func (*Mqtt) CoverPublishConfig

func (m *Mqtt) CoverPublishConfig(config EntityConfig) error

func (*Mqtt) CoverPublishValue

func (m *Mqtt) CoverPublishValue(config EntityConfig) error

func (*Mqtt) CreateOption

func (m *Mqtt) CreateOption(id string, name string, fn mqtt.MessageHandler, options ...string) error

func (*Mqtt) DeviceTrackerPublishConfig

func (m *Mqtt) DeviceTrackerPublishConfig(config EntityConfig) error

func (*Mqtt) DeviceTrackerPublishValue

func (m *Mqtt) DeviceTrackerPublishValue(config EntityConfig) error

func (*Mqtt) DeviceTriggerPublishConfig

func (m *Mqtt) DeviceTriggerPublishConfig(config EntityConfig) error

func (*Mqtt) DeviceTriggerPublishValue

func (m *Mqtt) DeviceTriggerPublishValue(config EntityConfig) error

func (*Mqtt) Disconnect

func (m *Mqtt) Disconnect() error

func (*Mqtt) FanPublishConfig

func (m *Mqtt) FanPublishConfig(config EntityConfig) error

func (*Mqtt) FanPublishValue

func (m *Mqtt) FanPublishValue(config EntityConfig) error

func (*Mqtt) GetError

func (m *Mqtt) GetError() error

func (*Mqtt) GetOption

func (m *Mqtt) GetOption(id string) string

func (*Mqtt) GetSensorStateTopic

func (m *Mqtt) GetSensorStateTopic(config EntityConfig) string

func (*Mqtt) HumidifierPublishConfig

func (m *Mqtt) HumidifierPublishConfig(config EntityConfig) error

func (*Mqtt) HumidifierPublishValue

func (m *Mqtt) HumidifierPublishValue(config EntityConfig) error

func (*Mqtt) IsError

func (m *Mqtt) IsError() bool

func (*Mqtt) IsFirstRun

func (m *Mqtt) IsFirstRun() bool

func (*Mqtt) IsNewDay

func (m *Mqtt) IsNewDay() bool

func (*Mqtt) IsNotFirstRun

func (m *Mqtt) IsNotFirstRun() bool

func (*Mqtt) LightPublishValue

func (m *Mqtt) LightPublishValue(config EntityConfig) error

func (*Mqtt) LockPublishConfig

func (m *Mqtt) LockPublishConfig(config EntityConfig) error

func (*Mqtt) LockPublishValue

func (m *Mqtt) LockPublishValue(config EntityConfig) error

func (*Mqtt) NewDevice

func (m *Mqtt) NewDevice(config EntityConfig) (bool, Device)

func (*Mqtt) NumberPublishConfig

func (m *Mqtt) NumberPublishConfig(config EntityConfig) error

func (*Mqtt) NumberPublishValue

func (m *Mqtt) NumberPublishValue(config EntityConfig) error

func (*Mqtt) Publish

func (m *Mqtt) Publish(topic string, qos byte, retained bool, payload string) error

func (*Mqtt) PublishLightConfig

func (m *Mqtt) PublishLightConfig(config EntityConfig) error

func (*Mqtt) PublishSensorValues

func (m *Mqtt) PublishSensorValues(configs []EntityConfig) error

func (*Mqtt) PublishValue

func (m *Mqtt) PublishValue(Type string, subtopic string, value string) error

func (*Mqtt) ScenePublishConfig

func (m *Mqtt) ScenePublishConfig(config EntityConfig) error

func (*Mqtt) ScenePublishValue

func (m *Mqtt) ScenePublishValue(config EntityConfig) error

func (*Mqtt) SelectPublishConfig

func (m *Mqtt) SelectPublishConfig(config EntityConfig, fn mqtt.MessageHandler) error

func (*Mqtt) SelectPublishValue

func (m *Mqtt) SelectPublishValue(config EntityConfig) error

func (*Mqtt) SensorPublishConfig

func (m *Mqtt) SensorPublishConfig(config EntityConfig) error

func (*Mqtt) SensorPublishValue

func (m *Mqtt) SensorPublishValue(config EntityConfig) error

func (*Mqtt) SetAuth

func (m *Mqtt) SetAuth(username string, password string) error

func (*Mqtt) SetDeviceConfig

func (m *Mqtt) SetDeviceConfig(swname string, parentId string, id string, name string, model string, vendor string, area string) (Device, error)

func (*Mqtt) SetOption

func (m *Mqtt) SetOption(id string, value string) error

func (*Mqtt) SirenPublishConfig

func (m *Mqtt) SirenPublishConfig(config EntityConfig) error

func (*Mqtt) SirenPublishValue

func (m *Mqtt) SirenPublishValue(config EntityConfig) error

func (*Mqtt) Subscribe

func (m *Mqtt) Subscribe(topic string, fn mqtt.MessageHandler) error

func (*Mqtt) SwitchPublishConfig

func (m *Mqtt) SwitchPublishConfig(config EntityConfig) error

func (*Mqtt) SwitchPublishValue

func (m *Mqtt) SwitchPublishValue(config EntityConfig) error

func (*Mqtt) TagPublishConfig

func (m *Mqtt) TagPublishConfig(config EntityConfig) error

func (*Mqtt) TagPublishValue

func (m *Mqtt) TagPublishValue(config EntityConfig) error

func (*Mqtt) TextPublishConfig

func (m *Mqtt) TextPublishConfig(config EntityConfig) error

func (*Mqtt) TextPublishValue

func (m *Mqtt) TextPublishValue(config EntityConfig) error

func (*Mqtt) UnsetFirstRun

func (m *Mqtt) UnsetFirstRun()

func (*Mqtt) UpdatePublishConfig

func (m *Mqtt) UpdatePublishConfig(config EntityConfig) error

func (*Mqtt) UpdatePublishValue

func (m *Mqtt) UpdatePublishValue(config EntityConfig) error

func (*Mqtt) VacuumPublishConfig

func (m *Mqtt) VacuumPublishConfig(config EntityConfig) error

func (*Mqtt) VacuumPublishValue

func (m *Mqtt) VacuumPublishValue(config EntityConfig) error

type MqttState

type MqttState struct {
	LastReset string `json:"last_reset,omitempty"`
	Value     string `json:"value"`
}

func (*MqttState) Json

func (mq *MqttState) Json() string

type Number

type Number struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish commands to change the number.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this Number is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The type/class of the number.
	DeviceClass DeviceClass `json:"device_class,omitempty" default:"None"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as number attributes. Implies force_update of the current number state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// Minimum value.
	Min Float `json:"min,omitempty" default:"1"`

	// Maximum value.
	Max Float `json:"max,omitempty" default:"100"`

	// Control how the number should be displayed in the UI. Can be set to box or slider to force a display mode.
	Mode String `json:"mode,omitempty"(optional, default: “auto”)`

	// The name of the Number.
	Name String `json:"name,omitempty"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if number works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state_topic defined, else false.
	// A special payload that resets the state to None when received on the state_topic.
	PayloadReset String `json:"payload_reset,omitempty"(optional, default: “None”)`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The MQTT topic subscribed to receive number values.
	StateTopic String `json:"state_topic,omitempty"`

	// Step value. Smallest value 0.001.
	Step Float `json:"step,omitempty" default:"1"`

	// An ID that uniquely identifies this Number. If two Numbers have the same unique ID Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines the unit of measurement of the sensor, if any.
	UnitOfMeasurement String `json:"unit_of_measurement,omitempty"`

	// Defines a template to extract the value.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Number) Json

func (c *Number) Json() string

type Option

type Option struct {
	Config  *EntityConfig
	Handler mqtt.MessageHandler
	Values  []string
}

type Options

type Options struct {
	Map map[string]Option
	// contains filtered or unexported fields
}

func (*Options) Create

func (m *Options) Create(id string, name string, handler mqtt.MessageHandler, values ...string) error

func (*Options) EntityConfig

func (m *Options) EntityConfig(id string) *EntityConfig

func (*Options) Get

func (m *Options) Get(id string) string

func (*Options) New

func (m *Options) New()

func (*Options) Set

func (m *Options) Set(id string, value string) error

type Scene

type Scene struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish payload_on to activate the scene.
	CommandTopic String `json:"command_topic,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the scene.
	Icon Icon `json:"icon,omitempty"`

	// The name to use when displaying this scene.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that will be sent to command_topic when activating the MQTT scene.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// An ID that uniquely identifies this scene entity. If two scenes have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Scene) Json

func (c *Scene) Json() string

type Select

type Select struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish commands to change the selected option.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this Select is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes. Implies force_update of the current select state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the Select.
	Name String `json:"name,omitempty"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if the select works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state_topic defined, else false.
	// List of options that can be selected. An empty list or a list with a single item is allowed.
	Options List `json:"options,omitempty" required:"true"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The MQTT topic subscribed to receive update of the selected option.
	StateTopic String `json:"state_topic,omitempty"`

	// An ID that uniquely identifies this Select. If two Selects have the same unique ID Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract the value.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Select) Json

func (c *Select) Json() string

type Sensor

type Sensor struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" Default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’ availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// Information about the device this sensor is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The type/class of the sensor to set the icon in the frontend.
	DeviceClass DeviceClass `json:"device_class,omitempty" Default:"None"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" Default:"true"`

	// The encoding of the payloads received. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" Default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" Default:"None"`

	// If set, it defines the number of seconds after the sensor’s state expires, if it’s not updated. After expiry, the sensor’s state becomes unavailable. Default the sensors state never expires.
	ExpireAfter Integer `json:"expire_after,omitempty" Default:"0"`

	// Sends update events even if the value hasn’t changed. Useful if you want to have meaningful value graphs in history.
	ForceUpdate Boolean `json:"force_update,omitempty" Default:"false"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Implies force_update of the current sensor state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// Defines a template to extract the last_reset. Available variables: entity_id. The entity_id can be used to reference the entity’s attributes.
	LastResetValueTemplate String `json:"last_reset_value_template,omitempty"`

	// The name of the MQTT sensor.
	Name String `json:"name,omitempty" Default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" Default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" Default:"offline"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" Default:"0"`

	// The state_class of the sensor.
	StateClass String `json:"state_class,omitempty" Default:"None"`

	// The MQTT topic subscribed to receive sensor values.
	StateTopic String `json:"state_topic,omitempty" required:"true"`

	// An ID that uniquely identifies this sensor. If two sensors have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines the units of measurement of the sensor, if any.
	UnitOfMeasurement String `json:"unit_of_measurement,omitempty"`

	// Defines a template to extract the value. If the template throws an error, the current state will be used instead.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Sensor) Json

func (c *Sensor) Json() string

type SensorState

type SensorState string

type Siren

type Siren struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// A list of available tones the siren supports. When configured, this enables the support for setting a tone and enables the tone state attribute.
	AvailableTones List `json:"available_tones,omitempty"`

	// Defines a template to generate a custom payload to send to command_topic. The variable value will be assigned with the configured payload_on or payload_off setting. The siren turn on service parameters tone, volume_level or duration can be used as variables in the template. When operation in optimistic mode the corresponding state attributes will be set. Turn on parameters will be filtered if a device misses the support.
	CommandTemplate Template `json:"command_template,omitempty"`

	// Defines a template to generate a custom payload to send to command_topic when the siren turn off service is called. By default command_template will be used as template for service turn off. The variable value will be assigned with the configured payload_off setting.
	CommandOffTemplate Template `json:"command_off_template,omitempty"`

	// The MQTT topic to publish commands to change the siren state. Without command templates, a default JSON payload like {"state":"ON", "tone": "bell", "duration": 10, "volume_level": 0.5 } is published. When the siren turn on service is called, the startup parameters will be added to the JSON payload. The state value of the JSON payload will be set to the the payload_on or payload_off configured payload.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this siren is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name to use when displaying this siren.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if siren works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state_topic defined, else false.
	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents off state. If specified, will be used for both comparing to the value in the state_topic (see value_template and state_off for details) and sending as off command to the command_topic.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents on state. If specified, will be used for both comparing to the value in the state_topic (see value_template and state_on for details) and sending as on command to the command_topic.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The payload that represents the off state. Used when value that represents off state in the state_topic is different from value that should be sent to the command_topic to turn the device off.
	StateOff String `json:"state_off,omitempty"`

	// Default: payload_off if defined, else 'OFF'
	// The payload that represents the on state. Used when value that represents on state in the state_topic is different from value that should be sent to the command_topic to turn the device on.
	StateOn String `json:"state_on,omitempty"`

	// Default: payload_on if defined, else 'ON'
	// The MQTT topic subscribed to receive state updates. The state update may be either JSON or a simple string. When a JSON payload is detected, the state value of the JSON payload should supply the payload_on or payload_off defined payload to turn the siren on or off. Additionally, the state attributes duration, tone and volume_level can be updated. Use value_template to transform the received state udpate to a compliant JSON payload. Attributes will only be set if the function is supported by the device and a valid value is supplied. When a non JSON payload is detected, it should be either of the payload_on or payload_off defined payloads or None to reset the siren’s state to unknown. The initial state will be unknown. The state will be reset to unknown if a None payload or null JSON value is received as a state update.
	StateTopic String `json:"state_topic,omitempty"`

	// Defines a template to extract device’s state from the state_topic. To determine the siren’s state result of this template will be compared to state_on and state_off. Alternatively value_template can be used to render to a valid JSON payload.
	StateValueTemplate String `json:"state_value_template,omitempty"`

	// Set to true if the MQTT siren supports the duration service turn on parameter and enables the duration state attribute.
	SupportDuration Boolean `json:"support_duration,omitempty" default:"true"`

	// Set to true if the MQTT siren supports the volume_set service turn on parameter and enables the volume_level state attribute.
	SupportVolumeSet Boolean `json:"support_volume_set,omitempty" default:"true"`

	// An ID that uniquely identifies this siren device. If two sirens have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Siren) Json

func (c *Siren) Json() string

type String

type String string

type Switch

type Switch struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish commands to change the switch state.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this switch is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The type/class of the switch to set the icon in the frontend.
	DeviceClass DeviceClass `json:"device_class,omitempty" default:"None"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name to use when displaying this switch.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// Flag that defines if switch works in optimistic mode.
	Optimistic Boolean `json:"optimistic,omitempty"`

	// Default: true if no state_topic defined, else false.
	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload that represents off state. If specified, will be used for both comparing to the value in the state_topic (see value_template and state_off for details) and sending as off command to the command_topic.
	PayloadOff String `json:"payload_off,omitempty" default:"OFF"`

	// The payload that represents on state. If specified, will be used for both comparing to the value in the state_topic (see value_template and state_on for details) and sending as on command to the command_topic.
	PayloadOn String `json:"payload_on,omitempty" default:"ON"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The payload that represents the off state. Used when value that represents off state in the state_topic is different from value that should be sent to the command_topic to turn the device off.
	StateOff String `json:"state_off,omitempty"`

	// Default: payload_off if defined, else OFF
	// The payload that represents the on state. Used when value that represents on state in the state_topic is different from value that should be sent to the command_topic to turn the device on.
	StateOn String `json:"state_on,omitempty"`

	// Default: payload_on if defined, else ON
	// The MQTT topic subscribed to receive state updates.
	StateTopic String `json:"state_topic,omitempty"`

	// An ID that uniquely identifies this switch device. If two switches have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract device’s state from the state_topic. To determine the switches’s state result of this template will be compared to state_on and state_off.
	ValueTemplate String `json:"value_template,omitempty"`
}

func (*Switch) Json

func (c *Switch) Json() string

type Tag

type Tag struct {
	// The MQTT topic subscribed to receive tag scanned events.
	Topic String `json:"topic,omitempty" required:"true"`

	// Defines a template that returns a tag ID.
	ValueTemplate String `json:"value_template,omitempty"`

	// Information about the device this device trigger is a part of to tie it into the device registry. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty" required:"true"`
}

func (*Tag) Json

func (c *Tag) Json() string

type Template

type Template string

type Text

type Text struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// Defines a template to generate the payload to send to command_topic.
	CommandTemplate Template `json:"command_template,omitempty"`

	// The MQTT topic to publish the text value that is set.
	CommandTopic String `json:"command_topic,omitempty" required:"true"`

	// Information about the device this of text capability is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes. Implies force_update of the current select state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The maximum size of a text being set or received (maximum is 255).
	Max Integer `json:"max,omitempty" default:"255"`

	// The minimum size of a text being set or received.
	Min Integer `json:"min,omitempty" default:"0"`

	// The mode off the text entity. Must be either text or password.
	Mode String `json:"mode,omitempty" default:"text"`

	// The name of the text entity.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// A valid regular expression the text being set or received must match with.
	Pattern String `json:"pattern,omitempty"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The MQTT topic subscribed to receive text state updates. Text state updates should match the pattern (if set) and meet the size constraints min and max. Can be used with value_template to render the incoming payload to a text update.
	StateTopic String `json:"state_topic,omitempty"`

	// An ID that uniquely identifies this Select. If two Selects have the same unique ID Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract the text state value from the payload received on state_topic.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Text) Json

func (c *Text) Json() string

type Update

type Update struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic to publish payload_install to start installing process.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this Update is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The type/class of the update to set the icon in the frontend.
	DeviceClass DeviceClass `json:"device_class,omitempty" default:"None"`

	// Flag which defines if the entity should be enabled when first added.
	EnabledByDefault Boolean `json:"enabled_by_default,omitempty" default:"true"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// The category of the entity.
	EntityCategory String `json:"entity_category,omitempty" default:"None"`

	// Picture URL for the entity.
	EntityPicture String `json:"entity_picture,omitempty"`

	// Icon for the entity.
	Icon Icon `json:"icon,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as entity attributes. Implies force_update of the current select state when a message is received on this topic.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// Defines a template to extract the latest version value.
	LatestVersionTemplate Template `json:"latest_version_template,omitempty"`

	// The MQTT topic subscribed to receive an update of the latest version.
	LatestVersionTopic String `json:"latest_version_topic,omitempty"`

	// The name of the Select.
	Name String `json:"name,omitempty"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The MQTT payload to start installing process.
	PayloadInstall String `json:"payload_install,omitempty"`

	// The maximum QoS level of the state topic. Default is 0 and will also be used to publishing messages.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// Summary of the release notes or changelog. This is suitable a brief update description of max 255 characters.
	ReleaseSummary String `json:"release_summary,omitempty"`

	// URL to the full release notes of the latest version available.
	ReleaseUrl String `json:"release_url,omitempty"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The MQTT topic subscribed to receive state updates. The state update may be either JSON or a simple string with installed_version value. When a JSON payload is detected, the state value of the JSON payload should supply the installed_version and can optional supply: latest_version, title, release_summary, release_url or an entity_picture URL.
	StateTopic String `json:"state_topic,omitempty"`

	// Title of the software, or firmware update. This helps to differentiate between the device or entity name versus the title of the software installed.
	Title String `json:"title,omitempty"`

	// An ID that uniquely identifies this Select. If two Selects have the same unique ID Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`

	// Defines a template to extract the installed_version state value or to render to a valid JSON payload on from the payload received on state_topic.
	ValueTemplate Template `json:"value_template,omitempty"`
}

func (*Update) Json

func (c *Update) Json() string

type Vacuum

type Vacuum struct {
	// A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.
	Availability *Availability `json:"availability,omitempty"`

	// When availability is configured, this controls the conditions needed to set the entity to available. Valid entries are all, any, and latest. If set to all, payload_available must be received on all configured availability topics before the entity is marked as online. If set to any, payload_available must be received on at least one configured availability topic before the entity is marked as online. If set to latest, the last payload_available or payload_not_available received on any configured availability topic controls the availability.
	AvailabilityMode String `json:"availability_mode,omitempty" default:"latest"`

	// Defines a template to extract device’s availability from the availability_topic. To determine the devices’s availability result of this template will be compared to payload_available and payload_not_available.
	AvailabilityTemplate Template `json:"availability_template,omitempty"`

	// The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.
	AvailabilityTopic String `json:"availability_topic,omitempty"`

	// The MQTT topic to publish commands to control the vacuum.
	CommandTopic String `json:"command_topic,omitempty"`

	// Information about the device this switch is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set. At least one of identifiers or connections must be present to identify the device.
	Device Device `json:"device,omitempty"`

	// The encoding of the payloads received and published messages. Set to "" to disable decoding of incoming payload.
	Encoding String `json:"encoding,omitempty" default:"utf"`

	// List of possible fan speeds for the vacuum.
	FanSpeedList List `json:"fan_speed_list,omitempty"`

	// Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTemplate Template `json:"json_attributes_template,omitempty"`

	// The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.
	JsonAttributesTopic String `json:"json_attributes_topic,omitempty"`

	// The name of the vacuum.
	Name String `json:"name,omitempty" default:"MQTT"`

	// Used instead of name for automatic generation of entity_id
	ObjectId String `json:"object_id,omitempty"`

	// The payload that represents the available state.
	PayloadAvailable String `json:"payload_available,omitempty" default:"online"`

	// The payload to send to the command_topic to begin a spot cleaning cycle.
	PayloadCleanSpot String `json:"payload_clean_spot,omitempty" default:"clean_spot"`

	// The payload to send to the command_topic to locate the vacuum (typically plays a song).
	PayloadLocate String `json:"payload_locate,omitempty" default:"locate"`

	// The payload that represents the unavailable state.
	PayloadNotAvailable String `json:"payload_not_available,omitempty" default:"offline"`

	// The payload to send to the command_topic to pause the vacuum.
	PayloadPause String `json:"payload_pause,omitempty" default:"pause"`

	// The payload to send to the command_topic to tell the vacuum to return to base.
	PayloadReturnToBase String `json:"payload_return_to_base,omitempty" default:"return_to_base"`

	// The payload to send to the command_topic to begin the cleaning cycle.
	PayloadStart String `json:"payload_start,omitempty" default:"start"`

	// The payload to send to the command_topic to stop cleaning.
	PayloadStop String `json:"payload_stop,omitempty" default:"stop"`

	// The maximum QoS level of the state topic.
	Qos Integer `json:"qos,omitempty" default:"0"`

	// If the published message should have the retain flag on or not.
	Retain Boolean `json:"retain,omitempty" default:"false"`

	// The schema to use. Must be state to select the state schema.
	Schema String `json:"schema,omitempty" default:"legacy"`

	// The MQTT topic to publish custom commands to the vacuum.
	SendCommandTopic String `json:"send_command_topic,omitempty"`

	// The MQTT topic to publish commands to control the vacuum’s fan speed.
	SetFanSpeedTopic String `json:"set_fan_speed_topic,omitempty"`

	// The MQTT topic subscribed to receive state messages from the vacuum. Messages received on the state_topic must be a valid JSON dictionary, with a mandatory state key and optionally battery_level and fan_speed keys as shown in the example.
	StateTopic String `json:"state_topic,omitempty"`

	// supported_features string | list (optional)
	// List of features that the vacuum supports (possible values are start, stop, pause, return_home, battery, status, locate, clean_spot, fan_speed, send_command).
	SupportedFeatures List `json:"supported_features,omitempty"`

	// Default: start, stop, return_home, status, battery, clean_spot
	// An ID that uniquely identifies this vacuum. If two vacuums have the same unique ID, Home Assistant will raise an exception.
	UniqueId String `json:"unique_id,omitempty"`
}

func (*Vacuum) Json

func (c *Vacuum) Json() string

Jump to

Keyboard shortcuts

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