Now 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 miele@mobile 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).
I already have a custom component running here based on reverse engineered Apis, supporting dishwasher, oven, coffee machines and fridges - this is much better.
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.
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)
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.
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.
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)
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.
True, i prefer to have my systems local instead of the cloud. But i presume your devices have some name to it aswell? miele@home 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?
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 miele@mobile app. Then you are able to query them from the Miele cloud API Beta.
I see now, its called “Wifi Conn@ct” and i see the majority of washing machines for example have that in regards to miele@home 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 conn@ct 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.
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.
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
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?
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:
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