From 566e5c5845e2ee92c5a75011bd1020bb38734b19 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 26 Nov 2022 13:37:46 +0800 Subject: [PATCH] Send new header to make it compatible with 'charge_history'. --- lib/Tesla/API.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Tesla/API.pm b/lib/Tesla/API.pm index 42f4a5b..d1e2a1d 100644 --- a/lib/Tesla/API.pm +++ b/lib/Tesla/API.pm @@ -120,7 +120,11 @@ sub api { my $url = $self->uri(URL_API . $uri); - my $header = ['Content-Type' => 'application/json; charset=UTF-8']; + my $header = [ + 'Content-Type' => 'application/json; charset=UTF-8', + # This header is required for charge_history. + 'X-Tesla-User-Agent' => 'TeslaApp/4.10.0', + ]; if ($auth) { my $token_string = "Bearer " . $self->_access_token;