Documentation
¶
Index ¶
- Variables
- func RegisterAll(r *Component, locationService *services.LocationService) error
- func SetGlobal(c *Component)
- type Component
- func (c *Component) CanHandle(deviceType common.DeviceType, _ *common.RawPayload) bool
- func (c *Component) GetEntityTemplates(deviceType common.DeviceType, model, devEUI string) ([]common.Entity, error)
- func (c *Component) GetSupportedDevices() []common.DeviceType
- func (c *Component) GetSupportedEntityTypes(deviceType common.DeviceType) []string
- func (c *Component) GetSupportedPorts(deviceType common.DeviceType) []int
- func (c *Component) Parse(_ context.Context, deviceType common.DeviceType, payload *common.RawPayload) (*common.ParsedData, error)
- func (c *Component) ParseToEntities(_ context.Context, orgSlug, model string, deviceType common.DeviceType, ...) (*common.ParseResult, error)
- func (c *Component) RegisterParser(model, manufacturer string, parser common.Parser)
- func (c *Component) SupportsGPS(deviceType common.DeviceType) bool
- func (c *Component) Validate(deviceType common.DeviceType, data *common.ParsedData) error
Constants ¶
This section is empty.
Variables ¶
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.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component dispatches raw payloads to the appropriate device Parser.
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 (*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 ¶
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
|
|
|
dragino
|
|
|
dut
|
|
|
lilygo
|
|
|
mclimate
|
|
|
milesight
|
|
|
netvox
|
|
|
quandify
|
|
|
rakwireless
|
|
|
seeed
|
|