mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	Merge branch 'guard_custom_services' into integration
This commit is contained in:
		| @@ -21,7 +21,8 @@ void CustomAPIDeviceComponent::setup() { | |||||||
|  |  | ||||||
| void CustomAPIDeviceComponent::on_test_service() { ESP_LOGI(TAG, "Custom test service called!"); } | void CustomAPIDeviceComponent::on_test_service() { ESP_LOGI(TAG, "Custom test service called!"); } | ||||||
|  |  | ||||||
| void CustomAPIDeviceComponent::on_service_with_args(const std::string &arg_string, int32_t arg_int, bool arg_bool, | // NOLINTNEXTLINE(performance-unnecessary-value-param) | ||||||
|  | void CustomAPIDeviceComponent::on_service_with_args(std::string arg_string, int32_t arg_int, bool arg_bool, | ||||||
|                                                     float arg_float) { |                                                     float arg_float) { | ||||||
|   ESP_LOGI(TAG, "Custom service called with: %s, %d, %d, %.2f", arg_string.c_str(), arg_int, arg_bool, arg_float); |   ESP_LOGI(TAG, "Custom service called with: %s, %d, %d, %.2f", arg_string.c_str(), arg_int, arg_bool, arg_float); | ||||||
| } | } | ||||||
| @@ -34,7 +35,7 @@ void CustomAPIDeviceComponent::on_service_with_arrays(std::vector<bool> bool_arr | |||||||
|  |  | ||||||
|   // Log first element of each array if not empty |   // Log first element of each array if not empty | ||||||
|   if (!bool_array.empty()) { |   if (!bool_array.empty()) { | ||||||
|     ESP_LOGI(TAG, "First bool: %d", bool_array[0]); |     ESP_LOGI(TAG, "First bool: %s", bool_array[0] ? "true" : "false"); | ||||||
|   } |   } | ||||||
|   if (!int_array.empty()) { |   if (!int_array.empty()) { | ||||||
|     ESP_LOGI(TAG, "First int: %d", int_array[0]); |     ESP_LOGI(TAG, "First int: %d", int_array[0]); | ||||||
|   | |||||||
| @@ -17,7 +17,8 @@ class CustomAPIDeviceComponent : public Component, public CustomAPIDevice { | |||||||
|  |  | ||||||
|   void on_test_service(); |   void on_test_service(); | ||||||
|  |  | ||||||
|   void on_service_with_args(const std::string &arg_string, int32_t arg_int, bool arg_bool, float arg_float); |   // NOLINTNEXTLINE(performance-unnecessary-value-param) | ||||||
|  |   void on_service_with_args(std::string arg_string, int32_t arg_int, bool arg_bool, float arg_float); | ||||||
|  |  | ||||||
|   void on_service_with_arrays(std::vector<bool> bool_array, std::vector<int32_t> int_array, |   void on_service_with_arrays(std::vector<bool> bool_array, std::vector<int32_t> int_array, | ||||||
|                               std::vector<float> float_array, std::vector<std::string> string_array); |                               std::vector<float> float_array, std::vector<std::string> string_array); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user