Regarding testing DOP2, please get the latest version of the server and try again, I’ve added some error reporting for the walkdop2tree endpoint. If it says “DOP2 root node not found”, then your device likely does not expose a DOP2 interface; not all Miele devies do. (/start is a GET and POST endpoint now. GET reports whether the device can remote start; POST actually performs it).
@mill7
Turning on should work already with the /start endpoint. But you won’t be able to program it through the server just yet. If you send me the output of the walkdop2tree command, maybe it can be made to work. I don’t see why the app should be able to do anything the server can’t, assuming we can figure out the protocol.
From investigating the program IDs with @astrandb in the early days of the miele@home integration, I can tell you there is no single mapping of program IDs to human readable names even within a device type. Most are somewhat similar, but in the end it is a big mess, unfortunately.
@mundschenk-at
Yeah, I noticed that, but it can be done. The MieleApi.py has all the values figured out so far – feel free to add. Did you guys do any work on the DOP2 protocol? Or find some other way to actually program the device from your own code?
@mill7
it’s a command the server provides. As stated in the README – if you provision your device with my tool, your existing cloud integration will stop working.
Yeah, that was our approach too, except as I said it does not work. The IDs sometimes have a different meaning depending on the specific device (generation) in question (and also several IDs can mean the same thing, either on different device types or just specific devices). I’ll check if I can find some notes and discussions. Ah, yeah, here.
No, only through the official cloud API (though I did a collection of previous work in this early discussion).
Thank you for this info. The key finding here is this:
Washers and dryers are separated; there are three “generations” of each. dop1 (also called legacy in the DLLs), dop2 , and semipro . We’ll have to figure out how to detect the device type, there are conflicts between the numeric values.
I’ll take this into account. Maybe that’s also why some devices have a DOP2 endpoint and others don’t?
It doesn’t really change the approach though. Instead of one long list of constants, the server now gets three, plus some config entry or (preferably) autodetection routine what “tier” of device it’s talking to.
as suspected, the DOP2 protocol provides more abundant data than the “/State” endpoint currently used by the server, including detailed readouts of various internal sensor and actuator states and consumption statistics – see below. Likely more than anyone wants to see in their Home Assistant dashboard, but possibly useful for diagnostics.
However, unlike the JSON, the DOP2 format is not self descriptive and requires identifying the correct data structures by hand. Currently, I am only able to do this for a washer, because that’s the only DOP2 device I have access to.
As such, if you are currently using this software, could you please provide a dump of the output of the walkdop2tree endpoint.
I would also like to know what data the official app exposes for a dryer or other devices without a DOP2 endpoint. Can someone please share screenshots?
DOP2 also exposes a firmware update interface, which might make entirely local firmware updating possible as well.
First of all a big thank you for the MieleRESTServer. I’m so happy to see there is a way to control Miele devices locally. Suddenly, I was unable to connect to the dish washer. I got ‘Bad Request’ from the Miele API cloud. Maybe they revoked my token.
I struggled already at the 1. point to connect my Miele@home-G335-7 dish washer. May I ask a few questions here:
What device are you using to connect? I tried it with a mobile phone and “Connect via App” on the Miele device. The connection to the Miele Access Point was successful. But then I didn’t get any further in the process. Do you recommend a laptop and connect via Wifi? On my Miele device I have 2 options to connect. 1) Via App 2) Via WPS. Or do you connect with the device (PC/Raspi) where Home Assistant is running?
How do you give an IP address to the Miele Device? Usually, when I connect new devices to my LAN, I tell the new device the SSID and password of my Wifi. Then my DCHP server will assign an IP address to the new device.
For 1), you should use a computer because you’ll need to run the “provision-wifi.sh” script. It can be the same or a different computer than what you ultimately intend to run the server on.
The correct option to select on the Miele is “via app”. I will update this in the README.
You can’t use “your” home wifi DHCP server yet at this step because the Miele device has its own WiFi until you tell it to connect to yours. A popular DHCP server one liner for Linux is:
Hi,
Many thanks for your hints. It worked out very well. I used a laptop with Windows and WSL to connect to the Miele Access Point. I’ve discover a small typo. Point 2.) Instead of
./provision-keys.sh
it should be
./provision-key.sh
without an ‘s’ at the end.
But now I stuck at point 5.) to get the server running. Where would install the MieleRESTServer? Is it possible to install it on the device where home assistant is running or on another device? My server failed to install. I’ve got following error
$ journalctl -u MieleRESTServer.service
Mär 07 16:18:15 username systemd[1]: Started Miele REST Interface Server.
Mär 07 16:18:15 username systemd[136876]: MieleRESTServer.service: Failed to determine user credentials: No such process
Mär 07 16:18:15 username systemd[136876]: MieleRESTServer.service: Failed at step USER spawning /usr/bin/python3: No such process
you should be able to install the server on the same computer as Homeassistant or a different one. The additional resource load from the server is negligible.
I reworked the install script to create the “mieleserver” user and install the Python dependencies for that user – please pull the latest version from master and try again. Let me know if it works.
Many thanks for updating the install.sh script. I’ve got following permission error:
~/MieleRESTServer$ sudo ./install.sh
Failed to stop MieleRESTServer.service: Unit MieleRESTServer.service not loaded.
WARNING: The directory '/home/mieleserver/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from -r ./requirements.txt (line 1)) (3.4.8)
Requirement already satisfied: Flask in /usr/lib/python3/dist-packages (from -r ./requirements.txt (line 2)) (2.0.1)
Collecting flask_restful
Downloading Flask_RESTful-0.3.10-py2.py3-none-any.whl (26 kB)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from -r ./requirements.txt (line 4)) (1.21.5)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r ./requirements.txt (line 5)) (5.4.1)
Requirement already satisfied: Requests in /usr/local/lib/python3.10/dist-packages (from -r ./requirements.txt (line 6)) (2.31.0)
Collecting aniso8601>=0.82
Downloading aniso8601-10.0.0-py2.py3-none-any.whl (52 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.8/52.8 KB 4.0 MB/s eta 0:00:00
Requirement already satisfied: pytz in /usr/lib/python3/dist-packages (from flask_restful->-r ./requirements.txt (line 3)) (2022.1)
Requirement already satisfied: six>=1.3.0 in /usr/lib/python3/dist-packages (from flask_restful->-r ./requirements.txt (line 3)) (1.16.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from Requests->-r ./requirements.txt (line 6)) (1.26.5)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from Requests->-r ./requirements.txt (line 6)) (2020.6.20)
Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from Requests->-r ./requirements.txt (line 6)) (3.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from Requests->-r ./requirements.txt (line 6)) (3.3.2)
Installing collected packages: aniso8601, flask_restful
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/home/mieleserver/.local'
Check the permissions.
I’ve tested the old script and changed the user from mieleserver to my user name. Then I got the error status=1/FAILURE. After running
in the terminal, it appeared that the python requests and flask_restful modules are not installed. Then I run
pip3 install requests
pip3 install flask_restful
to install the missing python modules.
This was successful and I can get all the device information on localhost:5001/generate-summary. Confirming the MieleRESTServer is working with the Miele Device G3885
I changed the IP address from 127.0.0.1 to my linux IP address to be able to connect to Home Assistant running currently on a Raspberry Pi 4+.
Any idea how to setup this MieleRESTServer on a Raspberry Pi with Home Assistant OS (Supervised)?
@Bruce80
Nice! Added your device to the compability list. I further modified the installer to use a virtual environment; this should avoid the issue with the installation of user packages.
As for “Home Assistant OS (Supervised)”… I looked into this briefly, not sure what capabilities this platform has, but it seems to be based on Debian and Docker. So if you can run a Docker container on that device, try to build the server as a Docker container and run it on the server (I added a Dockerfile and build scripts, so should be fairly simple).
Regarding DOP2 – some devices do not expose the DOP2 endpoint, or at least I haven’t been able to find it yet. You should still be able to get most of the core functionality through the non-DOP2 HTTP interface, but I do not know how to program the device fully remotely without DOP2. Can you tell me what the official app was capable of doing on your device? Was it possible to set up the device fully remotely, i.e. fully “cold and dark” to dishwash cycle running?
I’ve tried the new install script and it works nicely and without any error. Many thanks for this fix!
Well “Home Assistant OS (Supervised)” was expressed a bit confusing. I would like to run this MieleRESTServer on the Raspberry Pi where pure Home Assistant OS is installed. Home Assistant OS is installed like this www.home-assistant . io / installation / raspberrypi. With this, it would not be necessary to expose the server to my LAN (security) and would just use the subnet 127.0.0.1 to get the data from the Miele Device. Just a few thoughts about how to achieve this:
DOP2: I think the MieleRESTServer has no access or this Miele Dishwasher doesn’t support it. I haven’t used the official Miele@Home mobile App at all apart of setting up the connection to the official Miele 3rd Party API to connect to the Home Assistant Miele Add’on www . github . com / astrandb / miele.
In my use case I’m not using the “remote start” function. But looking at the endpoint localhost:5001/start/washer I read:
You won’t be able to completely firewall the server from your LAN while keeping it functional – it needs to be able to talk to the Miele devices, after all. But you can firewall incoming new connections or bind it to 127.0.0.1 only, so it will not respond to requests requests from any other host.
Thank you very much for those hints. I will try to ssh into running HA, although it looks like a lot of effort too (preparing USB, generating SSH keys etc.). I was not aware that ssh-addon only grants limited access to Home Assistant OS.
I think your idea with SSH into HA will be more secure than my current testing solution of exposing the server to my LAN and every device inside my LAN can read what the dishwasher is currently doing.
Just for my understanding, the communication between the MieleRESTServer and the Miele device is encrypted. The server will de-crypt the communication and make the data from the Miele device available to Home Assistant, right?
Running it on HAOS by hand is probably not worth the pain, it’s not intended as a “general use” OS. If Supervisor does not like your modifications, it can leave HA in a degraded state.
Strictly speaking, the machine <==> REST server communications are encrypted and authenticated. There’s some issues with the implementation though, so it’s not bomb proof. I would simply firewall the machine from all other local hosts (and especially the internet).
If you’re concerned about the MieleRESTServer leaking that info, why not firewall that off too? The REST server does not need to talk to anything other than your Miele machines and whatever hosts it’s supposed to respond to queries from.