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

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

Closed
cvc90 opened this issue May 30, 2023 · 13 comments
Closed

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

cvc90 opened this issue May 30, 2023 · 13 comments

Comments

@cvc90
Copy link

cvc90 commented May 30, 2023

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
Copy link
Contributor

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
Copy link
Author

cvc90 commented May 30, 2023

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
Copy link
Member

philipparndt commented May 30, 2023

@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": "[email protected]",
    "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
Copy link
Author

cvc90 commented May 30, 2023

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
Copy link
Author

cvc90 commented May 30, 2023

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
Copy link
Member

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
Copy link
Author

cvc90 commented May 31, 2023

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
Copy link
Member

@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 😉):

{
  ...
  "miele": {
    "client-id": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
    "client-secret": "12345678901234567890123456789012",
    "polling-interval": 30,
    "username": "[email protected]",
    "password": "miele_at_home_password",
    "country-code": "es-ES",
    "mode": "sse"
  }
}

@cvc90
Copy link
Author

cvc90 commented Jun 2, 2023

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
Copy link
Member

  • The error message is addressed in pharndt/mielemqtt:3.1.1
  • The logging will now respect the TZ setting from the docker container
  • It is possible to set the log level again

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
Copy link
Author

cvc90 commented Jun 2, 2023

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

  • Log messages now showing without having the token in the .json file have been removed and no longer show the error.

  • The container correctly collects the "TZ" variable as shown in the attached image correctly shows the date and time. Although the displayed date format is YYYY/MM/DD and the correct format would be DD/MM/YYYY.

  • I have added the new variable "loglevel": "info" and "loglevel": "debug" to the .json file and everything seems to work correctly.

image
image

@cvc90
Copy link
Author

cvc90 commented Jun 8, 2023

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
Copy link
Member

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: #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants