LordMike / MBW.BlueRiiot2MQTT

Utility to map between Blue Riiots pool API, and Home Assistant MQTT
47 stars 2 forks source link

Change Server #53

Closed Homeelec closed 2 years ago

Homeelec commented 3 years ago

Hello, I am a french user. In France we have a version from Irrijardin "Joey" https://joey.irripool.fr/?gclid=CjwKCAjwqvyFBhB7EiwAER786dQQPRhUrK36O8BPXm6jOy4rs4qGmYr1S8zIwTxJORfANCuhMoobhxoCDagQAvD_BwE I think they are the same products. I tried to connect my analyzer to the Blueriiot application without success. I tried to use your add-on without success too. It seems to me that the servers are not the same. BlueRiiot server: https://api.riiotlabs.com/prod/ Joey server: https://irrilake-ws.cloud.irripool.net/ My question is: How can I change the server to be connected?

thanks for your help

LordMike commented 3 years ago

Uhm, you can't right now. But damn, uhm, lemme expose a parameter for the servers URL.

Be aware that I will likely be completely unable to troubleshoot anything for this.

LordMike commented 3 years ago

Try the :dev tag, @Homeelec. With it, you should be able to set the environment variable BlueRiiot__ServerUrl to your french server, and see if it works.

The docker image should arrive momentarily.

Homeelec commented 3 years ago

thank you for the answer I will try

Homeelec commented 3 years ago

It doesn't work

My config in HA:

MQTT: Server: @.@.@.@ Port: 1883 Username: '' Password: '' ClientId: blueriiot2mqtt BlueRiiot: Username: @@@@@@gmail.com Password: @@@@@@@@@@@@ Language: en DiscoveryInterval: '12:00:00' UpdateInterval: '01:00:00' UpdateIntervalWhenAllDevicesAsleep: '08:00:00' ReportUnchangedValues: true ServerUrl: irrilake-ws.cloud.irripool.net HASS: DiscoveryPrefix: homeassistant TopicPrefix: blueriiot EnableHASSDiscovery: true

Debug in HA:

[07:50:01 INF] Loading extra config file at /data/options.json [2021-06-09 07:50:03+00:00 INF] [MqttNet.ManagedMqttClient] Started [2021-06-09 07:50:03+00:00 INF] [MqttNet.MqttClient] Connected. [2021-06-09 07:50:04+00:00 INF] [Microsoft.Hosting.Lifetime] Application started. Press Ctrl+C to shut down. [2021-06-09 07:50:04+00:00 INF] [Microsoft.Hosting.Lifetime] Hosting environment: Production [2021-06-09 07:50:04+00:00 INF] [Microsoft.Hosting.Lifetime] Content root path: /app [2021-06-09 07:50:06+00:00 ERR] [MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService] An error occurred while performing the update System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at MBW.Client.BlueRiiotApi.BlueClient.LoginWithUsernamePassword(String email, String password, CancellationToken token) at MBW.Client.BlueRiiotApi.Builder.UsernamePasswordRequestSigner.LoginIfNeeded(BlueClient client, CancellationToken token) at MBW.Client.BlueRiiotApi.BlueClient.PerformHttp[TRequest,TResponse](String path, HttpMethod method, TRequest requestBody, CancellationToken token) at MBW.Client.BlueRiiotApi.BlueClient.GetSwimmingPools(Boolean deleted, CancellationToken token) at MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService.PerformUpdate(CancellationToken stoppingToken) in /src/MBW.BlueRiiot2MQTT/Service/BlueRiiotMqttService.cs:line 130 at MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService.ExecuteAsync(CancellationToken stoppingToken) in /src/MBW.BlueRiiot2MQTT/Service/BlueRiiotMqttService.cs:line 72

LordMike commented 3 years ago

You can enable more logging using these two environment variables:

Logging__MinimumLevel__Default: Verbose
Logging__MinimumLevel__Override__MBW.Client.BlueRiiotApi: Verbose

But assuming your credentials are correct, it could seem they have a different api / different requirements.

LordMike commented 3 years ago

Oh wait - your config is the HASS addon. You cannot configure the server url in the HASS addon, that setting isn't exposed there.

Can you run it in docker standalone?

Homeelec commented 3 years ago

Now I run it in docker on Synology

Capture d’écran 2021-06-09 à 12 09 27
Homeelec commented 3 years ago

A friend gave me access to Blueriiot. When I test with its codes it works that I put: BlueRiiotServerUrl: https://irrilake-ws.cloud.irripool.net or BlueRiiotServerUrl: irrilake-ws.cloud.irripool.net

LordMike commented 3 years ago

Does this mean it works?

Homeelec commented 3 years ago

Yes with BlueRiiot logins, but I have the impression that it does not take the value of the server address. It still uses "https://api.riiotlabs.com/prod/" the one Even if I put anything in "BlueRiiot__ServerUrl" as a server it works

Homeelec commented 3 years ago

Hello, any news,

Homeelec commented 2 years ago

Hello, For my part I tried to move forward with the charles proxy software, and it gives me this structure. Is she the same as you?

Charles Proxy

If not can tell me the differences? I also have more details.

folder

LordMike commented 2 years ago

Yes with BlueRiiot logins, but I have the impression that it does not take the value of the server address. It still uses "https://api.riiotlabs.com/prod/" the one Even if I put anything in "BlueRiiot__ServerUrl" as a server it works

I tested out changing the BlueRiiot__ServerUrl environment variable, and I get errors if it's not the BlueRiiot API endpoint. F.ex., changing it to https://irrilake-ws.cloud.irripool.net/ gives me HTTP 403's, as I don't have credentials (or the API is different):

[2021-09-12 23:27:40+02:00 ERR] [MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService] An error occurred while performing the update
System.Net.Http.HttpRequestException: Response status code does not indicate success: 403 (Forbidden).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at MBW.Client.BlueRiiotApi.BlueClient.LoginWithUsernamePassword(String email, String password, CancellationToken token)
   at MBW.Client.BlueRiiotApi.Builder.UsernamePasswordRequestSigner.LoginIfNeeded(BlueClient client, CancellationToken token)
   at MBW.Client.BlueRiiotApi.BlueClient.PerformHttp[TRequest,TResponse](String path, HttpMethod method, TRequest requestBody, CancellationToken token)
   at MBW.Client.BlueRiiotApi.BlueClient.GetSwimmingPools(Boolean deleted, CancellationToken token)
   at MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService.PerformUpdate(CancellationToken stoppingToken) in N:\Git\Personal\MBW.BlueRiiot2MQTT\MBW.BlueRiiot2MQTT\Service\BlueRiiotMqttService.cs:line 132
   at MBW.BlueRiiot2MQTT.Service.BlueRiiotMqttService.ExecuteAsync(CancellationToken stoppingToken) in N:\Git\Personal\MBW.BlueRiiot2MQTT\MBW.BlueRiiot2MQTT\Service\BlueRiiotMqttService.cs:line 72

So I do believe the variable works.

That being said. The structure you show in Charles is similar, but not the same. F.ex., the API for getting pool measurements, is /swimming_pool/(id)/lastMeasurements .. while you have /pools/(id)/measures/last..

Homeelec commented 2 years ago

Ok Thank you for answer.