Skip to content

Commit

Permalink
chore(auto_configure): add Grakit dryer
Browse files Browse the repository at this point in the history
related #501
  • Loading branch information
xZetsubou committed Jan 22, 2025
1 parent 89b62df commit 1722081
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 1 deletion.
8 changes: 8 additions & 0 deletions custom_components/localtuya/core/ha_entities/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class DPCode(StrEnum):
ENERGY_REVERSE_B = "energy_reverse_b"
ENERGY_REVERSE_C = "energy_reverse_c"
EQUIPMENT_TIME = "equipment_time"
ERRO = "erro"
FAN_BEEP = "fan_beep" # Sound
FAN_COOL = "fan_cool" # Cool wind
FAN_COUNTDOWN = "fan_countdown"
Expand Down Expand Up @@ -333,6 +334,7 @@ class DPCode(StrEnum):
GAS_SENSOR_STATE = "gas_sensor_state"
GAS_SENSOR_STATUS = "gas_sensor_status"
GAS_SENSOR_VALUE = "gas_sensor_value"
HEAT_WD = "heat_wd"
HIGHTPROTECTVALUE = "hightprotectvalue"
HIJACK = "hijack"
HUMIDIFIER = "humidifier" # Humidification
Expand All @@ -356,6 +358,8 @@ class DPCode(StrEnum):
IS_LOGIN = "is_login"
KEY_STUDY = "key_study"
KNOB_SWITCH_MODE_1 = "knob_switch_mode_1"
LCD_ONOF = "lcd_onof"
LEDLIGHT = "ledlight"
LED_TYPE_1 = "led_type_1"
LED_TYPE_2 = "led_type_2"
LED_TYPE_3 = "led_type_3"
Expand All @@ -382,6 +386,7 @@ class DPCode(StrEnum):
MASTER_MODE = "master_mode" # alarm mode
MASTER_STATE = "master_state" # alarm mode
MATERIAL = "material" # Material
MATERIAL_TYPE = "material_type"
MAXHUM_SET = "maxhum_set"
MAXTEMP_SET = "maxtemp_set"
MAX_HUMI = "max_humi"
Expand Down Expand Up @@ -485,6 +490,7 @@ class DPCode(StrEnum):
PTZ_CONTROL = "ptz_control"
PTZ_STOP = "ptz_stop"
PUMP_RESET = "pump_reset" # Water pump reset
PVRPM = "pvrpm"
PV_CURRENT = "pv_current"
PV_POWER = "pv_power"
PV_VOLT = "pv_volt"
Expand Down Expand Up @@ -561,6 +567,7 @@ class DPCode(StrEnum):
SOUND_MODE = "sound_mode"
SOURCE = "source"
SPEED = "speed" # Speed level
SPEEK = "speek"
SPRAY_MODE = "spray_mode" # Spraying mode
SPRAY_VOLUME = "spray_volume" # Dehumidifier
STA = "sta" # Ikuu SXSEN003PIR IP65 Motion Detector (Wi-Fi)
Expand Down Expand Up @@ -718,6 +725,7 @@ class DPCode(StrEnum):
UPPER_TEMP = "upper_temp"
UPPER_TEMP_F = "upper_temp_f"
UP_CONFIRM = "up_confirm" # cover reset.
USB_BZ = "usb_bz"
USE_TIME = "use_time"
USE_TIME_ONE = "use_time_one"
UV = "uv" # UV sterilization
Expand Down
18 changes: 18 additions & 0 deletions custom_components/localtuya/core/ha_entities/binary_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,24 @@ def localtuya_binarySensor(state_on="1"):


