mirror of
https://github.com/esphome/esphome.git
synced 2026-02-05 10:20:11 +08:00
[api] Align water_heater_command with standard entity command pattern (#13655)
This commit is contained in:
@@ -45,6 +45,7 @@ service APIConnection {
|
|||||||
rpc time_command (TimeCommandRequest) returns (void) {}
|
rpc time_command (TimeCommandRequest) returns (void) {}
|
||||||
rpc update_command (UpdateCommandRequest) returns (void) {}
|
rpc update_command (UpdateCommandRequest) returns (void) {}
|
||||||
rpc valve_command (ValveCommandRequest) returns (void) {}
|
rpc valve_command (ValveCommandRequest) returns (void) {}
|
||||||
|
rpc water_heater_command (WaterHeaterCommandRequest) returns (void) {}
|
||||||
|
|
||||||
rpc subscribe_bluetooth_le_advertisements(SubscribeBluetoothLEAdvertisementsRequest) returns (void) {}
|
rpc subscribe_bluetooth_le_advertisements(SubscribeBluetoothLEAdvertisementsRequest) returns (void) {}
|
||||||
rpc bluetooth_device_request(BluetoothDeviceRequest) returns (void) {}
|
rpc bluetooth_device_request(BluetoothDeviceRequest) returns (void) {}
|
||||||
|
|||||||
@@ -1385,7 +1385,7 @@ uint16_t APIConnection::try_send_water_heater_info(EntityBase *entity, APIConnec
|
|||||||
is_single);
|
is_single);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APIConnection::on_water_heater_command_request(const WaterHeaterCommandRequest &msg) {
|
void APIConnection::water_heater_command(const WaterHeaterCommandRequest &msg) {
|
||||||
ENTITY_COMMAND_MAKE_CALL(water_heater::WaterHeater, water_heater, water_heater)
|
ENTITY_COMMAND_MAKE_CALL(water_heater::WaterHeater, water_heater, water_heater)
|
||||||
if (msg.has_fields & enums::WATER_HEATER_COMMAND_HAS_MODE)
|
if (msg.has_fields & enums::WATER_HEATER_COMMAND_HAS_MODE)
|
||||||
call.set_mode(static_cast<water_heater::WaterHeaterMode>(msg.mode));
|
call.set_mode(static_cast<water_heater::WaterHeaterMode>(msg.mode));
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class APIConnection final : public APIServerConnection {
|
|||||||
|
|
||||||
#ifdef USE_WATER_HEATER
|
#ifdef USE_WATER_HEATER
|
||||||
bool send_water_heater_state(water_heater::WaterHeater *water_heater);
|
bool send_water_heater_state(water_heater::WaterHeater *water_heater);
|
||||||
void on_water_heater_command_request(const WaterHeaterCommandRequest &msg) override;
|
void water_heater_command(const WaterHeaterCommandRequest &msg) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_IR_RF
|
#ifdef USE_IR_RF
|
||||||
|
|||||||
@@ -746,6 +746,11 @@ void APIServerConnection::on_update_command_request(const UpdateCommandRequest &
|
|||||||
#ifdef USE_VALVE
|
#ifdef USE_VALVE
|
||||||
void APIServerConnection::on_valve_command_request(const ValveCommandRequest &msg) { this->valve_command(msg); }
|
void APIServerConnection::on_valve_command_request(const ValveCommandRequest &msg) { this->valve_command(msg); }
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_WATER_HEATER
|
||||||
|
void APIServerConnection::on_water_heater_command_request(const WaterHeaterCommandRequest &msg) {
|
||||||
|
this->water_heater_command(msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
void APIServerConnection::on_subscribe_bluetooth_le_advertisements_request(
|
void APIServerConnection::on_subscribe_bluetooth_le_advertisements_request(
|
||||||
const SubscribeBluetoothLEAdvertisementsRequest &msg) {
|
const SubscribeBluetoothLEAdvertisementsRequest &msg) {
|
||||||
|
|||||||
@@ -303,6 +303,9 @@ class APIServerConnection : public APIServerConnectionBase {
|
|||||||
#ifdef USE_VALVE
|
#ifdef USE_VALVE
|
||||||
virtual void valve_command(const ValveCommandRequest &msg) = 0;
|
virtual void valve_command(const ValveCommandRequest &msg) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_WATER_HEATER
|
||||||
|
virtual void water_heater_command(const WaterHeaterCommandRequest &msg) = 0;
|
||||||
|
#endif
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
virtual void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) = 0;
|
virtual void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -432,6 +435,9 @@ class APIServerConnection : public APIServerConnectionBase {
|
|||||||
#ifdef USE_VALVE
|
#ifdef USE_VALVE
|
||||||
void on_valve_command_request(const ValveCommandRequest &msg) override;
|
void on_valve_command_request(const ValveCommandRequest &msg) override;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef USE_WATER_HEATER
|
||||||
|
void on_water_heater_command_request(const WaterHeaterCommandRequest &msg) override;
|
||||||
|
#endif
|
||||||
#ifdef USE_BLUETOOTH_PROXY
|
#ifdef USE_BLUETOOTH_PROXY
|
||||||
void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &msg) override;
|
void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &msg) override;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user