You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Steve,
Thanks for a useful interface. I am using it to get data from a Powerwall. In particular the timeseries at the CALENDAR_HISTORY_DATA endpoint.
The Tesla::API returns some current day data when when called without parameters. But the unofficial documentation at https://tesla-api.timdorr.com/energy-products/energy/history allows parameters to select the date for the timeseries can be supplied. So I issued the following call:
my $timeseries = $tesla->api(
endpoint => $config->{power}{endpoint},
id => $config->{powerwall}{id},
api_params => \%params
);
But the returned timeseries remained for the current day
I spent some time in the debugger and noticed the parameters are added as json to the header data. Which made me think that the request is assumed to be a POST. The documentation asserts the type is GET. With that assumption I hacked API.pm adding:
sub fixUriGetWithParam {
my ( $uri, $params ) = @_;
my $connect = '?';
foreach my $p ( keys %$params ) {
$uri .= $connect . $p . '=' . $params->{$p};
$connect = '&';
}
return $uri;
}
and calling the routine before line 122 my $url = $self->uri(URL_API . $uri); with:
I now retrieve data for a requested date. So the change addresses my issue. However, I have no idea whether this is a sane solution to the problem. I do not understand the internals of Http::Request etc.
If this approach is sane, I am happy to supply a pull request. If it is not, I am open to alternatives and implement these.
Let me know.
The text was updated successfully, but these errors were encountered:
Hi Steve,
Thanks for a useful interface. I am using it to get data from a Powerwall. In particular the timeseries at the CALENDAR_HISTORY_DATA endpoint.
The Tesla::API returns some current day data when when called without parameters. But the unofficial documentation at https://tesla-api.timdorr.com/energy-products/energy/history allows parameters to select the date for the timeseries can be supplied. So I issued the following call:
But the returned timeseries remained for the current day
I spent some time in the debugger and noticed the parameters are added as json to the header data. Which made me think that the request is assumed to be a POST. The documentation asserts the type is GET. With that assumption I hacked API.pm adding:
and calling the routine before line 122 my $url = $self->uri(URL_API . $uri); with:
I now retrieve data for a requested date. So the change addresses my issue. However, I have no idea whether this is a sane solution to the problem. I do not understand the internals of Http::Request etc.
If this approach is sane, I am happy to supply a pull request. If it is not, I am open to alternatives and implement these.
Let me know.
The text was updated successfully, but these errors were encountered: