Removed custom ondilo stuff, since official version available

This commit is contained in:
Martin Bauer 2021-05-31 16:07:55 +00:00
parent f6379fe687
commit e063a1303f
6 changed files with 0 additions and 183 deletions

View File

@ -16,10 +16,6 @@ updater:
#input_text:
ondilo:
username: customer_api
password: !secret ondilo_pw
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
http:
base_url: https://ha.bauer.tech

View File

@ -1,78 +0,0 @@
import asyncio
import logging
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD
from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv
from . import config_flow
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
}
)
},
extra=vol.ALLOW_EXTRA,
)
PLATFORMS = ["sensor"]
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the ondilo component."""
hass.data[DOMAIN] = {}
print("Init1")
if DOMAIN not in config:
print("Init early out")
return True
config_flow.OndiloFlowHandler.async_register_implementation(
hass,
config_entry_oauth2_flow.LocalOAuth2Implementation(
hass,
DOMAIN,
config[DOMAIN][CONF_USERNAME],
config[DOMAIN][CONF_PASSWORD],
OAUTH2_AUTHORIZE,
OAUTH2_TOKEN,
),
)
print("init finish")
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up ondilo from a config entry."""
implementation = await config_entry_oauth2_flow.async_get_config_entry_implementation(
hass, entry
)
session = config_entry_oauth2_flow.OAuth2Session(hass, entry, implementation)
hass.data[DOMAIN] = {"session": session}
hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "sensor"))
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
]
)
)
if unload_ok:
hass.data[DOMAIN] = {}
return unload_ok

View File

@ -1,35 +0,0 @@
"""Config flow for Ondilo."""
import logging
from homeassistant import config_entries
from homeassistant.helpers import config_entry_oauth2_flow
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
class OndiloFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN):
"""Config flow to handle Ondilo OAuth2 authentication."""
DOMAIN = DOMAIN
CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
@property
def logger(self) -> logging.Logger:
"""Return logger."""
return logging.getLogger(__name__)
async def async_step_user(self, user_input=None):
"""Handle a flow start."""
print("async_step_user!!")
if self.hass.config_entries.async_entries(DOMAIN):
print("abort because already setup")
return self.async_abort(reason="already_setup")
print("works!")
return await super().async_step_user(user_input)
async def async_step_homekit(self, homekit_info):
"""Handle HomeKit discovery."""
print("async_step_homekit!!")
return await self.async_step_user()

View File

@ -1,4 +0,0 @@
DOMAIN = "ondilo"
OAUTH2_AUTHORIZE = "https://interop.ondilo.com/oauth2/authorize"
OAUTH2_TOKEN = "https://interop.ondilo.com/oauth2/token"
URL_API_PREFIX = "https://interop.ondilo.com/api/customer/v1"

View File

@ -1,10 +0,0 @@
{
"domain": "ondilo",
"name": "Ondilo Pool Monitor",
"documentation": "",
"requirements": [],
"dependencies": [],
"codeowners": ["@mabau"],
"config_flow": true,
"version": "0.1"
}

View File

@ -1,52 +0,0 @@
from .const import DOMAIN, URL_API_PREFIX
from datetime import timedelta
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
import logging
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)
_LOGGER = logging.getLogger(__name__)
async def api_call(session, url, data={}):
return await session.async_request(method="GET",
url=f"{URL_API_PREFIX}/{url}",
json=data).json()
class OndiloData:
def __init__(self, session):
self._session = session
@Throttle(MIN_TIME_BETWEEN_UPDATES)
async def async_update(self):
pass
class PHSensor(Entity):
def __init__(self, data):
self._data = data
async def async_update(self):
self._data.async_update()
class ORPSensor(Entity):
def __init__(self, data):
self._data = data
async def async_update(self):
self._data.async_update()
async def async_setup_entry(hass, entry, async_add_entities):
session = hass.data[DOMAIN]['session']
res = await api_call(session, "pools")
print(res)
_LOGGER.warn(res)
# data = OndiloData(session)
# get pools
# sensors = [PHSensor(data), ORPSensor(data)]
# async_add_entities(sensors)