- Added detailed comments to clarify the purpose of various functions and types in the Discord bot and HA gateway. - Introduced new methods in the CommandApp for handling light and switch operations, including HandleLightOn, HandleLightOff, HandleLightToggle, and their respective autocomplete functions. - Updated the HAClient interface to include methods for fetching states and calling services, enhancing the interaction with Home Assistant. - Improved the structure of entity and light domain models to include additional attributes and clearer documentation. - Implemented logging enhancements in both the Discord bot and HA gateway to ensure better traceability and context in logs. - Refactored the configuration loading process to streamline environment variable handling and defaults. - Stubbed out switch control methods in the gRPC adapter, indicating future implementation plans. - Enhanced telemetry setup to ensure proper initialization and shutdown procedures for observability.
28 lines
832 B
Go
28 lines
832 B
Go
package domain
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
// EntityID is the canonical Home Assistant entity identifier, for example
|
|
// "light.living_room".
|
|
type EntityID string
|
|
|
|
// EntityState is the normalized entity snapshot returned by the gateway.
|
|
type EntityState struct {
|
|
// EntityID is the Home Assistant entity identifier.
|
|
EntityID EntityID
|
|
// State is the current raw Home Assistant state string.
|
|
State string
|
|
// Attributes contains stringified Home Assistant attributes for transport.
|
|
Attributes map[string]string
|
|
// LastChanged is when the state last changed in Home Assistant.
|
|
LastChanged time.Time
|
|
// LastUpdated is when any part of the entity state last updated.
|
|
LastUpdated time.Time
|
|
}
|
|
|
|
// ErrNotImplemented marks domain operations that are intentionally stubbed.
|
|
var ErrNotImplemented = errors.New("not implemented")
|