172 lines
4.4 KiB
YAML
172 lines
4.4 KiB
YAML
substitutions:
|
|
name: proficook-pc-wks-1167g
|
|
friendly_name: ProfiCook PC-WKS 1167G
|
|
device_name: wks-1167g
|
|
|
|
esphome:
|
|
name: proficook-pc-wks-1167g
|
|
friendly_name: ProfiCook PC-WKS 1167G
|
|
|
|
esp32:
|
|
board: esp32-c3-devkitm-1
|
|
framework:
|
|
type: arduino # idf не працює, йде в bootloop
|
|
|
|
packages:
|
|
common: !include includes/common.yaml
|
|
wifi_sensors: !include includes/wifi.yaml
|
|
|
|
uart:
|
|
rx_pin: GPIO20
|
|
tx_pin: GPIO21
|
|
baud_rate: 9600
|
|
|
|
# Register the Tuya MCU connection
|
|
tuya:
|
|
id: tuya_tuya_id
|
|
|
|
climate:
|
|
- platform: tuya
|
|
name: "Kettle Climate"
|
|
target_temperature_datapoint: 102
|
|
current_temperature_datapoint: 105
|
|
switch_datapoint: 101
|
|
active_state:
|
|
datapoint: 106
|
|
visual:
|
|
min_temperature: 35
|
|
max_temperature: 100
|
|
temperature_step: 5
|
|
|
|
text_sensor:
|
|
- platform: template
|
|
name: Kettle State
|
|
icon: mdi:kettle
|
|
id: text_state
|
|
- platform: template
|
|
name: Kettle Error
|
|
icon: mdi:alert-circle-outline
|
|
id: text_error
|
|
|
|
select:
|
|
- platform: template
|
|
name: "Kettle mode"
|
|
id: kettle_control
|
|
options:
|
|
- 45°
|
|
- 60°
|
|
- 85°
|
|
- 100°
|
|
- 100° and off
|
|
- Custom
|
|
- "Off"
|
|
optimistic: true
|
|
set_action:
|
|
- lambda: |-
|
|
if (strcmp(x.c_str(), "45°") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 0);
|
|
} else if (strcmp(x.c_str(), "60°") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 1);
|
|
} else if (strcmp(x.c_str(), "85°") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 2);
|
|
} else if (strcmp(x.c_str(), "100°") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 3);
|
|
} else if (strcmp(x.c_str(), "100° and off") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 4);
|
|
} else if (strcmp(x.c_str(), "Custom") == 0) {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 5);
|
|
} else {
|
|
id(tuya_tuya_id).set_enum_datapoint_value(101, 6);
|
|
}
|
|
|
|
number:
|
|
- platform: "tuya"
|
|
id: custom_temp
|
|
name: "Kettle Custom Temperature"
|
|
number_datapoint: 102
|
|
icon: mdi:oil-temperature
|
|
min_value: 35
|
|
max_value: 100
|
|
step: 1
|
|
|
|
sensor:
|
|
update_interval: 60s
|
|
- platform: template
|
|
name: Kettle Temperature
|
|
id: kettle_temp
|
|
unit_of_measurement: "°C"
|
|
accuracy_decimals: 0
|
|
|
|
- platform: tuya
|
|
id: tuya_105
|
|
sensor_datapoint: 105
|
|
on_value:
|
|
then:
|
|
- if:
|
|
condition:
|
|
lambda: |-
|
|
return static_cast<int>(id(tuya_106).state) == 1;
|
|
then:
|
|
- sensor.template.publish:
|
|
id: kettle_temp
|
|
state: !lambda |-
|
|
return 0;
|
|
else:
|
|
- sensor.template.publish:
|
|
id: kettle_temp
|
|
state: !lambda |-
|
|
return id(tuya_105).state;
|
|
|
|
- platform: tuya
|
|
id: kettle_remaining
|
|
name: Kettle Remaining Time
|
|
icon: mdi:clock-time-five-outline
|
|
sensor_datapoint: 107
|
|
unit_of_measurement: "min"
|
|
accuracy_decimals: 0
|
|
|
|
- platform: tuya
|
|
id: tuya_101
|
|
sensor_datapoint: 101
|
|
on_value:
|
|
then:
|
|
- select.set_index:
|
|
id: kettle_control
|
|
index: !lambda |-
|
|
return id(tuya_101).state;
|
|
|
|
- platform: tuya
|
|
id: tuya_106
|
|
sensor_datapoint: 106
|
|
on_value:
|
|
then:
|
|
- text_sensor.template.publish:
|
|
id: text_state
|
|
state: !lambda |-
|
|
switch(static_cast<int>(id(tuya_106).state)) {
|
|
case 1: return {"Lifted"};
|
|
case 2: return {"Standby"};
|
|
case 3: return {"Heating"};
|
|
case 4: return {"Cooling"};
|
|
case 5: return {"Maintaining Temp"};
|
|
default: return {""};
|
|
}
|
|
- platform: tuya
|
|
id: tuya_104
|
|
sensor_datapoint: 104
|
|
on_value:
|
|
then:
|
|
- if:
|
|
condition:
|
|
lambda: |-
|
|
return id(kettle_temp).raw_state == 0;
|
|
else:
|
|
- text_sensor.template.publish:
|
|
id: text_error
|
|
state: !lambda |-
|
|
switch(static_cast<int>(id(tuya_104).state)) {
|
|
case 0: return {"OK"};
|
|
case 1: return {"Empty"};
|
|
case 4: return {"Overheated"};
|
|
default: return {"other error"};
|
|
}
|