Add sensors, renamed repo

This commit is contained in:
Andre Basche 2023-03-05 21:16:09 +01:00
parent 5682149ecc
commit 767a921602
15 changed files with 50 additions and 23 deletions

16
.github/workflows/validate.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Validate
on:
push:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: home-assistant/actions/hassfest@master
- name: HACS validation
uses: hacs/action@main
with:
category: integration

View File

@ -1,10 +1,11 @@
# hOn # Haier hOn
Home Assistant component supporting hOn cloud. Home Assistant component supporting hOn cloud.
## Installation ## Installation
1. Installing via HACS #### Installing via HACS
1. You need to have installed [HACS](https://hacs.xyz/)
2. Go to HACS->Integrations 2. Go to HACS->Integrations
3. Add this repo into your HACS custom repositories 3. Add this repo (`https://github.com/Andre0512/haier.git`) into your HACS custom repositories
4. Search for Haier hOn and Download it 4. Search for Haier hOn and Download it
5. Restart your HomeAssistant 5. Restart your HomeAssistant
6. Go to Settings->Devices & Services 6. Go to Settings->Devices & Services

View File

@ -35,7 +35,7 @@ BINARY_SENSORS: dict[str, tuple[HonBinarySensorEntityDescription, ...]] = {
key="doorLockStatus", key="doorLockStatus",
name="Door Locked", name="Door Locked",
device_class=BinarySensorDeviceClass.DOOR, device_class=BinarySensorDeviceClass.DOOR,
on_value="1", on_value="0",
), ),
) )
} }

View File

@ -11,7 +11,6 @@ _LOGGER = logging.getLogger(__name__)
class HonFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): class HonFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL

View File

@ -1,4 +1,4 @@
DOMAIN = "hon" DOMAIN = "haier"
PLATFORMS = [ PLATFORMS = [
"sensor", "sensor",

View File

View File

@ -1,10 +1,10 @@
{ {
"domain": "hon", "domain": "haier",
"name": "hOn", "name": "Haier hOn",
"config_flow": true,
"version": "0.1.0",
"codeowners": ["@Andre0512"], "codeowners": ["@Andre0512"],
"config_flow": true,
"documentation": "https://github.com/Andre0512/haier/",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"requirements": ["pyhOn==0.2.4"], "requirements": ["pyhOn==0.2.4"],
"documentation": "https://github.com/Andre0512/hOn/" "version": "0.1.1"
} }

View File

@ -1,4 +1,3 @@
"""Support for Tuya select."""
from __future__ import annotations from __future__ import annotations
from pyhon import HonConnection from pyhon import HonConnection
@ -11,10 +10,9 @@ from homeassistant.const import UnitOfTemperature, REVOLUTIONS_PER_MINUTE
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from .const import DOMAIN
from .hon import HonEntity, HonCoordinator from .hon import HonEntity, HonCoordinator
DOMAIN = "hon"
SELECTS = { SELECTS = {
"WM": ( "WM": (
SelectEntityDescription( SelectEntityDescription(

View File

@ -9,7 +9,7 @@ from homeassistant.components.sensor import (
SensorEntityDescription, SensorEntityDescription,
) )
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfEnergy, UnitOfVolume, UnitOfMass, UnitOfPower from homeassistant.const import UnitOfEnergy, UnitOfVolume, UnitOfMass, UnitOfPower, UnitOfTime
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.helpers.entity import EntityCategory from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.typing import StateType from homeassistant.helpers.typing import StateType
@ -75,7 +75,20 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
icon="mdi:math-log", icon="mdi:math-log",
translation_key="errors" translation_key="errors"
), ),
SensorEntityDescription(
key="remainingTimeMM",
name="Remaining Time",
icon="mdi:timer",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES,
),
SensorEntityDescription(
key="spinSpeed",
name="Spin Speed",
icon="mdi:timer",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES,
),
) )
} }

View File

@ -1,13 +1,11 @@
from collections.abc import Callable, Coroutine
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any from typing import Any
from pyhon import HonConnection
from pyhon.device import HonDevice
from homeassistant.components.switch import SwitchEntityDescription, SwitchEntity from homeassistant.components.switch import SwitchEntityDescription, SwitchEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory from homeassistant.const import EntityCategory
from pyhon import HonConnection
from pyhon.device import HonDevice
from .const import DOMAIN from .const import DOMAIN
from .hon import HonCoordinator, HonEntity from .hon import HonCoordinator, HonEntity

View File

@ -2,7 +2,7 @@
"config": { "config": {
"step": { "step": {
"user": { "user": {
"title": "hOn", "title": "Haier hOn",
"description": "Please enters your hOn credentials", "description": "Please enters your hOn credentials",
"data": { "data": {
"email": "Email Address", "email": "Email Address",
@ -15,8 +15,10 @@
"sensor": { "sensor": {
"mode": { "mode": {
"state": { "state": {
"0": "Disconnected",
"1": "Ready", "1": "Ready",
"2": "Running", "2": "Running",
"3": "Paused",
"5": "Scheduled", "5": "Scheduled",
"6": "Error", "6": "Error",
"7": "Finished" "7": "Finished"

View File

@ -1,5 +1,5 @@
{ {
"name": "hOn", "name": "Haier hOn",
"render_readme": false, "render_readme": true,
"homeassistant": "2023.2.0" "homeassistant": "2023.2.0"
} }