mqtt-home / miele-to-mqtt-gw

Apache License 2.0
10 stars 2 forks source link

I can't get docker miele-to-mqtt-gw to work #106

Closed cvc90 closed 1 year ago

cvc90 commented 1 year ago

Hello, could you help me to get miele-to-mqtt-gw? For some reason I can't get the Docker version to work, it doesn't get the token to work and looking at the log it gives me a 401 error (invalid credentials) and that's why it doesn't receive the token (I attach an image showing what I'm saying).

image image

The configuration is the same as config-example.json but changing client-id, client -secret, username, password and I checked the credentials both on the page and in the miele app and I can say that it works correctly.

From the page https://www.miele.com/developer/swagger-ui/swagger.html everything seems to work correctly and I can see my devices without problems.

image

Could it be that today miele-to-mqtt-gw doesn't work? or the credentials written in the .json file containing special characters do not read them correctly?

AleksCee commented 1 year ago

Hi @cvc90 in my log are errors since 1 am today but I have just restart the container and itβ€˜s seams to work right now:

16:33:02.609 INFO - Info enabled 16:33:02.627 INFO - Connecting MQTT client 16:33:04.159 INFO - MQTT client connected 16:33:06.582 INFO - Using Miele polling api

Alex

cvc90 commented 1 year ago

Hi @cvc90 in my log are errors since 1 am today but I have just restart the container and itβ€˜s seams to work right now:

16:33:02.609 INFO - Info enabled 16:33:02.627 INFO - Connecting MQTT client 16:33:04.159 INFO - MQTT client connected 16:33:06.582 INFO - Using Miele polling api

Alex

Would you be so kind hiding your personal values, show the .json file? I can't get it to work, I even tried to change the api and password of the account and it still doesn't work...

I have the Token Bearer and as I show in the photos it is working. Is it possible to add it to the .json manually?

philipparndt commented 1 year ago

@cvc90 Do you like to test pharndt/mielemqtt:3.0.0-pre?

my full config.json:

{
  "mqtt": {
    "url": "tcp://mosquitto:1883",
    "retain": true,
    "topic": "home/miele",
    "qos": 2,
    "bridge-info": true,
    "autoPublish": true,
    "deduplicate": true
  },
  "miele": {
    "client-id": "12345678-abcd-1234-1234-123456789abc",
    "client-secret": "01234567890123456789012345678901",
    "username": "some@other.de",
    "password": "password",
    "mode": "sse",
    "polling-interval": 30,
    "token": {
      "access": "DE_5c...",
      "refresh": "DE_f6...",
      "validUntil": "2022-08-30T11:32:40.434+02:00[Europe/Berlin]"
    }
  }
}

my docker-compose.yml snipped

  ...
  mielemqtt:
    environment:
      TZ: "Europe/Berlin"
    hostname: mielemqtt
    image: pharndt/mielemqtt:3.0.0-pre
    volumes:
      - ./config/miele:/var/lib/miele-to-mqtt-gw:rw
    restart: always
    depends_on:
      - mosquitto
    cpus: 0.1
    mem_reservation: "50M"
    mem_limit: "50M"
  ...
cvc90 commented 1 year ago

Thanks @philipparndt, for the copy of your .json file, of course I see differences since in mine I don't have the token section, but first I'm going to try the docker version that pharndt/mielemqtt:3.0.0-pre comments, in As soon as I try the new version, I'll comment if I was able to solve it.

cvc90 commented 1 year ago

I have updated the docker to version pharndt/mielemqtt:3.0.0-pre, now the same error appears but with another explanation, I attach an image with the current error.

image

Could I manually get the Tokens (Access,refresh,valid) and manually add them to the configuration file?

philipparndt commented 1 year ago

Yo can try version pharndt/mielemqtt:3.0.1-pre with the following configuration:

{
  "mqtt": {
    "url": "tcp://192.168.2.2:1883",
    "client-id": "miele-mqtt-gw",
    "username": "username",
    "password": "password",
    "retain": true,

    "topic": "home/miele",
    "deduplicate": true
  },

  "miele": {
    "client-id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    "client-secret": "12345678901234567890123456789012",
    "mode": "sse",
    "token": {
      "access": "access_token",
      "refresh": "refresh_token"
    }
  }
}
cvc90 commented 1 year ago

Hello, I updated the docker to version "pharndt/mielemqtt:3.0.1-pre" using the configuration from config-example.json but changing the client id, client-secret, username, password, I can say that it doesn't work as I show in the photo, it keeps giving error 401 without authorization.

image

Using the configuration that you comment and accessing Miele Developer to get the access_token and refresh_token (Thanks to Chrome development mode seeing the request ) I can say that it works correctly as I show in the photo.

image

After starting it, all the tokens have been updated again and I have new values for the tokens (access,refresh,validUntil) and it continues to work on the following starts perfectly.

@philipparndt Thanks for getting it to work!! πŸ’― πŸš€

philipparndt commented 1 year ago

@cvc90 I think I have found the root cause for the problem. The country-code was hard-coded to de-DE.

Can you test this version: pharndt/mielemqtt:3.1.0

With this config (based on your GitHub profile I guess the country code could es-ES :wink:):

{
  ...
  "miele": {
    "client-id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    "client-secret": "12345678901234567890123456789012",
    "polling-interval": 30,
    "username": "miele_at_home_user@example.com",
    "password": "miele_at_home_password",
    "country-code": "es-ES",
    "mode": "sse"
  }
}
cvc90 commented 1 year ago

Hi, I just tried the version of Docker (pharndt/mielemqtt:3.1.0), I can say that now introducing the new "country-code" which in my case would be "country-code": "es-ES", it works perfectly, the only thing I see is when starting it shows an error in token because it should not find the tokens and it connects to update it, I attach a screenshot of the Docker registry.

image

The option in config "timezone": "GMT+1" does not seem to work correctly either, since the photo shows that the time is 8 o'clock and it is 10 o'clock.

On the main page of Github you do not have the "country-code" located in the example configuration by username /password and in the example of access token it is located wrongly, you have it inside "mqtt": instead of in the "miele": section.

Taking advantage of the situation, I volunteer to translate these outgoing messages or any other text into Spanish.

philipparndt commented 1 year ago

I do not plan to provide other languages in error messages, as this is hard to maintain. Nevertheless, thank you for the offer to help πŸ˜„.

Thanks for the hint with the wrong position of the country code in the documentation πŸ‘.

cvc90 commented 1 year ago

Hi! I just updated Docker to version pharndt/mielemqtt:3.1.1 and these are my impressions after trying it.

image image

cvc90 commented 1 year ago

Would it be possible to add the MQTT autodiscovery option? I can't sync with Home Assistant/Domoticz, but I see the topic "miele" from MQTT Explorer.

philipparndt commented 1 year ago

Would it be possible to add the MQTT autodiscovery option? I can't sync with Home Assistant/Domoticz, but I see the topic "miele" from MQTT Explorer.

@cvc90 I add this to an separate issue: https://github.com/mqtt-home/miele-to-mqtt-gw/issues/136