Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No token on raspberry Pi #11

Closed
punthoofd07 opened this issue May 8, 2020 · 3 comments
Closed

No token on raspberry Pi #11

punthoofd07 opened this issue May 8, 2020 · 3 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@punthoofd07
Copy link

punthoofd07 commented May 8, 2020

Hi,
When developing my .net core 3 web application, I can get the measure data. However, when I run the .net core on my raspberry, I get an error once it tries to run this line of code:

var weatherStation = await netatmoClient.GetWeatherStationData();

This is the error I get. Any idea what could be wrong here?

May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoAuthBase.LoadAndStoreAccessToken(IEnumerable`1 postParameters)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoAuthBase.GetInitialAccessToken()
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoAuthBase.Authenticate()
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoAuthBase.RequestNetatmoApi(Uri uri, IEnumerable`1 parameters)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoAuthBase.CallNetatmoApi[TWiremessage,TData](Uri uri, IEnumerable1 parameters)
May 08 12:58:46 PI dotnet-sgw-blazor[24417]:          at PhilipDaubmeier.NetatmoClient.NetatmoWebClient.GetWeatherStationData(ModuleId deviceId, Nullable1 getFavorites)

This is the code that goes before it:

var AuthData = new NetatmoAuth("info@xxx.be", "xxx");
var netatmoConnProvider = new NetatmoConnectionProvider(AuthData)
{
    AuthData = new NetatmoAuth("info@xxx.be", "xxx"),
    AppId = "xyz123",
    AppSecret = "anothercode",
    Scope = "read_station read_presence access_presence"
};

var netatmoClient = new NetatmoWebClient(netatmoConnProvider);
@philipdaubmeier philipdaubmeier self-assigned this May 8, 2020
@philipdaubmeier
Copy link
Owner

First of all: thanks for your interest and for using my library!

What you describe does not seem like a bug in the NetatmoClient library but looks like you have a connection issue. Does your raspberry Pi have unrestricted access to the internet?

The GetInitialAccessToken method is the first internal method that does a request to the netatmo server, that is why it is failing here.

Could you also provide the exact exception message you are getting? You only posted the stack trace.

@punthoofd07
Copy link
Author

Hi Philip,
No, no thank you for your effort on this! Sorry for the late reply here..
The RPi has full access to the outside world, but I forgot to set legit DNS servers... totally stupid as a network engineer 👎 Just taking things for granted..
Problem solved & sorry to bother you for nothing! Thanks for pointing in the right direction!

@philipdaubmeier
Copy link
Owner

No problem, glad I could help!

@philipdaubmeier philipdaubmeier added the wontfix This will not be worked on label May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants