Skip to content

Commit

Permalink
Add program name sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed May 29, 2023
1 parent 6e9981c commit 2fe8ace
Show file tree
Hide file tree
Showing 25 changed files with 10,522 additions and 253 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Support has been confirmed for these models, but many more will work. Please add
- Haier XIB 3B2SFS-80
- Haier XIB 6B2D3FB
- Candy BCTDH7A1TE
- Candy CCE4T620EWU
- Candy CIS633SCTTWIFI
- Candy CSOE C10DE-80
- Candy ROE H9A3TCEX-S
Expand Down Expand Up @@ -182,6 +183,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| Indoor Temperature | `thermometer` | `sensor` | `tempIndoor` |
| Outdoor Temperature | `thermometer` | `sensor` | `tempOutdoor` |
| Program | | `select` | `startProgram.program` |
| Program | `play` | `sensor` | `programName` |
| Selected Temperature | `thermometer` | `sensor` | `tempSel` |

### Dish washer
Expand Down Expand Up @@ -217,6 +219,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| Door | | `binary_sensor` | `doorStatus` |
| Error | `math-log` | `sensor` | `errors` |
| Machine Status | `information` | `sensor` | `machMode` |
| Program | `play` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Rinse Aid | `spray-bottle` | `binary_sensor` | `rinseAidStatus` |
Expand All @@ -243,6 +246,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| On | `power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` |
| Pan Status | `pot-mix` | `binary_sensor` | `panStatus` |
| Power | `lightning-bolt` | `sensor` | `power` |
| Program | `play` | `sensor` | `programName` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Temperature | `thermometer` | `sensor` | `temp` |

