mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Revert unneeded GetTime bidirectional support added in #9790
This commit is contained in:
		| @@ -27,9 +27,6 @@ service APIConnection { | ||||
|   rpc subscribe_logs (SubscribeLogsRequest) returns (void) {} | ||||
|   rpc subscribe_homeassistant_services (SubscribeHomeassistantServicesRequest) returns (void) {} | ||||
|   rpc subscribe_home_assistant_states (SubscribeHomeAssistantStatesRequest) returns (void) {} | ||||
|   rpc get_time (GetTimeRequest) returns (GetTimeResponse) { | ||||
|     option (needs_authentication) = false; | ||||
|   } | ||||
|   rpc execute_service (ExecuteServiceRequest) returns (void) {} | ||||
|   rpc noise_encryption_set_key (NoiseEncryptionSetKeyRequest) returns (NoiseEncryptionSetKeyResponse) {} | ||||
|  | ||||
| @@ -809,12 +806,12 @@ message HomeAssistantStateResponse { | ||||
| // ==================== IMPORT TIME ==================== | ||||
| message GetTimeRequest { | ||||
|   option (id) = 36; | ||||
|   option (source) = SOURCE_BOTH; | ||||
|   option (source) = SOURCE_SERVER; | ||||
| } | ||||
|  | ||||
| message GetTimeResponse { | ||||
|   option (id) = 37; | ||||
|   option (source) = SOURCE_BOTH; | ||||
|   option (source) = SOURCE_CLIENT; | ||||
|   option (no_delay) = true; | ||||
|  | ||||
|   fixed32 epoch_seconds = 1; | ||||
|   | ||||
| @@ -1081,12 +1081,6 @@ void APIConnection::on_get_time_response(const GetTimeResponse &value) { | ||||
| } | ||||
| #endif | ||||
|  | ||||
| bool APIConnection::send_get_time_response(const GetTimeRequest &msg) { | ||||
|   GetTimeResponse resp; | ||||
|   resp.epoch_seconds = ::time(nullptr); | ||||
|   return this->send_message(resp, GetTimeResponse::MESSAGE_TYPE); | ||||
| } | ||||
|  | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
| void APIConnection::subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) { | ||||
|   bluetooth_proxy::global_bluetooth_proxy->subscribe_api_connection(this, msg.flags); | ||||
|   | ||||
| @@ -219,7 +219,6 @@ class APIConnection final : public APIServerConnection { | ||||
| #ifdef USE_API_HOMEASSISTANT_STATES | ||||
|   void subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) override; | ||||
| #endif | ||||
|   bool send_get_time_response(const GetTimeRequest &msg) override; | ||||
| #ifdef USE_API_SERVICES | ||||
|   void execute_service(const ExecuteServiceRequest &msg) override; | ||||
| #endif | ||||
|   | ||||
| @@ -921,14 +921,6 @@ bool GetTimeResponse::decode_32bit(uint32_t field_id, Proto32Bit value) { | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| void GetTimeResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->epoch_seconds); | ||||
|   buffer.encode_string(2, this->timezone_ref_); | ||||
| } | ||||
| void GetTimeResponse::calculate_size(ProtoSize &size) const { | ||||
|   size.add_fixed32(1, this->epoch_seconds); | ||||
|   size.add_length(1, this->timezone_ref_.size()); | ||||
| } | ||||
| #ifdef USE_API_SERVICES | ||||
| void ListEntitiesServicesArgument::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->name_ref_); | ||||
|   | ||||
| @@ -1180,10 +1180,6 @@ class GetTimeResponse final : public ProtoDecodableMessage { | ||||
| #endif | ||||
|   uint32_t epoch_seconds{0}; | ||||
|   std::string timezone{}; | ||||
|   StringRef timezone_ref_{}; | ||||
|   void set_timezone(const StringRef &ref) { this->timezone_ref_ = ref; } | ||||
|   void encode(ProtoWriteBuffer buffer) const override; | ||||
|   void calculate_size(ProtoSize &size) const override; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   void dump_to(std::string &out) const override; | ||||
| #endif | ||||
|   | ||||
| @@ -1113,13 +1113,7 @@ void GetTimeRequest::dump_to(std::string &out) const { out.append("GetTimeReques | ||||
| void GetTimeResponse::dump_to(std::string &out) const { | ||||
|   MessageDumpHelper helper(out, "GetTimeResponse"); | ||||
|   dump_field(out, "epoch_seconds", this->epoch_seconds); | ||||
|   out.append("  timezone: "); | ||||
|   if (!this->timezone_ref_.empty()) { | ||||
|     out.append("'").append(this->timezone_ref_.c_str()).append("'"); | ||||
|   } else { | ||||
|     out.append("'").append(this->timezone).append("'"); | ||||
|   } | ||||
|   out.append("\n"); | ||||
|   dump_field(out, "timezone", this->timezone); | ||||
| } | ||||
| #ifdef USE_API_SERVICES | ||||
| void ListEntitiesServicesArgument::dump_to(std::string &out) const { | ||||
|   | ||||
| @@ -160,15 +160,6 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type, | ||||
|       break; | ||||
|     } | ||||
| #endif | ||||
|     case GetTimeRequest::MESSAGE_TYPE: { | ||||
|       GetTimeRequest msg; | ||||
|       // Empty message: no decode needed | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|       ESP_LOGVV(TAG, "on_get_time_request: %s", msg.dump().c_str()); | ||||
| #endif | ||||
|       this->on_get_time_request(msg); | ||||
|       break; | ||||
|     } | ||||
|     case GetTimeResponse::MESSAGE_TYPE: { | ||||
|       GetTimeResponse msg; | ||||
|       msg.decode(msg_data, msg_size); | ||||
| @@ -656,11 +647,6 @@ void APIServerConnection::on_subscribe_home_assistant_states_request(const Subsc | ||||
|   } | ||||
| } | ||||
| #endif | ||||
| void APIServerConnection::on_get_time_request(const GetTimeRequest &msg) { | ||||
|   if (this->check_connection_setup_() && !this->send_get_time_response(msg)) { | ||||
|     this->on_fatal_error(); | ||||
|   } | ||||
| } | ||||
| #ifdef USE_API_SERVICES | ||||
| void APIServerConnection::on_execute_service_request(const ExecuteServiceRequest &msg) { | ||||
|   if (this->check_authenticated_()) { | ||||
|   | ||||
| @@ -71,7 +71,7 @@ class APIServerConnectionBase : public ProtoService { | ||||
| #ifdef USE_API_HOMEASSISTANT_STATES | ||||
|   virtual void on_home_assistant_state_response(const HomeAssistantStateResponse &value){}; | ||||
| #endif | ||||
|   virtual void on_get_time_request(const GetTimeRequest &value){}; | ||||
|  | ||||
|   virtual void on_get_time_response(const GetTimeResponse &value){}; | ||||
|  | ||||
| #ifdef USE_API_SERVICES | ||||
| @@ -226,7 +226,6 @@ class APIServerConnection : public APIServerConnectionBase { | ||||
| #ifdef USE_API_HOMEASSISTANT_STATES | ||||
|   virtual void subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) = 0; | ||||
| #endif | ||||
|   virtual bool send_get_time_response(const GetTimeRequest &msg) = 0; | ||||
| #ifdef USE_API_SERVICES | ||||
|   virtual void execute_service(const ExecuteServiceRequest &msg) = 0; | ||||
| #endif | ||||
| @@ -348,7 +347,6 @@ class APIServerConnection : public APIServerConnectionBase { | ||||
| #ifdef USE_API_HOMEASSISTANT_STATES | ||||
|   void on_subscribe_home_assistant_states_request(const SubscribeHomeAssistantStatesRequest &msg) override; | ||||
| #endif | ||||
|   void on_get_time_request(const GetTimeRequest &msg) override; | ||||
| #ifdef USE_API_SERVICES | ||||
|   void on_execute_service_request(const ExecuteServiceRequest &msg) override; | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user