deviceprofile

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoParser      = errors.New("no parser registered for device type")
	ErrMissingDevEUI = errors.New("device EUI is required")
)

Sentinel errors returned by the Component.

Functions

func RegisterAll

func RegisterAll(r *Component, locationService *services.LocationService) error

RegisterAll explicitly registers all known device parsers into r with error handling.

func SetGlobal

func SetGlobal(c *Component)

SetGlobal sets the process-wide device profile component. Call this in main after creating and populating a ComponentRegistry via RegisterAll.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component dispatches raw payloads to the appropriate device Parser.

func Global

func Global() *Component

Global returns the process-wide device profile component.

func New

func New() *Component

New returns a Component with no parsers registered.

func NewComponentRegistry

func NewComponentRegistry() *Component

NewComponentRegistry creates a new Component for dependency injection. Call RegisterAll to populate it with all known device parsers.

func (*Component) CanHandle

func (c *Component) CanHandle(deviceType common.DeviceType, _ *common.RawPayload) bool

CanHandle reports whether a parser exists for the given device type.

func (*Component) GetEntityTemplates added in v0.0.5

func (c *Component) GetEntityTemplates(deviceType common.DeviceType, model, devEUI string) ([]common.Entity, error)

func (*Component) GetSupportedDevices

func (c *Component) GetSupportedDevices() []common.DeviceType

GetSupportedDevices returns all registered device types.

func (*Component) GetSupportedEntityTypes

func (c *Component) GetSupportedEntityTypes(deviceType common.DeviceType) []string

GetSupportedEntityTypes returns the entity types a device type can produce.

func (*Component) GetSupportedPorts

func (c *Component) GetSupportedPorts(deviceType common.DeviceType) []int

GetSupportedPorts returns the fPorts used by a device type.

func (*Component) Parse

func (c *Component) Parse(_ context.Context, deviceType common.DeviceType, payload *common.RawPayload) (*common.ParsedData, error)

Parse converts a raw payload into structured ParsedData.

func (*Component) ParseToEntities

func (c *Component) ParseToEntities(_ context.Context, orgSlug, model string, deviceType common.DeviceType, payload *common.RawPayload, deviceLocation *common.Location) (*common.ParseResult, error)

ParseToEntities converts a raw payload into a set of home-assistant-style entities.

func (*Component) RegisterParser

func (c *Component) RegisterParser(model, manufacturer string, parser common.Parser)

RegisterParser adds a Parser for the given model/manufacturer pair.

func (*Component) SupportsGPS

func (c *Component) SupportsGPS(deviceType common.DeviceType) bool

SupportsGPS reports whether the device type has built-in GPS.

func (*Component) Validate

func (c *Component) Validate(deviceType common.DeviceType, data *common.ParsedData) error

Validate performs basic sanity checks on parsed data.

Directories

Path Synopsis
abeeway
digital_matter
g62
dragino
dut
lilygo
mclimate
ht
milesight
netvox
quandify
rakwireless
seeed

Jump to

Keyboard shortcuts

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