Expand All @@ -265,6 +269,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| --- | --- | --- | --- |
| Connection | `wifi` | `binary_sensor` | `attributes.lastConnEvent.category` |
| On | `power-cycle` | `binary_sensor` | `attributes.parameters.onOffStatus` |
| Program | `play` | `sensor` | `programName` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Start Time | `clock-start` | `sensor` | `delayTime` |
| Temperature | `thermometer` | `sensor` | `temp` |
Expand Down Expand Up @@ -335,7 +340,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| Dry level | `hair-dryer` | `sensor` | `dryLevel` |
| Error | `math-log` | `sensor` | `errors` |
| Machine Status | `information` | `sensor` | `machMode` |
| Program | `tumble-dryer` | `sensor` | `programName` |
| Program | `play` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Start Time | `clock-start` | `sensor` | `delayTime` |
Expand Down Expand Up @@ -405,7 +410,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| Good Night Mode | | `binary_sensor` | `goodNight` |
| Machine Status | `information` | `sensor` | `machMode` |
| Pre Wash | | `binary_sensor` | `startProgram.prewash` |
| Program | `tumble-dryer` | `sensor` | `programName` |
| Program | `play` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` |
Expand Down Expand Up @@ -468,6 +473,7 @@ For every device exists a hidden button which can be used to log all infos of yo
| Good Night Mode | | `binary_sensor` | `goodNight` |
| Machine Status | `information` | `sensor` | `machMode` |
| Pre Wash | | `binary_sensor` | `startProgram.prewash` |
| Program | `play` | `sensor` | `programName` |
| Program Phase | `washing-machine` | `sensor` | `prPhase` |
| Remaining Time | `timer` | `sensor` | `remainingTimeMM` |
| Remote Control | `remote` | `binary_sensor` | `attributes.lastConnEvent.category` |
Expand Down
136 changes: 1 addition & 135 deletions custom_components/hon/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
"2": "WASHING_CMD&CTRL.PHASE_DRYING.TITLE",
"3": "TD_CMD&CTRL.STATUS_PHASE.PHASE_COOLDOWN",
"11": "WASHING_CMD&CTRL.PHASE_READY.TITLE",
"12": "unkown",
"13": "TD_CMD&CTRL.STATUS_PHASE.PHASE_COOLDOWN",
"14": "TD_CMD&CTRL.STATUS_PHASE.PHASE_HEAT_STROKE",
"15": "TD_CMD&CTRL.STATUS_PHASE.PHASE_HEAT_STROKE",
Expand Down Expand Up @@ -186,138 +187,3 @@
"vtroom1": "REF.ZONES.MY_ZONE_1",
"fridge_freezer": ["REF.ZONES.FRIDGE", " & ", "REF.ZONES.FREEZER"],
}

PROGRAMS_TD = [
"active_dry",
"allergy_care",
"all_in_one",
"antiallergy",
"anti_odours",
"auto_care",
"baby",
"bed_quilt",
"care_30",
"care_45",
"care_59",
"coloured",
"daily_45_min",
"daily_perfect_59_min",
"darks_and_coloured",
"delicates",
"duvet",
"eco",
"ecospeed_cottons",
"ecospeed_delicates",
"ecospeed_mixed",
"extra_hygiene",
"fitness",
"fresh_care",
"genius",
"hqd_baby_care",
"hqd_bath_towel",
"hqd_bed_sheets",
"hqd_bulky",
"hqd_casual",
"hqd_cold_wind_30",
"hqd_cold_wind_timing",
"hqd_cotton",
"hqd_curtain",
"hqd_delicate",
"hqd_diaper",
"hqd_duvet",
"hqd_feather",
"hqd_hot_wind_timing",
"hqd_hygienic",
"hqd_i_refresh",
"hqd_i_refresh_pro",
"hqd_jacket",
"hqd_jeans",
"hqd_luxury",
"hqd_mix",
"hqd_night_dry",
"hqd_outdoor",
"hqd_precious_cure",
"hqd_quick_20",
"hqd_quick_30",
"hqd_quick_dry",
"hqd_quilt",
"hqd_refresh",
"hqd_school_uniform",
"hqd_shirt",
"hqd_shoes",
"hqd_silk",
"hqd_sports",
"hqd_synthetics",
"hqd_timer",
"hqd_towel",
"hqd_underwear",
"hqd_warm_up",
"hqd_wool",
"hqd_working_suit",
"hygiene",
"iot_checkup",
"iot_dry_anti_mites",
"iot_dry_baby",
"iot_dry_backpacks",
"iot_dry_bathrobe",
"iot_dry_bed_linen",
"iot_dry_bed_quilt",
"iot_dry_cotton",
"iot_dry_cuddly_toys",
"iot_dry_curtains",
"iot_dry_dehumidifier",
"iot_dry_delicates",
"iot_dry_delicate_tablecloths",
"iot_dry_denim_jeans",
"iot_dry_down_jacket",
"iot_dry_duvet",
"iot_dry_easy_iron_cotton",
"iot_dry_easy_iron_synthetics",
"iot_dry_gym_fit",
"iot_dry_lingerie",
"iot_dry_mixed",
"iot_dry_playsuits",
"iot_dry_rapid_30",
"iot_dry_rapid_59",
"iot_dry_refresh",
"iot_dry_regenerates_waterproof",
"iot_dry_relax_creases",
"iot_dry_shirts",
"iot_dry_small_load",
"iot_dry_swimsuits_and_bikinis",
"iot_dry_synthetics",
"iot_dry_synthetic_dry",
"iot_dry_tablecloths",
"iot_dry_technical_fabrics",
"iot_dry_warm_embrace",
"iot_dry_wool",
"jeans",
"mix_and_dry",
"pets",
"pre_iron",
"rapid_30",
"rapid_45",
"rapid_59",
"refresh",
"relax_creases",
"saving_30_min",
"shirts",
"shoes",
"small_load",
"soft_care",
"sport_plus",
"super_easy_iron_misti",
"super_easy_iron_xxl",
"super_fast_cottons",
"super_fast_delicates",
"synthetics",
"total_care",
"trainers",
"ultra_care",
"waterproof_revitalize",
"whites",
"wool",
"woolmark",
"xxl_load",
"zoom_59",
]
4 changes: 2 additions & 2 deletions custom_components/hon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": [
"pyhOn==0.11.3"
"pyhOn==0.12.0"
],
"version": "0.8.0-beta.7"
"version": "0.8.0-beta.8"
}
47 changes: 45 additions & 2 deletions custom_components/hon/sensor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
from dataclasses import dataclass

from pyhon.appliance import HonAppliance

from homeassistant.components.sensor import (
SensorEntity,
SensorDeviceClass,
Expand Down Expand Up @@ -171,6 +173,13 @@ class HonSensorEntityDescription(SensorEntityDescription):
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
translation_key="temperature",
),
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_wm",
),
),
"TD": (
HonSensorEntityDescription(
Expand Down Expand Up @@ -203,10 +212,9 @@ class HonSensorEntityDescription(SensorEntityDescription):
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:tumble-dryer",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_td",
options=const.PROGRAMS_TD,
),
HonSensorEntityDescription(
key="prPhase",
Expand Down Expand Up @@ -291,6 +299,13 @@ class HonSensorEntityDescription(SensorEntityDescription):
icon="mdi:thermometer",
translation_key="target_temperature",
),
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_ov",
),
),
"IH": (
HonSensorEntityDescription(
Expand Down Expand Up @@ -318,6 +333,13 @@ class HonSensorEntityDescription(SensorEntityDescription):
state_class=SensorStateClass.MEASUREMENT,
translation_key="power",
),
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_ih",
),
),
"DW": (
HonConfigSensorEntityDescription(
Expand Down Expand Up @@ -391,6 +413,13 @@ class HonSensorEntityDescription(SensorEntityDescription):
translation_key="program_phases_dw",
options=list(const.DISHWASHER_PR_PHASE),
),
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_dw",
),
),
"AC": (
HonSensorEntityDescription(
Expand Down Expand Up @@ -457,6 +486,13 @@ class HonSensorEntityDescription(SensorEntityDescription):
device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
HonSensorEntityDescription(
key="programName",
name="Program",
icon="mdi:play",
device_class=SensorDeviceClass.ENUM,
translation_key="programs_ac",
),
),
"REF": (
HonSensorEntityDescription(
Expand Down Expand Up @@ -526,6 +562,13 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
class HonSensorEntity(HonEntity, SensorEntity):
entity_description: HonSensorEntityDescription

def __init__(self, hass, entry, device: HonAppliance, description):
super().__init__(hass, entry, device, description)
if self.entity_description.key == "programName":
self._attr_options = self._device.settings.get(
"startProgram.program"
).values + ["No Program"]

@callback
def _handle_coordinator_update(self):
value = self._device.get(self.entity_description.key, "")
Expand Down
Loading

0 comments on commit 2fe8ace

Please sign in to comment.