diff --git a/homeassistant/components/obihai/manifest.json b/homeassistant/components/obihai/manifest.json index e7706b0435c..dd4df479af4 100644 --- a/homeassistant/components/obihai/manifest.json +++ b/homeassistant/components/obihai/manifest.json @@ -3,7 +3,7 @@ "name": "Obihai", "documentation": "https://www.home-assistant.io/components/obihai", "requirements": [ - "pyobihai==1.1.0" + "pyobihai==1.1.1" ], "dependencies": [], "codeowners": ["@dshokouhi"] diff --git a/homeassistant/components/obihai/sensor.py b/homeassistant/components/obihai/sensor.py index 4eb3881e95b..fbf4fffb17f 100644 --- a/homeassistant/components/obihai/sensor.py +++ b/homeassistant/components/obihai/sensor.py @@ -46,16 +46,26 @@ def setup_platform(hass, config, add_entities, discovery_info=None): pyobihai = PyObihai() + login = pyobihai.check_account(host, username, password) + if not login: + _LOGGER.error("Invalid credentials") + return + services = pyobihai.get_state(host, username, password) line_services = pyobihai.get_line_state(host, username, password) + call_direction = pyobihai.get_call_direction(host, username, password) + for key in services: sensors.append(ObihaiServiceSensors(pyobihai, host, username, password, key)) for key in line_services: sensors.append(ObihaiServiceSensors(pyobihai, host, username, password, key)) + for key in call_direction: + sensors.append(ObihaiServiceSensors(pyobihai, host, username, password, key)) + add_entities(sensors) @@ -102,3 +112,10 @@ class ObihaiServiceSensors(Entity): if self._service_name in services: self._state = services.get(self._service_name) + + call_direction = self._pyobihai.get_call_direction( + self._host, self._username, self._password + ) + + if self._service_name in call_direction: + self._state = call_direction.get(self._service_name) diff --git a/requirements_all.txt b/requirements_all.txt index 73ececb0517..26fdfc38fa3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1346,7 +1346,7 @@ pynx584==0.4 pynzbgetapi==0.2.0 # homeassistant.components.obihai -pyobihai==1.1.0 +pyobihai==1.1.1 # homeassistant.components.ombi pyombi==0.1.5