core/homeassistant/components/obihai/connectivity.py

73 lines
1.8 KiB
Python
Raw Normal View History

Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
"""Support for Obihai Connectivity."""
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
from __future__ import annotations
from pyobihai import PyObihai
from .const import DEFAULT_PASSWORD, DEFAULT_USERNAME, LOGGER
def get_pyobihai(
host: str,
username: str,
password: str,
) -> PyObihai:
"""Retrieve an authenticated PyObihai."""
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
return PyObihai(host, username, password)
def validate_auth(
host: str,
username: str,
password: str,
) -> PyObihai | None:
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
"""Test if the given setting works as expected."""
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
obi = get_pyobihai(host, username, password)
login = obi.check_account()
if not login:
LOGGER.debug("Invalid credentials")
return None
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
return obi
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
class ObihaiConnection:
"""Contains a list of Obihai Sensors."""
def __init__(
self,
host: str,
username: str = DEFAULT_USERNAME,
password: str = DEFAULT_PASSWORD,
) -> None:
"""Store configuration."""
self.sensors: list = []
self.host = host
self.username = username
self.password = password
self.serial: str
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
self.services: list = []
self.line_services: list = []
self.call_direction: list = []
self.pyobihai: PyObihai = None
self.available: bool = True
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
def update(self) -> bool:
"""Validate connection and retrieve a list of sensors."""
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
if not self.pyobihai:
self.pyobihai = validate_auth(self.host, self.username, self.password)
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
if not self.pyobihai:
Add Config Flow to Obihai (#88627) * Obihai: Config Flow Only * Remove reboot service * Update .coveragerc Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR Feedback * Use Issue Registry * Add config_flow tests * Another pass with pre-commit * Resolve cyclical import and move sensorClasses to sensor * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/sensor.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Another round of feedback * More PR feedback * Offline testing, already_configured is required * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup * Update homeassistant/components/obihai/__init__.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * PR feedback * Backout today's changes: Fix mypy error * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update tests/components/obihai/test_config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Don't plan ahead * PR feedback * Update homeassistant/components/obihai/config_flow.py Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Cleanup strings --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-02-27 16:22:15 +00:00
return False
self.serial = self.pyobihai.get_device_serial()
self.services = self.pyobihai.get_state()
self.line_services = self.pyobihai.get_line_state()
self.call_direction = self.pyobihai.get_call_direction()
return True