BINARY_SENSORS: dict[str, tuple[LocalTuyaEntity, ...]] = {
# Fan
# https://developer.tuya.com/en/docs/iot/categoryfs?id=Kaiuz1xweel1c
"fs": (
LocalTuyaEntity(
id=DPCode.ERRO,
name="Error",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
custom_configs=ON_1,
),
LocalTuyaEntity(
id=DPCode.USB_BZ,
name="USB",
device_class=BinarySensorDeviceClass.PLUG,
entity_category=EntityCategory.DIAGNOSTIC,
custom_configs=STATE_TRUE,
),
),
# Multi-functional Sensor
# https://developer.tuya.com/en/docs/iot/categorydgnbj?id=Kaiuz3yorvzg3
"dgnbj": (
Expand Down
15 changes: 15 additions & 0 deletions custom_components/localtuya/core/ha_entities/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,21 @@ def localtuya_numbers(_min, _max, _step=1, _scale=1, unit=None) -> dict:
name="Temperature",
device_class=NumberDeviceClass.TEMPERATURE,
icon="mdi:thermometer-lines",
custom_configs=localtuya_numbers(1, 10, unit=UnitOfTemperature.CELSIUS),
),
LocalTuyaEntity(
id=(DPCode.TEMP_SET, DPCode.TEMP_SET_F),
name="Temperature",
entity_category=EntityCategory.CONFIG,
device_class=NumberDeviceClass.TEMPERATURE,
custom_configs=localtuya_numbers(40, 70, unit=UnitOfTemperature.CELSIUS),
),
LocalTuyaEntity(
id=DPCode.COUNTDOWN,
icon="mdi:timer",
entity_category=EntityCategory.CONFIG,
name="Timer",
custom_configs=localtuya_numbers(0, 86400, 1, 1, UnitOfTime.SECONDS),
),
),
# Humidifier
Expand Down
52 changes: 52 additions & 0 deletions custom_components/localtuya/core/ha_entities/selects.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,58 @@ def localtuya_selector(options):
name="Countdown",
custom_configs=localtuya_selector(COUNT_DOWN_HOURS),
),
# Gratkit dryer v2 https://github.com/xZetsubou/hass-localtuya/issues/501
LocalTuyaEntity(
id=DPCode.LEDLIGHT,
entity_category=EntityCategory.CONFIG,
icon="mdi:led-strip",
name="Light",
custom_configs=localtuya_selector(
{
"0": "OFF",
"1": "Red",
"2": "Green",
"3": "Blue",
"4": "White",
"5": "Yellow",
"6": "Cyan",
"7": "Purple",
"8": "Orange",
"9": "Pink",
"10": "Rainbow Fade",
"11": "Rainbow Blink",
"12": "Rainbow Smooth",
"13": "13",
"14": "14",
"15": "15",
"16": "16",
"17": "17",
"18": "18",
"19": "19",
"20": "20",
}
),
),
LocalTuyaEntity(
id=DPCode.MATERIAL_TYPE,
entity_category=EntityCategory.CONFIG,
icon="mdi:kite-outline",
name="Material Type",
custom_configs=localtuya_selector(
{
"PETG": "PETG",
"PLA_J": "PLA_J",
"PC": "PC",
"TPU": "TPU",
"ABS": "ABS",
"DIY2": "DIY2",
"PLA": "PLA",
"DIY1": "DIY1",
"Nylon": "Nylon",
"HIPS": "HIPS",
}
),
),
),
# Curtain
# https://developer.tuya.com/en/docs/iot/f?id=K9gf46o5mtfyc
Expand Down
23 changes: 22 additions & 1 deletion custom_components/localtuya/core/ha_entities/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,30 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
"fs": (
LocalTuyaEntity(
id=DPCode.TEMP_CURRENT,
# name="temperature",
name="Current Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS),
),
LocalTuyaEntity(
id=DPCode.HUMIDITY,
name="Current Humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(PERCENTAGE),
),
LocalTuyaEntity(
id=DPCode.HEAT_WD,
name="Heating Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS),
),
LocalTuyaEntity(
id=DPCode.PVRPM,
name="Fan Speed",
icon="mdi:fan",
custom_configs=localtuya_sensor("rpm"),
),
),
# eMylo Smart WiFi IR Remote
Expand Down
12 changes: 12 additions & 0 deletions custom_components/localtuya/core/ha_entities/switches.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,18 @@
icon="mdi:account-lock",
entity_category=EntityCategory.CONFIG,
),
LocalTuyaEntity(
id=DPCode.LCD_ONOF,
name="LCD",
icon="mdi:television",
entity_category=EntityCategory.CONFIG,
),
LocalTuyaEntity(
id=DPCode.SPEEK,
name="Sound",
icon="mdi:volume-medium",
entity_category=EntityCategory.CONFIG,
),
),
# Fan switch
"fskg": (
Expand Down

0 comments on commit 1722081

Please sign in to comment.