mirror of
https://github.com/Xevion/go-ha.git
synced 2026-01-31 04:24:27 -06:00
documented general use cases
This commit is contained in:
@@ -32,3 +32,11 @@ func (s *State) Get(entityId string) (EntityState, error) {
|
||||
json.Unmarshal(resp, &es)
|
||||
return es, nil
|
||||
}
|
||||
|
||||
func (s *State) Equals(entityId string, expectedState string) (bool, error) {
|
||||
currentState, err := s.Get(entityId)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return currentState.State == expectedState, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user