address PR comments

This commit is contained in:
Jakub Zimny
2025-01-22 08:39:55 +01:00
parent 98e3583c6f
commit 7f279c688c
2 changed files with 5 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ func (s MockState) Get(eid string) (EntityState, error) {
} }
return s.GetReturn, nil return s.GetReturn, nil
} }
func (s MockState) List() ([]EntityState, error) { func (s MockState) ListEntities() ([]EntityState, error) {
return []EntityState{}, nil return []EntityState{}, nil
} }
func (s MockState) Equals(eid, state string) (bool, error) { func (s MockState) Equals(eid, state string) (bool, error) {

View File

@@ -16,7 +16,7 @@ type State interface {
BeforeSunrise(...DurationString) bool BeforeSunrise(...DurationString) bool
AfterSunset(...DurationString) bool AfterSunset(...DurationString) bool
BeforeSunset(...DurationString) bool BeforeSunset(...DurationString) bool
List() ([]EntityState, error) ListEntities() ([]EntityState, error)
Get(entityId string) (EntityState, error) Get(entityId string) (EntityState, error)
Equals(entityId, state string) (bool, error) Equals(entityId, state string) (bool, error)
} }
@@ -75,7 +75,9 @@ func (s *StateImpl) Get(entityId string) (EntityState, error) {
return es, err return es, err
} }
func (s *StateImpl) List() ([]EntityState, error) { // ListEntities returns a list of all entities in Home Assistant.
// see rest documentation for more details: https://developers.home-assistant.io/docs/api/rest/#actions
func (s *StateImpl) ListEntities() ([]EntityState, error) {
resp, err := s.httpClient.States() resp, err := s.httpClient.States()
if err != nil { if err != nil {
return nil, err return nil, err