Add sensors, renamed repo

This commit is contained in:
Andre Basche 2023-03-05 21:16:09 +01:00
parent 5682149ecc
commit 9d8b17b2cf
17 changed files with 70 additions and 28 deletions

17
.github/workflows/hacs_check.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: HACS Action
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
hacs:
name: HACS Action
runs-on: "ubuntu-latest"
steps:
- name: HACS Action
uses: "hacs/action@main"
with:
category: "integration"

14
.github/workflows/validate.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "home-assistant/actions/hassfest@master"

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

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

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

@ -0,0 +1,11 @@
{
"domain": "haier",
"name": "Haier hOn",
"codeowners": ["@Andre0512"],
"config_flow": true,
"documentation": "https://github.com/Andre0512/haier/",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/haier/issues",
"requirements": ["pyhOn==0.2.4"],
"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,6 @@
"config": { "config": {
"step": { "step": {
"user": { "user": {
"title": "hOn",
"description": "Please enters your hOn credentials", "description": "Please enters your hOn credentials",
"data": { "data": {
"email": "Email Address", "email": "Email Address",
@ -15,8 +14,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"
} }