Skip to content

Commit

Permalink
Remove Genesis API config
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs committed Jun 15, 2024
1 parent bd2bbb6 commit 8cbda1e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 26 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ Platform | Description

To set up Thermia Heat Pump Integration, go to Settings -> Integrations -> Add Integration and search for Thermia Heat Pump.

Depending on the url you use to see your heat pump online, you need to choose the following API type:
* `classic` - for url: https://online.thermia.se
* `genesis` - for url: https://online-genesis.thermia.se

## Installation

Open HACS, go to the Integrations view and search for Thermia Heat Pump Integration.
Expand Down
9 changes: 3 additions & 6 deletions custom_components/thermia/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Thermia heat pump integration."""

from __future__ import annotations

import asyncio
Expand All @@ -11,9 +12,8 @@
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from ThermiaOnlineAPI import Thermia
from ThermiaOnlineAPI.api.ThermiaAPI import ThermiaAPI

from .const import API_TYPE, API_TYPE_CLASSIC, CONF_PASSWORD, CONF_USERNAME, DOMAIN
from .const import CONF_PASSWORD, CONF_USERNAME, DOMAIN

PLATFORMS: list[str] = ["binary_sensor", "sensor", "switch", "water_heater"]

Expand All @@ -33,11 +33,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):

username = config_entry.data[CONF_USERNAME]
password = config_entry.data[CONF_PASSWORD]
api_type = config_entry.data.get(API_TYPE, API_TYPE_CLASSIC)

thermia = await hass.async_add_executor_job(
lambda: Thermia(username, password, api_type)
)
thermia = await hass.async_add_executor_job(lambda: Thermia(username, password))

coordinator = ThermiaDataUpdateCoordinator(hass, thermia)

Expand Down
6 changes: 1 addition & 5 deletions custom_components/thermia/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config Flow for Thermia."""

import logging

import voluptuous as vol
Expand All @@ -8,9 +9,6 @@
from ThermiaOnlineAPI import AuthenticationException, Thermia

from .const import (
API_TYPE,
API_TYPE_CLASSIC,
API_TYPES,
CONF_PASSWORD,
CONF_USERNAME,
DOMAIN,
Expand All @@ -20,7 +18,6 @@
{
vol.Required(CONF_USERNAME): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Required(API_TYPE, default=API_TYPE_CLASSIC): vol.In(API_TYPES),
}
)

Expand All @@ -44,7 +41,6 @@ async def _check_credentials(self, user_input):
lambda: Thermia(
user_input[CONF_USERNAME],
user_input[CONF_PASSWORD],
user_input[API_TYPE],
)
)
await self.hass.async_add_executor_job(thermia.fetch_heat_pumps)
Expand Down
6 changes: 0 additions & 6 deletions custom_components/thermia/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
CONF_USERNAME = "username"
CONF_PASSWORD = "password"

API_TYPE_CLASSIC = "classic"
API_TYPE_GENESIS = "genesis"

API_TYPE = "api_type"
API_TYPES = [API_TYPE_CLASSIC, API_TYPE_GENESIS]

MDI_INFORMATION_OUTLINE_ICON = "mdi:information-outline"
MDI_TIMER_COG_OUTLINE_ICON = "mdi:timer-cog-outline"
MDI_TEMPERATURE_ICON = "mdi:thermometer"
3 changes: 1 addition & 2 deletions custom_components/thermia/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"description": "Set up Thermia Heat Pump integration",
"data": {
"username": "Thermia Username",
"password": "Thermia Password",
"api_type": "API type (check readme for more info):"
"password": "Thermia Password"
}
}
},
Expand Down
6 changes: 4 additions & 2 deletions devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"customizations": {
"vscode": {
"settings": {
"python.pythonPath": "/usr/local/bin/python"
"python.pythonPath": "/usr/local/bin/python",
"python.formatting.provider": "black"
},
"extensions": [
"GitHub.copilot",
"github.vscode-pull-request-github",
"ms-python.python",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"ms-python.black-formatter"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ install_packages() {
}

install_packages "pip<23.2,>=21.3.1"
install_packages setuptools wheel
install_packages setuptools wheel black
install_packages -r requirements.txt

0 comments on commit 8cbda1e

Please sign in to comment.