[email protected], [email protected] component


#1

Hello all

Not that Miele finally put their 3rd party API into public Beta, it could be worth creating a component for it.
In general, all devices that are added to the [email protected] app, can be used with the API.
The API is documented here: http://developer.miele.com

Are there any more people interested in creating a component for the miele API? I’ve started playing around a bit but currently struggle as the connection from my Miele devices to the Miele cloud is fairly instable (still investigating in that).

Regards,
Roman


#2

I already have a custom component running here based on reverse engineered Apis, supporting dishwasher, oven, coffee machines and fridges - this is much better.

Thanks for Sharing


#3

You have that somewhere on github?

Btw, i still have an older XGW2000 and not the XGW3000 which is the standard now. (and the one displayed on the website)


#4

Not on GH yet - I always wanted to do a little clean up. Plus, I have an XGW3000. Not sure how much they differ


#5

Could you post it somewhere temporary so we could have a look and maybe use it as a base? I am currently implementing the authentication from the api in python.


#6

XGW3000 has local xml calls i believe, XGW2 has that too but that uses powerlines to communicate where as the XGW3 uses zigbee. Price of the XGW2 was 3x more as the XGW3 so they did make some improvements.

No cleanup required for us though, we just want to take a look (for me more to see if it does similar calls)


#7

I have the XKM 3100 W module and a dish-washer which already has wlan integrated, they all do not need any gateway anymore and I think they communicate directly with the Miele cloud (haven’t sniffed the traffic yet). So your component maybe doesn’t work at all for me. But I could use it as a base for the real api implementation.


#8

Just read the following at the Miele site (https://www.miele.ch/de/c/1917.htm?info=200133635-ZST):

Kann ich die [email protected] App auch mit dem XGW3000 und ZigBee-Geräten nutzen?
Ja, das XGW3000 ist mit der [email protected] App kompatibel.

Kann ich die [email protected] App auch mit dem XGW2000 und Powerline-Geräten nutzen?
Zum jetzigen Zeitpunkt wird dies nicht unterstützt.

So it seems the XGW2000 does not work with the API currently.


#9

The device XGW2000 has an XML api on it. I believe it is pretty much the same as the XGW3000 only difference is that the mobile app does not support it, even though it “can” support it. Normally you can just http to your device and see those kitchen appliances on it.

Anyways, mine looks like this:

(has a remote/json-rpc for live feeds)

So you can call {“jsonrpc”:“2.0”,“method”:“XGWAppliancesAdmin/getAppliances”,“params”:[],“id”:2} with that json payload for example and get a stream back of the current status of the device. Not rocket science for a good python programmer (but that does not include me)


#10

The old devices are significantly different than the newer ones. As I do not have a Gateway, all Miele devices directly connect to the Miele cloud and there seems to be no http server on the devices anymore. That’s why I need the Miele API in order to get any information about the devices.


#11

True, i prefer to have my systems local instead of the cloud. But i presume your devices have some name to it aswell? [email protected] usually needs to have a XGW3k gateway in order to make use of those devices. Whats the name for miele devices that connect to the cloud directly?


#12

I would prefer local services as well but that seems disabled / not available with the non-gateway devices. You need to add all devices into your w-lan and then you are able to add/configure them with the [email protected] app. Then you are able to query them from the Miele cloud API Beta.


#13

I see now, its called “Wifi [email protected]” and i see the majority of washing machines for example have that in regards to [email protected] which only shows 3 devices on the page as opposed to 2 pages of devices for wifi connect. So i think it was XGW2 (powerline) then XGW3 (zigbee) and now they have switched to Wifi [email protected] with a cloud api. (to be fair the last one would deliver more insight for miele, data harness. Does not mean a good thing) No longer the cost of an extra device either.


#14

Okay, I hacked together something based on my version for XGW3000. Still lots of work to expose properties correctly, but it’s start. Code is available at https://github.com/docbobo/home-assistant-miele

Put all of that into your custom_components folder, then configure as follows:

- platform: miele
  client_id: <client id received from Miele>
  client_secret: <client id received from Miele>
  lang: <either en or de>

Of course, you need to request developer credentials (client_id/client_secret) as described on the page in the first post. Once Home Assistant was restarted, you need to finish the OAuth2 Authentication via the link presented in HA.

And don’t judge the source code - it’s still a hack.


#15

Good work! Hmm I don’t see the authentication link in HA. Do I need to enable it somehow?
I put your 3 python files in a custom_components\miele folder and added

sensor:
- platform: miele
  client_id: <myid>
  client_secret: <mysecret>
  lang: de

Into my configuration.yaml


#16

The content needs to go into custom_component “as is”. So the sensor directory should be a direct child of custom_components


#17

One more thing: you need to

pip3 install requests_oauthlib

I’ll try to write a more complete installation guide later this week, if time permits.


#18

Now it works thatnks, the oauthlib was for some reason already installed. I see that a whole device is in one sensor, having on/off as a state and the rest as attributes. Is this the correct way? Is it possible to get a history about the attributes and display them easily (the most important thing I guess is to show a remaining time counter in home assistant) or should each value be exposed as an own sensor/binary_sensor?


#19

Glad you got it up and running, @Roemer.

As I said, the current is a little bit of a hack. Here’s what I am thinking though: each device should be exposed as miele.<device-name>. That entity would expose all the information that the Miele developer documentation has under ident. In addition, information available from state should be exposed like this:

  • signalInfo, signalFailure, signalDoor: individual binary_sensors
  • *temperature: individual sensors showing the temperature with unit of measurement
  • *time: individual sensors showing the indicated time value
  • programType, programPhase: sensors showing program information, once it has been properly documented by Miele

In the meantime, you should be able to do all of that via template sensors. For example:

binary_sensor:
  - platform: template
    sensors:
      dishwasher_door:
        friendly_name: "Dishwasher door"
        value_template:  {{ states.sensor.dishwasher.attributes.signalDoor }}

should expose the state of the dishwasher door for sensor.dishwasheras separate attribute, if I didn’t make any mistake.


#20

Sounds great how you plan to expose the devices / sensors. I’m getting btw some errors from time to time:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 210, in async_update_ha_state
    state = self.state
  File "/config/custom_components/sensor/miele.py", line 213, in state
    state = DeviceState(self._home_device['state']['status']['value_raw'])
  File "/usr/local/lib/python3.6/enum.py", line 291, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.6/enum.py", line 533, in __new__
    return cls._missing_(value)
  File "/usr/local/lib/python3.6/enum.py", line 546, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 10 is not a valid DeviceState

It is probably when the dishwasher is open as that is the only thing we did today :wink: