Skip to content

Commit

Permalink
Update translations
Browse files Browse the repository at this point in the history
  • Loading branch information
gvigroux committed Mar 10, 2024
1 parent e72e765 commit 1b6c9a0
Show file tree
Hide file tree
Showing 14 changed files with 432 additions and 438 deletions.
2 changes: 1 addition & 1 deletion custom_components/hon/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Optional
from enum import IntEnum

from .const import DOMAIN, OVEN_PROGRAMS, DISH_WASHER_MODE, DISH_WASHER_PROGRAMS, CLIMATE_MODE, APPLIANCE_TYPE
from .const import DOMAIN, APPLIANCE_TYPE
from .base import HonBaseCoordinator, HonBaseBinarySensorEntity

from homeassistant.core import callback
Expand Down
20 changes: 16 additions & 4 deletions custom_components/hon/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
ATTR_TEMPERATURE,
PRECISION_TENTHS,
PRECISION_WHOLE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
UnitOfTemperature,
Expand Down Expand Up @@ -188,10 +186,12 @@ def __init__(self,hass, coordinator, entry, appliance) -> None:
self._attr_temperature_unit = UnitOfTemperature.CELSIUS # 'tempUnit': '0'
self._attr_target_temperature_step = PRECISION_WHOLE


self._enable_turn_on_off_backwards_compatibility = False
self._attr_fan_modes = [] #[FAN_OFF, FAN_LOW, FAN_MEDIUM, FAN_HIGH, FAN_AUTO]
self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.COOL, HVACMode.AUTO, HVACMode.OFF, HVACMode.FAN_ONLY, HVACMode.DRY]
self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.COOL, HVACMode.AUTO, HVACMode.FAN_ONLY, HVACMode.DRY, HVACMode.OFF]
self._attr_swing_modes = [SWING_OFF, SWING_BOTH, SWING_VERTICAL, SWING_HORIZONTAL]
self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.SWING_MODE
self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.SWING_MODE | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON

''' hon specific values '''
parameters = self._device.settings_command().parameters
Expand Down Expand Up @@ -357,6 +357,18 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
self._attr_hvac_mode = hvac_mode
self.start_watcher()


async def async_turn_off(self) -> None:
await self._device.stop_command().send()
self._attr_hvac_mode = HVACMode.OFF
self.start_watcher()

async def async_turn_on(self) -> None:
await self._device.start_command('iot_simple_start').send()
self._attr_hvac_mode = get_key(CLIMATE_HVAC_MODE, self._device.get('machMode'), HVACMode.OFF)
self.start_watcher()


async def async_set_fan_mode(self, fan_mode: str):
self._attr_fan_mode = fan_mode
await self._device.settings_command({'windSpeed':CLIMATE_FAN_MODE.get(fan_mode, CLIMATE_FAN_MODE.get(FAN_MEDIUM))}).send()
Expand Down
196 changes: 29 additions & 167 deletions custom_components/hon/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
DOMAIN = "hon"



CONF_ID_TOKEN = "token"
CONF_COGNITO_TOKEN = "cognito_token"
CONF_REFRESH_TOKEN = "refresh_token"
Expand Down Expand Up @@ -65,15 +64,6 @@ class APPLIANCE_TYPE(IntEnum):
"14": "Fridge",
}


CLIMATE_MODE = {
"0": "Auto",
"1": "Cool",
"2": "Dry",
"4": "Heat",
"6": "Fan only",
}

