generator

package
v1.0.34 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AttributeUsedForGenerator = "senergy/local-mqtt"
View Source
const CommandAttribute = "senergy/local-mqtt/cmd-topic-tmpl"
View Source
const DisplayNameAttributeName = "shared/nickname"
View Source
const EventAttribute = "senergy/local-mqtt/event-topic-tmpl"
View Source
const FileNamePrefix = "generated_"
View Source
const ResponseAttribute = "senergy/local-mqtt/resp-topic-tmpl"

Variables

View Source
var TemplateLocalDeviceIdPlaceholders = []string{"Device", "LocalDeviceId"}
View Source
var TemplateLocalServiceIdPlaceholders = []string{"Service", "LocalServiceId"}

Functions

func EqualTopicDescription

func EqualTopicDescription(a model.TopicDescription, b model.TopicDescription) bool

func FilterDuplicates

func FilterDuplicates(topics []model.TopicDescription) []model.TopicDescription

func GenerateCommandServiceTopicDescriptions

func GenerateCommandServiceTopicDescriptions(device models.Device, service models.Service, truncateDevicePrefix string) (result []model.TopicDescription)

func GenerateDeviceTopicDescriptions

func GenerateDeviceTopicDescriptions(device models.Device, deviceType models.DeviceType, truncateDevicePrefix string) (result []model.TopicDescription)

func GenerateEventServiceTopicDescriptions

func GenerateEventServiceTopicDescriptions(device models.Device, service models.Service, truncateDevicePrefix string) (result []model.TopicDescription)

func GenerateServiceTopicDescriptions

func GenerateServiceTopicDescriptions(device models.Device, service models.Service, truncateDevicePrefix string) (result []model.TopicDescription)

func GenerateTopic

func GenerateTopic(topicTemplate string, deviceId string, serviceId string, truncateDevicePrefix string, attributes []models.Attribute) (result string, err error)

func GenerateTopicDescriptions

func GenerateTopicDescriptions(devices []models.Device, deviceTypes []models.DeviceType, truncateDevicePrefix string) (result []model.TopicDescription)

func GetAttributeValue

func GetAttributeValue(attributes []models.Attribute, key string) (result string, found bool)

func GetDeviceInfos

func GetDeviceInfos(repo *devicerepo.DeviceRepo, filterDevicesByAttribute string) (devices []models.Device, deviceTypes []models.DeviceType, err error)

GetDeviceInfos returns all device-types with attribute AttributeUsedForGenerator and devices matching a device-type if filterDevicesByAttribute != "" the devices will be filtered by AttributeUsedForGenerator == filterDevicesByAttribute

func Store

func Store(descriptions []model.TopicDescription, dir string) (err error)

func StoreFile

func StoreFile(descriptions []model.TopicDescription, fileLocation string) (err error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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