diff --git a/homeassistant/components/rainbird.py b/homeassistant/components/rainbird.py index f98e2ba1d61..48a40cc30fe 100644 --- a/homeassistant/components/rainbird.py +++ b/homeassistant/components/rainbird.py @@ -14,7 +14,7 @@ from homeassistant.helpers.entity import Entity from homeassistant.const import ( CONF_HOST, CONF_PASSWORD) -REQUIREMENTS = ['pyrainbird==0.0.7'] +REQUIREMENTS = ['pyrainbird==0.0.9'] DOMAIN = 'rainbird' @@ -102,6 +102,10 @@ class RainbirdDevice(Entity): """Return True if entity is available.""" return self._state != -1 + def setstate(self, state): + """Force set the current state value.""" + self._state = state + @property def state(self): """Return the state of the entity.""" diff --git a/homeassistant/components/switch/rainbird.py b/homeassistant/components/switch/rainbird.py index f951f257560..f341f1324f6 100644 --- a/homeassistant/components/switch/rainbird.py +++ b/homeassistant/components/switch/rainbird.py @@ -57,6 +57,7 @@ class RainBirdSwitch(SwitchDevice): self._duration = dev.get(CONF_TRIGGER_TIME) self._attributes = { "duration": self._duration, + "zone" : self._zone } @property @@ -78,11 +79,13 @@ class RainBirdSwitch(SwitchDevice): """Turn the switch on.""" self._state = True self._rainbird.start_irrigation(self._zone, self._duration) + self._rainbird.setstate(self._zone) def turn_off(self, **kwargs): """Turn the switch off.""" self._state = False self._rainbird.stop_irrigation() + self._rainbird.setstate(0) def get_device_status(self): """Get the status of the switch from Rain Bird Controller."""