esphome 2024.11.3__py3-none-any.whl → 2024.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/components/adc/adc_sensor.h +7 -8
- esphome/components/adc/adc_sensor_common.cpp +24 -0
- esphome/components/adc/{adc_sensor.cpp → adc_sensor_esp32.cpp} +10 -179
- esphome/components/adc/adc_sensor_esp8266.cpp +58 -0
- esphome/components/adc/adc_sensor_libretiny.cpp +48 -0
- esphome/components/adc/adc_sensor_rp2040.cpp +93 -0
- esphome/components/alarm_control_panel/alarm_control_panel_call.cpp +3 -4
- esphome/components/animation/__init__.py +1 -2
- esphome/components/apds9306/apds9306.cpp +2 -1
- esphome/components/audio/audio.h +1 -1
- esphome/components/bk72xx/__init__.py +1 -1
- esphome/components/cse7766/cse7766.cpp +1 -1
- esphome/components/deep_sleep/deep_sleep_esp32.cpp +2 -2
- esphome/components/dht/dht.cpp +2 -1
- esphome/components/display/display.cpp +10 -6
- esphome/components/display/display.h +14 -0
- esphome/components/display_menu_base/__init__.py +0 -2
- esphome/components/display_menu_base/display_menu_base.cpp +1 -1
- esphome/components/dsmr/dsmr.cpp +1 -1
- esphome/components/esp32/__init__.py +94 -12
- esphome/components/esp32/boards.py +222 -14
- esphome/components/esp32_ble/__init__.py +22 -2
- esphome/components/esp32_ble/ble.cpp +39 -12
- esphome/components/esp32_ble/ble.h +2 -0
- esphome/components/esp32_ble/ble_advertising.cpp +1 -1
- esphome/components/esp32_ble/ble_uuid.cpp +9 -10
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +4 -1
- esphome/components/esp32_camera_web_server/camera_web_server.h +1 -1
- esphome/components/esp32_rmt_led_strip/light.py +3 -3
- esphome/components/esp8266/__init__.py +5 -7
- esphome/components/ezo/ezo.cpp +14 -26
- esphome/components/font/__init__.py +10 -25
- esphome/components/font/font.cpp +5 -3
- esphome/components/graphical_display_menu/__init__.py +2 -0
- esphome/components/haier/hon_climate.cpp +79 -80
- esphome/components/hbridge/switch/__init__.py +44 -0
- esphome/components/hbridge/switch/hbridge_switch.cpp +95 -0
- esphome/components/hbridge/switch/hbridge_switch.h +50 -0
- esphome/components/hitachi_ac344/hitachi_ac344.cpp +4 -2
- esphome/components/hitachi_ac424/hitachi_ac424.cpp +4 -2
- esphome/components/homeassistant/number/homeassistant_number.cpp +3 -0
- esphome/components/hx711/hx711.cpp +1 -1
- esphome/components/hx711/hx711.h +1 -1
- esphome/components/i2c/i2c_bus_esp_idf.cpp +2 -2
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +61 -59
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +8 -17
- esphome/components/ili9xxx/display.py +1 -2
- esphome/components/ili9xxx/ili9xxx_display.cpp +3 -2
- esphome/components/image/__init__.py +1 -2
- esphome/components/logger/logger.cpp +1 -1
- esphome/components/ltr501/ltr501.cpp +1 -1
- esphome/components/lvgl/defines.py +8 -1
- esphome/components/lvgl/lv_validation.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +1 -1
- esphome/components/lvgl/lvgl_esphome.h +16 -0
- esphome/components/lvgl/widgets/animimg.py +12 -17
- esphome/components/lvgl/widgets/img.py +1 -3
- esphome/components/matrix_keypad/__init__.py +15 -3
- esphome/components/matrix_keypad/matrix_keypad.cpp +4 -0
- esphome/components/matrix_keypad/matrix_keypad.h +5 -0
- esphome/components/max31865/max31865.cpp +4 -2
- esphome/components/modbus_controller/modbus_controller.cpp +24 -24
- esphome/components/modbus_controller/modbus_controller.h +22 -22
- esphome/components/modbus_controller/number/modbus_number.cpp +8 -8
- esphome/components/modbus_controller/number/modbus_number.h +4 -4
- esphome/components/modbus_controller/output/modbus_output.cpp +7 -6
- esphome/components/modbus_controller/output/modbus_output.h +5 -5
- esphome/components/modbus_controller/select/modbus_select.cpp +4 -3
- esphome/components/modbus_controller/select/modbus_select.h +4 -4
- esphome/components/modbus_controller/switch/modbus_switch.cpp +5 -5
- esphome/components/modbus_controller/switch/modbus_switch.h +2 -2
- esphome/components/mqtt/__init__.py +4 -0
- esphome/components/mqtt/mqtt_alarm_control_panel.cpp +2 -5
- esphome/components/mqtt/mqtt_backend_esp32.cpp +3 -3
- esphome/components/mqtt/mqtt_client.cpp +4 -0
- esphome/components/mqtt/mqtt_client.h +6 -0
- esphome/components/mqtt/mqtt_climate.cpp +13 -3
- esphome/components/mqtt/mqtt_sensor.cpp +2 -0
- esphome/components/network/ip_address.h +1 -1
- esphome/components/nextion/__init__.py +2 -0
- esphome/components/nextion/automation.h +76 -0
- esphome/components/nextion/base_component.py +1 -0
- esphome/components/nextion/binary_sensor/__init__.py +43 -2
- esphome/components/nextion/display.py +15 -0
- esphome/components/nextion/nextion.cpp +8 -5
- esphome/components/nextion/nextion.h +7 -0
- esphome/components/nextion/nextion_upload_idf.cpp +2 -2
- esphome/components/nextion/sensor/__init__.py +38 -5
- esphome/components/nextion/switch/__init__.py +38 -2
- esphome/components/nextion/text_sensor/__init__.py +37 -2
- esphome/components/nfc/ndef_record.cpp +3 -3
- esphome/components/online_image/__init__.py +1 -0
- esphome/components/opentherm/opentherm.cpp +3 -3
- esphome/components/opentherm/opentherm.h +1 -1
- esphome/components/ota/automation.h +1 -1
- esphome/components/output/float_output.cpp +1 -1
- esphome/components/pca6416a/pca6416a.cpp +5 -3
- esphome/components/pca9554/pca9554.cpp +4 -4
- esphome/components/pipsolar/pipsolar.cpp +2 -2
- esphome/components/pipsolar/switch/pipsolar_switch.cpp +2 -2
- esphome/components/pn532/pn532_mifare_ultralight.cpp +2 -2
- esphome/components/pn7150/pn7150_mifare_ultralight.cpp +2 -2
- esphome/components/pn7160/pn7160_mifare_ultralight.cpp +2 -2
- esphome/components/qmc5883l/qmc5883l.cpp +45 -19
- esphome/components/qmc5883l/qmc5883l.h +1 -1
- esphome/components/qspi_dbi/qspi_dbi.cpp +2 -1
- esphome/components/remote_base/raw_protocol.cpp +1 -1
- esphome/components/remote_receiver/__init__.py +5 -6
- esphome/components/rotary_encoder/rotary_encoder.cpp +3 -1
- esphome/components/rp2040/__init__.py +1 -1
- esphome/components/rtl87xx/__init__.py +1 -1
- esphome/components/safe_mode/automation.h +1 -1
- esphome/components/seeed_mr60bha2/__init__.py +41 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.cpp +173 -0
- esphome/components/seeed_mr60bha2/seeed_mr60bha2.h +61 -0
- esphome/components/seeed_mr60bha2/sensor.py +57 -0
- esphome/components/seeed_mr60fda2/__init__.py +41 -0
- esphome/components/seeed_mr60fda2/binary_sensor.py +33 -0
- esphome/components/seeed_mr60fda2/button/__init__.py +45 -0
- esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.cpp +9 -0
- esphome/components/seeed_mr60fda2/button/get_radar_parameters_button.h +18 -0
- esphome/components/seeed_mr60fda2/button/reset_radar_button.cpp +9 -0
- esphome/components/seeed_mr60fda2/button/reset_radar_button.h +18 -0
- esphome/components/seeed_mr60fda2/seeed_mr60fda2.cpp +368 -0
- esphome/components/seeed_mr60fda2/seeed_mr60fda2.h +101 -0
- esphome/components/seeed_mr60fda2/select/__init__.py +59 -0
- esphome/components/seeed_mr60fda2/select/height_threshold_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/height_threshold_select.h +18 -0
- esphome/components/seeed_mr60fda2/select/install_height_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/install_height_select.h +18 -0
- esphome/components/seeed_mr60fda2/select/sensitivity_select.cpp +15 -0
- esphome/components/seeed_mr60fda2/select/sensitivity_select.h +18 -0
- esphome/components/sen5x/sensor.py +5 -6
- esphome/components/sgp30/sensor.py +8 -9
- esphome/components/sgp30/sgp30.cpp +2 -6
- esphome/components/shelly_dimmer/shelly_dimmer.cpp +1 -1
- esphome/components/sim800l/sim800l.cpp +1 -1
- esphome/components/sntp/sntp_component.cpp +14 -20
- esphome/components/sntp/sntp_component.h +6 -9
- esphome/components/sntp/time.py +4 -7
- esphome/components/sprinkler/sprinkler.cpp +2 -2
- esphome/components/st7735/st7735.cpp +1 -1
- esphome/components/st7789v/st7789v.cpp +1 -1
- esphome/components/stepper/stepper.h +0 -1
- esphome/components/sun_gtil2/sun_gtil2.cpp +1 -1
- esphome/components/switch/binary_sensor/__init__.py +31 -0
- esphome/components/switch/binary_sensor/switch_binary_sensor.cpp +17 -0
- esphome/components/switch/binary_sensor/switch_binary_sensor.h +22 -0
- esphome/components/sx1509/sx1509_gpio_pin.cpp +2 -1
- esphome/components/sx1509/sx1509_gpio_pin.h +5 -5
- esphome/components/uart/uart.h +1 -1
- esphome/components/udp/udp_component.cpp +32 -16
- esphome/components/ufire_ec/sensor.py +4 -4
- esphome/components/uln2003/uln2003.cpp +4 -1
- esphome/components/waveshare_epaper/display.py +8 -0
- esphome/components/waveshare_epaper/waveshare_epaper.cpp +191 -0
- esphome/components/waveshare_epaper/waveshare_epaper.h +56 -0
- esphome/components/wiegand/__init__.py +3 -4
- esphome/components/wifi/__init__.py +42 -0
- esphome/components/wifi/wifi_component.cpp +2 -2
- esphome/components/wifi/wifi_component.h +82 -1
- esphome/components/wifi/wifi_component_esp32_arduino.cpp +1 -1
- esphome/components/wifi/wifi_component_esp8266.cpp +1 -1
- esphome/components/wifi/wifi_component_esp_idf.cpp +1 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +1 -1
- esphome/components/wifi/wifi_component_pico_w.cpp +1 -1
- esphome/components/wireguard/wireguard.cpp +2 -2
- esphome/components/xiaomi_ble/xiaomi_ble.cpp +1 -1
- esphome/config_validation.py +15 -11
- esphome/const.py +11 -1
- esphome/core/component.cpp +1 -1
- esphome/core/config.py +1 -2
- esphome/core/defines.h +3 -1
- esphome/core/helpers.cpp +8 -2
- esphome/core/helpers.h +2 -1
- esphome/core/optional.h +2 -2
- esphome/dashboard/web_server.py +6 -0
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/METADATA +4 -4
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/RECORD +183 -153
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/LICENSE +0 -0
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/WHEEL +0 -0
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/entry_points.txt +0 -0
- {esphome-2024.11.3.dist-info → esphome-2024.12.0.dist-info}/top_level.txt +0 -0
@@ -35,7 +35,9 @@ void HonClimate::set_beeper_state(bool state) {
|
|
35
35
|
if (state != this->settings_.beeper_state) {
|
36
36
|
this->settings_.beeper_state = state;
|
37
37
|
#ifdef USE_SWITCH
|
38
|
-
this->beeper_switch_
|
38
|
+
if (this->beeper_switch_ != nullptr) {
|
39
|
+
this->beeper_switch_->publish_state(state);
|
40
|
+
}
|
39
41
|
#endif
|
40
42
|
this->hon_rtc_.save(&this->settings_);
|
41
43
|
}
|
@@ -45,10 +47,17 @@ bool HonClimate::get_beeper_state() const { return this->settings_.beeper_state;
|
|
45
47
|
|
46
48
|
void HonClimate::set_quiet_mode_state(bool state) {
|
47
49
|
if (state != this->get_quiet_mode_state()) {
|
48
|
-
this->
|
50
|
+
if ((this->mode != ClimateMode::CLIMATE_MODE_OFF) && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
|
51
|
+
this->quiet_mode_state_ = state ? SwitchState::PENDING_ON : SwitchState::PENDING_OFF;
|
52
|
+
this->force_send_control_ = true;
|
53
|
+
} else {
|
54
|
+
this->quiet_mode_state_ = state ? SwitchState::ON : SwitchState::OFF;
|
55
|
+
}
|
49
56
|
this->settings_.quiet_mode_state = state;
|
50
57
|
#ifdef USE_SWITCH
|
51
|
-
this->quiet_mode_switch_
|
58
|
+
if (this->quiet_mode_switch_ != nullptr) {
|
59
|
+
this->quiet_mode_switch_->publish_state(state);
|
60
|
+
}
|
52
61
|
#endif
|
53
62
|
this->hon_rtc_.save(&this->settings_);
|
54
63
|
}
|
@@ -509,7 +518,7 @@ void HonClimate::initialization() {
|
|
509
518
|
}
|
510
519
|
this->current_vertical_swing_ = this->settings_.last_vertiacal_swing;
|
511
520
|
this->current_horizontal_swing_ = this->settings_.last_horizontal_swing;
|
512
|
-
this->quiet_mode_state_ = this->settings_.quiet_mode_state ? SwitchState::
|
521
|
+
this->quiet_mode_state_ = this->settings_.quiet_mode_state ? SwitchState::ON : SwitchState::OFF;
|
513
522
|
}
|
514
523
|
|
515
524
|
haier_protocol::HaierMessage HonClimate::get_control_message() {
|
@@ -932,7 +941,7 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t *
|
|
932
941
|
if (this->mode == CLIMATE_MODE_OFF) {
|
933
942
|
// AC just turned on from remote need to turn off display
|
934
943
|
this->force_send_control_ = true;
|
935
|
-
} else if ((((uint8_t) this->
|
944
|
+
} else if ((((uint8_t) this->display_status_) & 0b10) == 0) {
|
936
945
|
this->display_status_ = disp_status ? SwitchState::ON : SwitchState::OFF;
|
937
946
|
}
|
938
947
|
}
|
@@ -1004,6 +1013,11 @@ haier_protocol::HandlerError HonClimate::process_status_message_(const uint8_t *
|
|
1004
1013
|
if (new_quiet_mode != this->get_quiet_mode_state()) {
|
1005
1014
|
this->quiet_mode_state_ = new_quiet_mode ? SwitchState::ON : SwitchState::OFF;
|
1006
1015
|
this->settings_.quiet_mode_state = new_quiet_mode;
|
1016
|
+
#ifdef USE_SWITCH
|
1017
|
+
if (this->quiet_mode_switch_ != nullptr) {
|
1018
|
+
this->quiet_mode_switch_->publish_state(new_quiet_mode);
|
1019
|
+
}
|
1020
|
+
#endif // USE_SWITCH
|
1007
1021
|
this->hon_rtc_.save(&this->settings_);
|
1008
1022
|
}
|
1009
1023
|
}
|
@@ -1069,19 +1083,17 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1069
1083
|
climate_control = this->current_hvac_settings_;
|
1070
1084
|
// Beeper command
|
1071
1085
|
{
|
1072
|
-
this->control_messages_queue_.
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2));
|
1086
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1087
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1088
|
+
(uint8_t) hon_protocol::DataParameters::BEEPER_STATUS,
|
1089
|
+
this->get_beeper_state() ? ZERO_BUF : ONE_BUF, 2);
|
1077
1090
|
}
|
1078
1091
|
// Health mode
|
1079
1092
|
{
|
1080
|
-
this->control_messages_queue_.
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2));
|
1093
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1094
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1095
|
+
(uint8_t) hon_protocol::DataParameters::HEALTH_MODE,
|
1096
|
+
this->get_health_mode() ? ONE_BUF : ZERO_BUF, 2);
|
1085
1097
|
this->health_mode_ = (SwitchState) ((uint8_t) this->health_mode_ & 0b01);
|
1086
1098
|
}
|
1087
1099
|
// Climate mode
|
@@ -1099,51 +1111,46 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1099
1111
|
case CLIMATE_MODE_HEAT_COOL:
|
1100
1112
|
new_power = true;
|
1101
1113
|
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::AUTO;
|
1102
|
-
this->control_messages_queue_.
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
buffer, 2));
|
1114
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1115
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1116
|
+
(uint8_t) hon_protocol::DataParameters::AC_MODE,
|
1117
|
+
buffer, 2);
|
1107
1118
|
fan_mode_buf[1] = this->other_modes_fan_speed_;
|
1108
1119
|
break;
|
1109
1120
|
case CLIMATE_MODE_HEAT:
|
1110
1121
|
new_power = true;
|
1111
1122
|
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::HEAT;
|
1112
|
-
this->control_messages_queue_.
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
buffer, 2));
|
1123
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1124
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1125
|
+
(uint8_t) hon_protocol::DataParameters::AC_MODE,
|
1126
|
+
buffer, 2);
|
1117
1127
|
fan_mode_buf[1] = this->other_modes_fan_speed_;
|
1118
1128
|
break;
|
1119
1129
|
case CLIMATE_MODE_DRY:
|
1120
1130
|
new_power = true;
|
1121
1131
|
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::DRY;
|
1122
|
-
this->control_messages_queue_.
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
buffer, 2));
|
1132
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1133
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1134
|
+
(uint8_t) hon_protocol::DataParameters::AC_MODE,
|
1135
|
+
buffer, 2);
|
1127
1136
|
fan_mode_buf[1] = this->other_modes_fan_speed_;
|
1128
1137
|
break;
|
1129
1138
|
case CLIMATE_MODE_FAN_ONLY:
|
1130
1139
|
new_power = true;
|
1131
1140
|
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::FAN;
|
1132
|
-
this->control_messages_queue_.
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
buffer, 2));
|
1141
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1142
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1143
|
+
(uint8_t) hon_protocol::DataParameters::AC_MODE,
|
1144
|
+
buffer, 2);
|
1137
1145
|
fan_mode_buf[1] = this->other_modes_fan_speed_; // Auto doesn't work in fan only mode
|
1138
1146
|
break;
|
1139
1147
|
case CLIMATE_MODE_COOL:
|
1140
1148
|
new_power = true;
|
1141
1149
|
buffer[1] = (uint8_t) hon_protocol::ConditioningMode::COOL;
|
1142
|
-
this->control_messages_queue_.
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
buffer, 2));
|
1150
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1151
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1152
|
+
(uint8_t) hon_protocol::DataParameters::AC_MODE,
|
1153
|
+
buffer, 2);
|
1147
1154
|
fan_mode_buf[1] = this->other_modes_fan_speed_;
|
1148
1155
|
break;
|
1149
1156
|
default:
|
@@ -1153,11 +1160,10 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1153
1160
|
}
|
1154
1161
|
// Climate power
|
1155
1162
|
{
|
1156
|
-
this->control_messages_queue_.
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
new_power ? ONE_BUF : ZERO_BUF, 2));
|
1163
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1164
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1165
|
+
(uint8_t) hon_protocol::DataParameters::AC_POWER,
|
1166
|
+
new_power ? ONE_BUF : ZERO_BUF, 2);
|
1161
1167
|
}
|
1162
1168
|
// CLimate preset
|
1163
1169
|
{
|
@@ -1199,36 +1205,32 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1199
1205
|
}
|
1200
1206
|
auto presets = this->traits_.get_supported_presets();
|
1201
1207
|
if (quiet_mode_buf[1] != 0xFF) {
|
1202
|
-
this->control_messages_queue_.
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
quiet_mode_buf, 2));
|
1208
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1209
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1210
|
+
(uint8_t) hon_protocol::DataParameters::QUIET_MODE,
|
1211
|
+
quiet_mode_buf, 2);
|
1207
1212
|
}
|
1208
1213
|
if ((fast_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_BOOST) != presets.end()))) {
|
1209
|
-
this->control_messages_queue_.
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
fast_mode_buf, 2));
|
1214
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1215
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1216
|
+
(uint8_t) hon_protocol::DataParameters::FAST_MODE,
|
1217
|
+
fast_mode_buf, 2);
|
1214
1218
|
}
|
1215
1219
|
if ((away_mode_buf[1] != 0xFF) && ((presets.find(climate::ClimatePreset::CLIMATE_PRESET_AWAY) != presets.end()))) {
|
1216
|
-
this->control_messages_queue_.
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
away_mode_buf, 2));
|
1220
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1221
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1222
|
+
(uint8_t) hon_protocol::DataParameters::TEN_DEGREE,
|
1223
|
+
away_mode_buf, 2);
|
1221
1224
|
}
|
1222
1225
|
}
|
1223
1226
|
// Target temperature
|
1224
1227
|
if (climate_control.target_temperature.has_value() && (this->mode != ClimateMode::CLIMATE_MODE_FAN_ONLY)) {
|
1225
1228
|
uint8_t buffer[2] = {0x00, 0x00};
|
1226
1229
|
buffer[1] = ((uint8_t) climate_control.target_temperature.value()) - 16;
|
1227
|
-
this->control_messages_queue_.
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
buffer, 2));
|
1230
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1231
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1232
|
+
(uint8_t) hon_protocol::DataParameters::SET_POINT,
|
1233
|
+
buffer, 2);
|
1232
1234
|
}
|
1233
1235
|
// Vertical swing mode
|
1234
1236
|
if (climate_control.swing_mode.has_value()) {
|
@@ -1248,16 +1250,14 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1248
1250
|
case CLIMATE_SWING_BOTH:
|
1249
1251
|
break;
|
1250
1252
|
}
|
1251
|
-
this->control_messages_queue_.
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
(uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE,
|
1260
|
-
vertical_swing_buf, 2));
|
1253
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1254
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1255
|
+
(uint8_t) hon_protocol::DataParameters::HORIZONTAL_SWING_MODE,
|
1256
|
+
horizontal_swing_buf, 2);
|
1257
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1258
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1259
|
+
(uint8_t) hon_protocol::DataParameters::VERTICAL_SWING_MODE,
|
1260
|
+
vertical_swing_buf, 2);
|
1261
1261
|
}
|
1262
1262
|
// Fan mode
|
1263
1263
|
if (climate_control.fan_mode.has_value()) {
|
@@ -1280,11 +1280,10 @@ void HonClimate::fill_control_messages_queue_() {
|
|
1280
1280
|
break;
|
1281
1281
|
}
|
1282
1282
|
if (fan_mode_buf[1] != 0xFF) {
|
1283
|
-
this->control_messages_queue_.
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
fan_mode_buf, 2));
|
1283
|
+
this->control_messages_queue_.emplace(haier_protocol::FrameType::CONTROL,
|
1284
|
+
(uint16_t) hon_protocol::SubcommandsControl::SET_SINGLE_PARAMETER +
|
1285
|
+
(uint8_t) hon_protocol::DataParameters::FAN_MODE,
|
1286
|
+
fan_mode_buf, 2);
|
1288
1287
|
}
|
1289
1288
|
}
|
1290
1289
|
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
from esphome import pins
|
2
|
+
import esphome.codegen as cg
|
3
|
+
from esphome.components import switch
|
4
|
+
import esphome.config_validation as cv
|
5
|
+
from esphome.const import CONF_OPTIMISTIC, CONF_PULSE_LENGTH, CONF_WAIT_TIME
|
6
|
+
|
7
|
+
from .. import hbridge_ns
|
8
|
+
|
9
|
+
HBridgeSwitch = hbridge_ns.class_("HBridgeSwitch", switch.Switch, cg.Component)
|
10
|
+
|
11
|
+
CODEOWNERS = ["@dwmw2"]
|
12
|
+
|
13
|
+
CONF_OFF_PIN = "off_pin"
|
14
|
+
CONF_ON_PIN = "on_pin"
|
15
|
+
|
16
|
+
CONFIG_SCHEMA = (
|
17
|
+
switch.switch_schema(HBridgeSwitch)
|
18
|
+
.extend(
|
19
|
+
{
|
20
|
+
cv.Required(CONF_ON_PIN): pins.gpio_output_pin_schema,
|
21
|
+
cv.Required(CONF_OFF_PIN): pins.gpio_output_pin_schema,
|
22
|
+
cv.Optional(
|
23
|
+
CONF_PULSE_LENGTH, default="100ms"
|
24
|
+
): cv.positive_time_period_milliseconds,
|
25
|
+
cv.Optional(CONF_WAIT_TIME): cv.positive_time_period_milliseconds,
|
26
|
+
cv.Optional(CONF_OPTIMISTIC, default=False): cv.boolean,
|
27
|
+
}
|
28
|
+
)
|
29
|
+
.extend(cv.COMPONENT_SCHEMA)
|
30
|
+
)
|
31
|
+
|
32
|
+
|
33
|
+
async def to_code(config):
|
34
|
+
var = await switch.new_switch(config)
|
35
|
+
await cg.register_component(var, config)
|
36
|
+
|
37
|
+
on_pin = await cg.gpio_pin_expression(config[CONF_ON_PIN])
|
38
|
+
cg.add(var.set_on_pin(on_pin))
|
39
|
+
off_pin = await cg.gpio_pin_expression(config[CONF_OFF_PIN])
|
40
|
+
cg.add(var.set_off_pin(off_pin))
|
41
|
+
cg.add(var.set_pulse_length(config[CONF_PULSE_LENGTH]))
|
42
|
+
cg.add(var.set_optimistic(config[CONF_OPTIMISTIC]))
|
43
|
+
if wait_time := config.get(CONF_WAIT_TIME):
|
44
|
+
cg.add(var.set_wait_time(wait_time))
|
@@ -0,0 +1,95 @@
|
|
1
|
+
#include "hbridge_switch.h"
|
2
|
+
#include "esphome/core/log.h"
|
3
|
+
|
4
|
+
#include <cinttypes>
|
5
|
+
|
6
|
+
namespace esphome {
|
7
|
+
namespace hbridge {
|
8
|
+
|
9
|
+
static const char *const TAG = "switch.hbridge";
|
10
|
+
|
11
|
+
float HBridgeSwitch::get_setup_priority() const { return setup_priority::HARDWARE; }
|
12
|
+
void HBridgeSwitch::setup() {
|
13
|
+
ESP_LOGCONFIG(TAG, "Setting up H-Bridge Switch '%s'...", this->name_.c_str());
|
14
|
+
|
15
|
+
optional<bool> initial_state = this->get_initial_state_with_restore_mode().value_or(false);
|
16
|
+
|
17
|
+
// Like GPIOSwitch does, set the pin state both before and after pin setup()
|
18
|
+
this->on_pin_->digital_write(false);
|
19
|
+
this->on_pin_->setup();
|
20
|
+
this->on_pin_->digital_write(false);
|
21
|
+
|
22
|
+
this->off_pin_->digital_write(false);
|
23
|
+
this->off_pin_->setup();
|
24
|
+
this->off_pin_->digital_write(false);
|
25
|
+
|
26
|
+
if (initial_state.has_value())
|
27
|
+
this->write_state(initial_state);
|
28
|
+
}
|
29
|
+
|
30
|
+
void HBridgeSwitch::dump_config() {
|
31
|
+
LOG_SWITCH("", "H-Bridge Switch", this);
|
32
|
+
LOG_PIN(" On Pin: ", this->on_pin_);
|
33
|
+
LOG_PIN(" Off Pin: ", this->off_pin_);
|
34
|
+
ESP_LOGCONFIG(TAG, " Pulse length: %" PRId32 " ms", this->pulse_length_);
|
35
|
+
if (this->wait_time_)
|
36
|
+
ESP_LOGCONFIG(TAG, " Wait time %" PRId32 " ms", this->wait_time_);
|
37
|
+
}
|
38
|
+
|
39
|
+
void HBridgeSwitch::write_state(bool state) {
|
40
|
+
this->desired_state_ = state;
|
41
|
+
if (!this->timer_running_)
|
42
|
+
this->timer_fn_();
|
43
|
+
}
|
44
|
+
|
45
|
+
void HBridgeSwitch::timer_fn_() {
|
46
|
+
uint32_t next_timeout = 0;
|
47
|
+
|
48
|
+
while ((uint8_t) this->desired_state_ != this->relay_state_) {
|
49
|
+
switch (this->relay_state_) {
|
50
|
+
case RELAY_STATE_ON:
|
51
|
+
case RELAY_STATE_OFF:
|
52
|
+
case RELAY_STATE_UNKNOWN:
|
53
|
+
if (this->desired_state_) {
|
54
|
+
this->on_pin_->digital_write(true);
|
55
|
+
this->relay_state_ = RELAY_STATE_SWITCHING_ON;
|
56
|
+
} else {
|
57
|
+
this->off_pin_->digital_write(true);
|
58
|
+
this->relay_state_ = RELAY_STATE_SWITCHING_OFF;
|
59
|
+
}
|
60
|
+
next_timeout = this->pulse_length_;
|
61
|
+
if (!this->optimistic_)
|
62
|
+
this->publish_state(this->desired_state_);
|
63
|
+
break;
|
64
|
+
|
65
|
+
case RELAY_STATE_SWITCHING_ON:
|
66
|
+
this->on_pin_->digital_write(false);
|
67
|
+
this->relay_state_ = RELAY_STATE_ON;
|
68
|
+
if (this->optimistic_)
|
69
|
+
this->publish_state(true);
|
70
|
+
next_timeout = this->wait_time_;
|
71
|
+
break;
|
72
|
+
|
73
|
+
case RELAY_STATE_SWITCHING_OFF:
|
74
|
+
this->off_pin_->digital_write(false);
|
75
|
+
this->relay_state_ = RELAY_STATE_OFF;
|
76
|
+
if (this->optimistic_)
|
77
|
+
this->publish_state(false);
|
78
|
+
next_timeout = this->wait_time_;
|
79
|
+
break;
|
80
|
+
}
|
81
|
+
|
82
|
+
if (next_timeout) {
|
83
|
+
this->timer_running_ = true;
|
84
|
+
this->set_timeout(next_timeout, [this]() { this->timer_fn_(); });
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
|
88
|
+
// In the case where ON/OFF state has been reached but we need to
|
89
|
+
// immediately change back again to reach desired_state_, we loop.
|
90
|
+
}
|
91
|
+
this->timer_running_ = false;
|
92
|
+
}
|
93
|
+
|
94
|
+
} // namespace hbridge
|
95
|
+
} // namespace esphome
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/core/component.h"
|
4
|
+
#include "esphome/core/hal.h"
|
5
|
+
#include "esphome/components/switch/switch.h"
|
6
|
+
|
7
|
+
#include <vector>
|
8
|
+
|
9
|
+
namespace esphome {
|
10
|
+
namespace hbridge {
|
11
|
+
|
12
|
+
enum RelayState : uint8_t {
|
13
|
+
RELAY_STATE_OFF = 0,
|
14
|
+
RELAY_STATE_ON = 1,
|
15
|
+
RELAY_STATE_SWITCHING_ON = 2,
|
16
|
+
RELAY_STATE_SWITCHING_OFF = 3,
|
17
|
+
RELAY_STATE_UNKNOWN = 4,
|
18
|
+
};
|
19
|
+
|
20
|
+
class HBridgeSwitch : public switch_::Switch, public Component {
|
21
|
+
public:
|
22
|
+
void set_on_pin(GPIOPin *pin) { this->on_pin_ = pin; }
|
23
|
+
void set_off_pin(GPIOPin *pin) { this->off_pin_ = pin; }
|
24
|
+
void set_pulse_length(uint32_t pulse_length) { this->pulse_length_ = pulse_length; }
|
25
|
+
void set_wait_time(uint32_t wait_time) { this->wait_time_ = wait_time; }
|
26
|
+
void set_optimistic(bool optimistic) { this->optimistic_ = optimistic; }
|
27
|
+
|
28
|
+
// ========== INTERNAL METHODS ==========
|
29
|
+
// (In most use cases you won't need these)
|
30
|
+
float get_setup_priority() const override;
|
31
|
+
|
32
|
+
void setup() override;
|
33
|
+
void dump_config() override;
|
34
|
+
|
35
|
+
protected:
|
36
|
+
void write_state(bool state) override;
|
37
|
+
void timer_fn_();
|
38
|
+
|
39
|
+
bool timer_running_{false};
|
40
|
+
bool desired_state_{false};
|
41
|
+
RelayState relay_state_{RELAY_STATE_UNKNOWN};
|
42
|
+
GPIOPin *on_pin_{nullptr};
|
43
|
+
GPIOPin *off_pin_{nullptr};
|
44
|
+
uint32_t pulse_length_{0};
|
45
|
+
uint32_t wait_time_{0};
|
46
|
+
bool optimistic_{false};
|
47
|
+
};
|
48
|
+
|
49
|
+
} // namespace hbridge
|
50
|
+
} // namespace esphome
|
@@ -133,8 +133,10 @@ bool HitachiClimate::get_swing_v_() {
|
|
133
133
|
}
|
134
134
|
|
135
135
|
void HitachiClimate::set_swing_h_(uint8_t position) {
|
136
|
-
if (position > HITACHI_AC344_SWINGH_LEFT_MAX)
|
137
|
-
|
136
|
+
if (position > HITACHI_AC344_SWINGH_LEFT_MAX) {
|
137
|
+
set_swing_h_(HITACHI_AC344_SWINGH_MIDDLE);
|
138
|
+
return;
|
139
|
+
}
|
138
140
|
set_bits(&remote_state_[HITACHI_AC344_SWINGH_BYTE], HITACHI_AC344_SWINGH_OFFSET, HITACHI_AC344_SWINGH_SIZE, position);
|
139
141
|
set_button_(HITACHI_AC344_BUTTON_SWINGH);
|
140
142
|
}
|
@@ -133,8 +133,10 @@ bool HitachiClimate::get_swing_v_() {
|
|
133
133
|
}
|
134
134
|
|
135
135
|
void HitachiClimate::set_swing_h_(uint8_t position) {
|
136
|
-
if (position > HITACHI_AC424_SWINGH_LEFT_MAX)
|
137
|
-
|
136
|
+
if (position > HITACHI_AC424_SWINGH_LEFT_MAX) {
|
137
|
+
set_swing_h_(HITACHI_AC424_SWINGH_MIDDLE);
|
138
|
+
return;
|
139
|
+
}
|
138
140
|
set_bits(&remote_state_[HITACHI_AC424_SWINGH_BYTE], HITACHI_AC424_SWINGH_OFFSET, HITACHI_AC424_SWINGH_SIZE, position);
|
139
141
|
set_button_(HITACHI_AC424_BUTTON_SWINGH);
|
140
142
|
}
|
@@ -27,6 +27,7 @@ void HomeassistantNumber::min_retrieved_(const std::string &min) {
|
|
27
27
|
auto min_value = parse_number<float>(min);
|
28
28
|
if (!min_value.has_value()) {
|
29
29
|
ESP_LOGE(TAG, "'%s': Can't convert 'min' value '%s' to number!", this->entity_id_.c_str(), min.c_str());
|
30
|
+
return;
|
30
31
|
}
|
31
32
|
ESP_LOGD(TAG, "'%s': Min retrieved: %s", get_name().c_str(), min.c_str());
|
32
33
|
this->traits.set_min_value(min_value.value());
|
@@ -36,6 +37,7 @@ void HomeassistantNumber::max_retrieved_(const std::string &max) {
|
|
36
37
|
auto max_value = parse_number<float>(max);
|
37
38
|
if (!max_value.has_value()) {
|
38
39
|
ESP_LOGE(TAG, "'%s': Can't convert 'max' value '%s' to number!", this->entity_id_.c_str(), max.c_str());
|
40
|
+
return;
|
39
41
|
}
|
40
42
|
ESP_LOGD(TAG, "'%s': Max retrieved: %s", get_name().c_str(), max.c_str());
|
41
43
|
this->traits.set_max_value(max_value.value());
|
@@ -45,6 +47,7 @@ void HomeassistantNumber::step_retrieved_(const std::string &step) {
|
|
45
47
|
auto step_value = parse_number<float>(step);
|
46
48
|
if (!step_value.has_value()) {
|
47
49
|
ESP_LOGE(TAG, "'%s': Can't convert 'step' value '%s' to number!", this->entity_id_.c_str(), step.c_str());
|
50
|
+
return;
|
48
51
|
}
|
49
52
|
ESP_LOGD(TAG, "'%s': Step Retrieved %s", get_name().c_str(), step.c_str());
|
50
53
|
this->traits.set_step(step_value.value());
|
@@ -53,7 +53,7 @@ bool HX711Sensor::read_sensor_(uint32_t *result) {
|
|
53
53
|
}
|
54
54
|
|
55
55
|
// Cycle clock pin for gain setting
|
56
|
-
for (uint8_t i = 0; i < this->gain_; i++) {
|
56
|
+
for (uint8_t i = 0; i < static_cast<uint8_t>(this->gain_); i++) {
|
57
57
|
this->sck_pin_->digital_write(true);
|
58
58
|
delayMicroseconds(1);
|
59
59
|
this->sck_pin_->digital_write(false);
|
esphome/components/hx711/hx711.h
CHANGED
@@ -17,14 +17,14 @@ void IDFI2CBus::setup() {
|
|
17
17
|
ESP_LOGCONFIG(TAG, "Setting up I2C bus...");
|
18
18
|
static i2c_port_t next_port = I2C_NUM_0;
|
19
19
|
port_ = next_port;
|
20
|
-
#if
|
20
|
+
#if SOC_I2C_NUM > 1
|
21
21
|
next_port = (next_port == I2C_NUM_0) ? I2C_NUM_1 : I2C_NUM_MAX;
|
22
22
|
#else
|
23
23
|
next_port = I2C_NUM_MAX;
|
24
24
|
#endif
|
25
25
|
|
26
26
|
if (port_ == I2C_NUM_MAX) {
|
27
|
-
ESP_LOGE(TAG, "Too many I2C buses configured");
|
27
|
+
ESP_LOGE(TAG, "Too many I2C buses configured. Max %u supported.", SOC_I2C_NUM);
|
28
28
|
this->mark_failed();
|
29
29
|
return;
|
30
30
|
}
|