Documentation
¶
Index ¶
- Constants
- Variables
- func GetEquivalentWebsocketScheme(scheme string) (string, error)
- func GetFunctionName(i interface{}) string
- func ParseDuration(s string) time.Duration
- func ParseTime(clock Clock, s string) *carbon.Carbon
- func Ptr[T any](v T) *T
- type Clock
- type EnabledDisabledInfo
- type FakeClock
- type HttpClient
- type RealClock
Constants ¶
const Version = "0.9.0"
Version is the go-ha release this build corresponds to.
Variables ¶
var ( ErrUnauthorized = errors.New("unauthorized") // ErrEntityNotFound reports an entity Home Assistant does not know about. ErrEntityNotFound = errors.New("entity not found") // ErrHttpStatus reports any other non-success response. ErrHttpStatus = errors.New("unexpected http status") )
Functions ¶
func GetEquivalentWebsocketScheme ¶ added in v0.7.1
GetEquivalentWebsocketScheme returns the equivalent WebSocket scheme for the given scheme. If the scheme is http or https, it returns ws or wss respectively. If the scheme is ws or wss, it returns the same scheme. If the scheme is not any of the above, it returns an error.
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
GetFunctionName returns the name of the function that the interface is a pointer to.
func ParseDuration ¶ added in v0.7.1
Types ¶
type Clock ¶ added in v0.8.0
Clock reports the current time. Production code uses RealClock; tests pin an instant with FakeClock and step it forward deliberately.
type EnabledDisabledInfo ¶
type FakeClock ¶ added in v0.8.0
type FakeClock struct {
// contains filtered or unexported fields
}
FakeClock reports a fixed instant until moved by Set or Advance. Callbacks run on their own goroutines and read the clock freely, so access is guarded.
func NewFakeClock ¶ added in v0.8.0
NewFakeClock returns a FakeClock pinned to the given instant.
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func NewHttpClient ¶
func (*HttpClient) GetStates ¶ added in v0.7.1
func (c *HttpClient) GetStates() ([]byte, error)
GetStates returns the states of all entities.