Skip to content

Commit

Permalink
Merge pull request #92 from MislavMandaric/fix/entity-category
Browse files Browse the repository at this point in the history
Fix for entity categories
  • Loading branch information
MislavMandaric authored Apr 8, 2022
2 parents 16097b8 + bb471f4 commit 530bf92
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 25 deletions.
14 changes: 8 additions & 6 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "ludeeus/container:integration-debian",
"name": "Vaillant vSMART integration development",
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"context": "..",
"appPort": [
"9123:8123"
"8123:8123"
],
"postCreateCommand": "container install",
"extensions": [
Expand All @@ -17,14 +15,18 @@
"files.eol": "\n",
"editor.tabSize": 4,
"terminal.integrated.shell.linux": "/bin/bash",
"python.pythonPath": "/usr/bin/python3",
"python.pythonPath": "/usr/local/python/bin/python",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.pylintArgs": [
"--disable",
"import-error"
],
"python.formatting.provider": "black",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
}
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"name": "Python: Attach Local",
"type": "python",
"request": "attach",
"port": 5678,
"port": 8123,
"host": "localhost",
"justMyCode": false,
"pathMappings": [
Expand All @@ -22,7 +22,7 @@
"name": "Python: Attach Remote",
"type": "python",
"request": "attach",
"port": 5678,
"port": 8123,
"host": "homeassistant.local",
"justMyCode": false,
"pathMappings": [
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2.0.0",
"tasks": [
{
"label": "Run Home Assistant on port 9123",
"label": "Run Home Assistant on port 8123",
"type": "shell",
"command": "container start",
"problemMatcher": []
Expand Down
7 changes: 3 additions & 4 deletions custom_components/vaillant_vsmart/select.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
"""The Vaillant vSMART climate platform."""
from __future__ import annotations

import datetime
import logging

from homeassistant.components.select import SelectEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
Expand Down Expand Up @@ -48,10 +47,10 @@ def name(self) -> str:
return f"{self._module.module_name} {self._program.name} Profile"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this select."""

return ENTITY_CATEGORY_DIAGNOSTIC
return EntityCategory.DIAGNOSTIC

@property
def current_option(self) -> str | None:
Expand Down
7 changes: 4 additions & 3 deletions custom_components/vaillant_vsmart/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
STATE_CLASS_MEASUREMENT,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import DOMAIN
Expand Down Expand Up @@ -50,10 +51,10 @@ def name(self) -> str:
return f"{self._module.module_name} Battery"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this sensor."""

return ENTITY_CATEGORY_DIAGNOSTIC
return EntityCategory.DIAGNOSTIC

@property
def device_class(self) -> str:
Expand Down
10 changes: 5 additions & 5 deletions custom_components/vaillant_vsmart/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from homeassistant.components.switch import SwitchEntity, DEVICE_CLASS_SWITCH
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from vaillant_netatmo_api import ApiException, SetpointMode

Expand Down Expand Up @@ -54,10 +54,10 @@ def name(self) -> str:
return f"{self._module.module_name} HWB"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this switch."""

return ENTITY_CATEGORY_CONFIG
return EntityCategory.CONFIG

@property
def device_class(self) -> str:
Expand Down Expand Up @@ -120,10 +120,10 @@ def name(self) -> str:
return f"{self._module.module_name} {self._program.name} Schedule"

@property
def entity_category(self) -> str:
def entity_category(self) -> EntityCategory:
"""Return entity category for this switch."""

return ENTITY_CATEGORY_CONFIG
return EntityCategory.CONFIG

@property
def device_class(self) -> str:
Expand Down
1 change: 0 additions & 1 deletion custom_components/vaillant_vsmart/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"config": {
"step": {
"user": {
"title": "Vaillant vSMART",
"description": "If you need help with the configuration have a look here: https://github.com/MislavMandaric/home-assistant-vaillant-vsmart",
"data": {
"client_id": "Client ID",
Expand Down
1 change: 0 additions & 1 deletion custom_components/vaillant_vsmart/translations/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"config": {
"step": {
"user": {
"title": "Vaillant vSMART",
"description": "Pomoć oko konfiguracije integracije potražite na ovom linku: https://github.com/MislavMandaric/home-assistant-vaillant-vsmart",
"data": {
"client_id": "ID klijenta",
Expand Down
5 changes: 3 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"hacs": "1.6.0",
"domains": [
"climate",
"switch",
"sensor"
"select",
"sensor",
"switch"
],
"iot_class": "Cloud Polling",
"homeassistant": "2021.6"
Expand Down

0 comments on commit 530bf92

Please sign in to comment.