From 8a705bf4b042eb8aa8a29358e45a563e0492e5c5 Mon Sep 17 00:00:00 2001 From: Eduardo Roldan Date: Mon, 13 Mar 2023 19:46:46 -0300 Subject: [PATCH 1/4] pipsolar component. Correct the sscanf format for QPIG command parsing to set pv_input_voltage as float (not int) (#4165) --- esphome/components/pipsolar/pipsolar.cpp | 2 +- esphome/components/pipsolar/pipsolar.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/pipsolar/pipsolar.cpp b/esphome/components/pipsolar/pipsolar.cpp index fab4705be7..5f203645fe 100644 --- a/esphome/components/pipsolar/pipsolar.cpp +++ b/esphome/components/pipsolar/pipsolar.cpp @@ -448,7 +448,7 @@ void Pipsolar::loop() { ESP_LOGD(TAG, "Decode QPIGS"); sscanf( // NOLINT tmp, // NOLINT - "(%f %f %f %f %d %d %d %d %f %d %d %d %d %f %f %d %1d%1d%1d%1d%1d%1d%1d%1d %d %d %d %1d%1d%1d", // NOLINT + "(%f %f %f %f %d %d %d %d %f %d %d %d %f %f %f %d %1d%1d%1d%1d%1d%1d%1d%1d %d %d %d %1d%1d%1d", // NOLINT &value_grid_voltage_, &value_grid_frequency_, &value_ac_output_voltage_, // NOLINT &value_ac_output_frequency_, // NOLINT &value_ac_output_apparent_power_, &value_ac_output_active_power_, &value_output_load_percent_, // NOLINT diff --git a/esphome/components/pipsolar/pipsolar.h b/esphome/components/pipsolar/pipsolar.h index 4f6edb4810..65fd3c670d 100644 --- a/esphome/components/pipsolar/pipsolar.h +++ b/esphome/components/pipsolar/pipsolar.h @@ -65,7 +65,7 @@ class Pipsolar : public uart::UARTDevice, public PollingComponent { PIPSOLAR_SENSOR(battery_charging_current, QPIGS, int) PIPSOLAR_SENSOR(battery_capacity_percent, QPIGS, int) PIPSOLAR_SENSOR(inverter_heat_sink_temperature, QPIGS, int) - PIPSOLAR_SENSOR(pv_input_current_for_battery, QPIGS, int) + PIPSOLAR_SENSOR(pv_input_current_for_battery, QPIGS, float) PIPSOLAR_SENSOR(pv_input_voltage, QPIGS, float) PIPSOLAR_SENSOR(battery_voltage_scc, QPIGS, float) PIPSOLAR_SENSOR(battery_discharge_current, QPIGS, int) From 0c7a3d1fffef6c9292b965bb0b9f8dc6790522e5 Mon Sep 17 00:00:00 2001 From: DAVe3283 Date: Mon, 13 Mar 2023 18:52:19 -0600 Subject: [PATCH 2/4] Revert "Remove state class from uptime sensor (#4345)" (#4557) This reverts commit 36c2e770bfd5b43a5471590be0d10033049eb3ea. Addresses esphome/issues#4193. --- esphome/components/uptime/sensor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/uptime/sensor.py b/esphome/components/uptime/sensor.py index 50e584f5d5..07d7d8f2cf 100644 --- a/esphome/components/uptime/sensor.py +++ b/esphome/components/uptime/sensor.py @@ -3,6 +3,7 @@ import esphome.config_validation as cv from esphome.components import sensor from esphome.const import ( ENTITY_CATEGORY_DIAGNOSTIC, + STATE_CLASS_TOTAL_INCREASING, UNIT_SECOND, ICON_TIMER, DEVICE_CLASS_DURATION, @@ -16,6 +17,7 @@ CONFIG_SCHEMA = sensor.sensor_schema( unit_of_measurement=UNIT_SECOND, icon=ICON_TIMER, accuracy_decimals=0, + state_class=STATE_CLASS_TOTAL_INCREASING, device_class=DEVICE_CLASS_DURATION, entity_category=ENTITY_CATEGORY_DIAGNOSTIC, ).extend(cv.polling_component_schema("60s")) From 5e11469f50744ad3d01648cc449882f5cb425187 Mon Sep 17 00:00:00 2001 From: Stroe Andrei Catalin Date: Tue, 14 Mar 2023 02:54:35 +0200 Subject: [PATCH 3/4] Added response for Tuya RSSI command (#4549) * Added wifi rssi util Added tuya mcu response to wifi rssi command * Cleanup * PR Comments * PR Comments --- esphome/components/tuya/tuya.cpp | 17 +++++++++++++++++ esphome/components/tuya/tuya.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/esphome/components/tuya/tuya.cpp b/esphome/components/tuya/tuya.cpp index fad4bb0bac..79a9049b04 100644 --- a/esphome/components/tuya/tuya.cpp +++ b/esphome/components/tuya/tuya.cpp @@ -5,6 +5,10 @@ #include "esphome/core/util.h" #include "esphome/core/gpio.h" +#ifdef USE_WIFI +#include "esphome/components/wifi/wifi_component.h" +#endif + #ifdef USE_CAPTIVE_PORTAL #include "esphome/components/captive_portal/captive_portal.h" #endif @@ -234,6 +238,10 @@ void Tuya::handle_command_(uint8_t command, uint8_t version, const uint8_t *buff case TuyaCommandType::WIFI_TEST: this->send_command_(TuyaCommand{.cmd = TuyaCommandType::WIFI_TEST, .payload = std::vector{0x00, 0x00}}); break; + case TuyaCommandType::WIFI_RSSI: + this->send_command_( + TuyaCommand{.cmd = TuyaCommandType::WIFI_RSSI, .payload = std::vector{get_wifi_rssi_()}}); + break; case TuyaCommandType::LOCAL_TIME_QUERY: #ifdef USE_TIME if (this->time_id_.has_value()) { @@ -475,6 +483,15 @@ uint8_t Tuya::get_wifi_status_code_() { return status; } +uint8_t Tuya::get_wifi_rssi_() { +#ifdef USE_WIFI + if (wifi::global_wifi_component != nullptr) + return wifi::global_wifi_component->wifi_rssi(); +#endif + + return 0; +} + void Tuya::send_wifi_status_() { uint8_t status = this->get_wifi_status_code_(); diff --git a/esphome/components/tuya/tuya.h b/esphome/components/tuya/tuya.h index b9c917f672..8d6153482f 100644 --- a/esphome/components/tuya/tuya.h +++ b/esphome/components/tuya/tuya.h @@ -55,6 +55,7 @@ enum class TuyaCommandType : uint8_t { DATAPOINT_QUERY = 0x08, WIFI_TEST = 0x0E, LOCAL_TIME_QUERY = 0x1C, + WIFI_RSSI = 0x24, VACUUM_MAP_UPLOAD = 0x28, GET_NETWORK_STATUS = 0x2B, }; @@ -123,6 +124,7 @@ class Tuya : public Component, public uart::UARTDevice { void set_status_pin_(); void send_wifi_status_(); uint8_t get_wifi_status_code_(); + uint8_t get_wifi_rssi_(); #ifdef USE_TIME void send_local_time_(); From 9a7af97b2df059159a3eaa632206dbec031e74ef Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Tue, 14 Mar 2023 14:11:55 +1300 Subject: [PATCH 4/4] Bump version to 2023.3.0b4 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 3fa46f788e..08182728a2 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2023.3.0b3" +__version__ = "2023.3.0b4" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"