CLIMATE_FAN_MODE = {
FAN_OFF: "0",
FAN_LOW: "3",
Expand Down Expand Up @@ -114,160 +104,32 @@ class ClimateEcoPilotMode:
FOLLOW = "2"


OVEN_PROGRAMS = {
"3": "Botton",
"4": "Bottom + fan",
"6": "Convection + fan",
"5": "Convectional",
"10": "Taylor Bake",
"23": "Multi-level",
"54": "Soft+"
}

WASHING_MACHINE_DOOR_LOCK_STATUS = {
"1": "Locked",
"0": "Unlocked"
}

WASHING_MACHINE_ERROR_CODES = {
"00": "No error",
#"E1": "Error E1: Check the filter of the washing machine",
"100000000000": "E2: Check if the door is closed",
"8000000000000": "E4: Check the water supply",
#"CLRF": "Error Clear Filter: Check the filter of the washing machine",
"400000000000000": "Error Unb: Check the laundry, the washing machine might be overloaded",
#"F3": "Error F3: Temperature sensor error",
#"F4": "Error F4: Heating error",
#"F7": "Error F7: Motor error",
#"FA": "Error FA: Water level sensor error",
#"FC0": "Error FC0: Communication error",
#"FC1": "Error FC1: Communication error",
#"FC2": "Error FC2: Communication error"
}

WASHING_MACHINE_MODE = {
"0": "Disconnected",
"1": "Ready",
"2": "Running",
"3": "Paused",
"5": "Scheduled",
"6": "Error",
"7": "Finished"
}

WASHING_MACHINE_PROGRAM = {
"0": {
"name": "fragile",
"spinSpeed": "400",
"temp": "30",
"rinseIterations": "1",
"mainWashTime": "10",
"autoSoftenerStatus": "1"
},
"1": {
"name": "quotidien sale",
"spinSpeed": "1400",
"temp": "40",
"rinseIterations": "2",
"mainWashTime": "15",
"autoSoftenerStatus": "1"
},
}

DISH_WASHER_MODE = {
"1": "Ready",
"2": "Running",
"3": "Delayed start",
"5": "Delayed start cancelled",
"7": "Finished",
"9": "XXXXXX"
}

##some programs share id but parameters (T, W, time) might be differnet. Task develop parameter adjustment
DISH_WASHER_PROGRAMS = {
"1": "program1",
"2": "program2",
"3": "Strong & Fast",
"4": "program4",
"5": "Dinner for 2",
"6": "program6",
"7": "program7",
"8": "Eco 45ºC", ##happy hour, plastic & tupperware (75ºC & more water usage)
"9": "Crystal", ##delicate 45ºC
"10": "Class A 59' 65ºC", ##Pirex & Glassware
"11": "Fast 29' 50ºC",
"12": "Rinse",
"13": "Crystal 45ºC",
"14": "Auto Universal 65-75ºC",
"15": "Auto Universal 50-60ºC", ##daily, special for pots
"16": "Auto Sensor", ##dinner for 2, coctail glasses
"17": "Ultra Silence 55ºC",
"21": "Breakfast", #fast 39' 60ºC
"22": "Sanitizing cycle",
"23": "Baby Care", #super cleaning, vapor plus 75ºC
"24": "Hygiene+ 75ºC",
}

TUMBLE_DRYER_MODE = {
"1": "Ready",
"2": "Running",
"7": "Finished"
}

TUMBLE_DRYER_PROGRAMS = {
"0": "Default",
"62": "Cotton",
"63": "Synthetics",
"64": "Mix",
"66": "Bed Sheets",
"72": "Sports",
"74": "i-time",
"75": "Duvet",
"76": "Wool",
"78": "i-Refresh",
"83": "Towel",
"85": "Quick Dry",
"92": "Delicate",
"103": "Remote 103"
}

TUMBLE_DRYER_PROGRAMS_PHASE = {
"0": "Waiting",
"2": "Drying",
"3": "Cooldown",
"11": "11"
}

TUMBLE_DRYER_DRYL = {
"3": "Cupboard dry",
"12": "Extra Dry H-3",
"13": "Ready to Store H-2",
"14": "Ready to Iron H-1"
}

TUMBLE_DRYER_TEMPL = {
"1": "Cool",
"2": "Low temperature L-1",
"3": "Middle temperature L-2",
"4": "High temperature L-3"
}


PURIFIER_MODE = {
"0": "Off",
"1": "Sleep",
"2": "Auto",
"4": "Max"
}

PURIFIER_VOC_VALUE = {
"1": "Good",
"2": "Moderate",
"3": "Mediocre",
"4": "Bad"
}
PURIFIER_LIGHT_VALUE = {
"0": "Off",
"1": "50%",
"2": "100%"
}
#WASHING_MACHINE_DOOR_LOCK_STATUS = {
# "1": "Locked",
# "0": "Unlocked"
#}

#WASHING_MACHINE_PROGRAM = {
# "0": {
# "name": "fragile",
# "spinSpeed": "400",
# "temp": "30",
# "rinseIterations": "1",
# "mainWashTime": "10",
# "autoSoftenerStatus": "1"
# },
# "1": {
# "name": "quotidien sale",
# "spinSpeed": "1400",
# "temp": "40",
# "rinseIterations": "2",
# "mainWashTime": "15",
# "autoSoftenerStatus": "1"
# },
#}

#PURIFIER_LIGHT_VALUE = {
# "0": "Off",
# "1": "50%",
# "2": "100%"
#}
7 changes: 4 additions & 3 deletions custom_components/hon/hon.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,12 @@ async def async_set(self, mac, typeName, parameters):
command["parameters"] = parameters
command["timestamp"] = timestamp
command["transactionId"] = mac + "_" + command["timestamp"]
_LOGGER.debug((f"Command sent (async_set): {command}"))

async with self._session.post(f"{API_URL}/commands/v1/send",headers=self._headers,json=command,) as resp:
try:
data = await resp.json()
_LOGGER.debug(data)
_LOGGER.debug((f"Command result (async_set): {data}"))
except json.JSONDecodeError:
_LOGGER.error("hOn Invalid Data ["+ str(resp.text()) + "] after sending command ["+ str(command)+ "]")
return False
Expand Down Expand Up @@ -332,13 +333,13 @@ async def send_command(self, device, command, parameters, ancillary_parameters):
"parameters": parameters,
"applianceType": device.appliance_type
}
_LOGGER.debug(command)
_LOGGER.debug((f"Command sent (send_command): {command}"))

url = f"{API_URL}/commands/v1/send"
async with self._session.post(url, headers=self._headers, json=command) as resp:
try:
data = await resp.json()
_LOGGER.debug(data)
_LOGGER.debug((f"Command result (send_command): {data}"))
except json.JSONDecodeError:
_LOGGER.error("hOn Invalid Data ["+ str(resp.text()) + "] after sending command ["+ str(command)+ "]")
return False
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://github.com/gvigroux/hon",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/gvigroux/hon/issues",
"version": "0.6.12"
"version": "0.6.13"
}
Loading

0 comments on commit 1b6c9a0

Please sign in to comment.