Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

MQTT api changed #14

Open
Woyken opened this issue Jun 26, 2023 · 16 comments
Open

MQTT api changed #14

Woyken opened this issue Jun 26, 2023 · 16 comments
Labels
enhancement New feature or request

Comments

@Woyken
Copy link

Woyken commented Jun 26, 2023

I tried using session.registerMQTT()
It doesn't work anymore

missing parameter for utils.registerMQTT(region)
Also API returns probably changed structure than it used to:

POST https://api.eu.ecp.electrolux.com/user-appliance-reg/api/v1.1/devices

{
	"status": "OK",
	"code": "ECP0000",
	"message": "Device created",
	"data": {
		"mqttUrl": "mqtt.eu.ecp.electrolux.com:443",
		"topic": "mobile/cmd/d:mobile:-1000000000_000000002",
		"featureTopic": "mobile/feature/d:mobile:-1000000000_000000002",
		"clientId": "d:mobile:-1000000000_000000002"
	}
}

so it no longer contains DeviceToken

Where did you find those APIs? Mobile app?
I decompiled Android apk com.electrolux.oneapp.android.aeg, but couldn't find any references to MQTT

@tomeko12 tomeko12 added the enhancement New feature or request label Jun 26, 2023
@tomeko12
Copy link
Owner

Hi.
Electrolux was changed mqtt broker from IBM cloud to something different (Amazon cloud?).
In ADB logs there's some information about connection to MQTT broker

06-13 16:58:22.375 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:97] [http post] https://api.eu.ecp.electrolux.com/user-appliance-reg/api/v1.1/devices >>>>
06-13 16:58:22.402 3495 3606 I ESDK-Native: [curl_helpers.h:57] Curl version 7.60.0-DEV
06-13 16:58:22.690 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:102] [http response] 200 : {"status":"ERROR","code":"ECP0206","message":"Device: d:mobile:123456789_1234567890 is already registered to user: [email protected]","data":{}}
06-13 16:58:22.690 3495 3606 D MQTT : register {"status":"ERROR","code":"ECP0206","message":"Device: d:mobile:123456789_1234567890 is already registered to user: [email protected]","data":{}}
06-13 16:58:22.691 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:56] [http del] https://api.eu.ecp.electrolux.com/user-appliance-reg/api/v1.1/devices
06-13 16:58:23.042 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:58] [http response] 200 : {"status":"OK","code":"ECP0000","message":"Device unregistered successfully","data":null}
06-13 16:58:23.043 3495 3606 D MQTT : unregister {"status":"OK","code":"ECP0000","message":"Device unregistered successfully","data":null}
06-13 16:58:23.043 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:97] [http post] https://api.eu.ecp.electrolux.com/user-appliance-reg/api/v1.1/devices >>>>
06-13 16:58:23.292 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:102] [http response] 200 : {"status":"OK","code":"ECP0000","message":"Device created","data":{"mqttUrl":"mqtt.eu.ecp.electrolux.com:443","topic":"mobile/cmd/d:mobile:123456789_1234567890","featureTopic":"mobile/feature/d:mobile:123456789_1234567890","clientId":"d:mobile:123456789_1234567890"}}
06-13 16:58:23.292 3495 3606 D MQTT : register2 {"status":"OK","code":"ECP0000","message":"Device created","data":{"mqttUrl":"mqtt.eu.ecp.electrolux.com:443","topic":"mobile/cmd/d:mobile:123456789_1234567890","featureTopic":"mobile/feature/d:mobile:123456789_1234567890","clientId":"d:mobile:123456789_1234567890"}}
06-13 16:58:23.292 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:405] Parsed
06-13 16:58:23.292 3495 3606 I ESDK-Native: [djinni_comm_api.cpp:409] IS AMAZON
06-13 16:58:23.295 3495 3597 E ROUTER+ : MQTT_RELAY resolved with Native
06-13 16:58:23.297 3495 3597 E ROUTER+ : OPEN_MQTT_BUS_ECP resolved with Native
06-13 16:58:23.297 3495 3597 I ESDK-Native: [mqtt_connection.cpp:110] Creating MQTT client
06-13 16:58:23.297 3495 3597 I ESDK-Native: [mqtt_connection.cpp:181] URL: ssl://mqtt.eu.ecp.electrolux.com:443, PW:{"type":"session","value":"q+CP+IN00PqgpYXcNmIXR9HlCf4NUafEr0lMhv8Uk1sTiPUqthcWbr0t9c0OH4eaPNLjoFDyyq+PQ6phRuZ0i6AaQS0BUPWqAL98s7dA+e5i4A7QrDtno3L85wneAQnTHAsGVsbPxFE8eBXB3Sj+jbxYCMokYaEXmT+vrj/kmYFIuD622YcI1yarRpY8LQoaP67kz6mONjXQq2nsIq9t11MISXIv/L7XNya01xT/veZLNDXa1Dr/CcKftCNk+uSK1lPL+G5lQPdwP4jis7hc5+A9w/m71UOHmesEQxhbaVqfWcKzB5TrTR6svy6DKdf4kMj2jmCiANGTRhtkU1q7dQ=="}
06-13 16:58:23.298 3495 3597 D MQTT : start blocking mqtt client
06-13 16:58:23.298 3495 3597 I ESDK-Native: [paho_c_backend.cpp:146] MQTT pausing client disconnected = true
06-13 16:58:23.298 3495 3597 I ESDK-Native: [paho_c_backend.cpp:24] MQTT start
06-13 16:58:23.301 3495 3597 I ESDK-Native: [paho_c_backend.cpp:95] MQTT connect
06-13 16:58:23.301 3495 3597 I ESDK-Native: [paho_c_backend.cpp:108] [email protected] {"type":"session","value":"q+CP+IN00PqgpYXcNmIXR9HlCf4NUafEr0lMhv8Uk1sTiPUqthcWbr0t9c0OH4eaPNLjoFDyyq+PQ6phRuZ0i6AaQS0BUPWqAL98s7dA+e5i4A7QrDtno3L85wneAQnTHAsGVsbPxFE8eBXB3Sj+jbxYCMokYaEXmT+vrj/kmYFIuD622YcI1yarRpY8LQoaP67kz6mONjXQq2nsIq9t11MISXIv/L7XNya01xT/veZLNDXa1Dr/CcKftCNk+uSK1lPL+G5lQPdwP4jis7hc5+A9w/m71UOHmesEQxhbaVqfWcKzB5TrTR6svy6DKdf4kMj2jmCiANGTRhtkU1q7dQ=="}
06-13 16:58:23.301 3495 3597 I ESDK-Native: [paho_c_backend.cpp:84] Using 'mqtt' protocol
06-13 16:58:23.301 3495 3597 I ESDK-Native: [paho_c_backend.cpp:131] Using cert file /data/user/0/com.aeg.myaeg/files/root_ca_pem.crt
06-13 16:58:23.301 3495 3597 I ESDK-Native: [paho_c_backend.cpp:136] Creating MQTT client
06-13 16:58:23.291 3495 3495 W RxCachedThreadS: type=1400 audit(0.0:10): avc: denied { getattr } for path="/proc/version" dev="proc" ino=4026532001 scontext=u:r:untrusted_app:s0:c67,c256,c512,c768 tcontext=u:object_r:proc_version:s0 tclass=file permissive=0
06-13 16:58:23.806 3495 3677 I ESDK-Native: [paho_c_backend.cpp:112] Connect success to: mqtt.eu.ecp.electrolux.com:443
06-13 16:58:23.806 3495 3677 I ESDK-Native: [paho_c_backend.cpp:67] (Re)connect success
06-13 16:58:23.808 3495 3677 I ESDK-Native: [paho_c_backend.cpp:176] MQTT Subscribe to 2 topics

but I can't connect with any MQTT client.
This integration don't use api from com.electrolux.oneapp.android.aeg, but com.aeg.myaeg and similar.

@nesheimt
Copy link

Hi @tomeko12
I have successfully used your MQTT-recepie for a year now, but since the whole thing moved to Amazon it stopped. I have used Charlie on the new app an see that there are some new autorization methods and URLs. I think thet use oauth2. First in the process the app goes to gigya.com to get idToken. The idToken is then used along with the "ordinary credintials" to autenticate at the new "Electrolux cloud" resulting in an Authorization(token) that kan be used to GET device metrics at(with the info in the header):

https://api.eu.ocp.electrolux.one/appliance/api/v2/appliances?includeMetadata=false

I hope this can help, but I'm not to skilled(not really at all) in programming take a lead on this.

@nesheimt
Copy link

I can provide URLs and clear text requests and responds with both gigya.com and further with Electrolux-cloud

@Woyken
Copy link
Author

Woyken commented Sep 27, 2023

I was fiddling with the new oneapp API in my fork.

https://github.com/Woyken/pyelectroluxconnect/blob/main/src/pyelectroluxconnect/oneApp/apiClient.py

They are using websockets now, it does work. And seems quite responsive.
I'm wondering if @tomeko12 will want to merge and take on this new API

@tomeko12
Copy link
Owner

Hi.
It's looks like new Elecirolux/AEG OneApp uses another API, than Electrolux Connectivity Platform (ECP) used by pyelectroluxconnect. I think, that this OneAppApi is wrapper, that translate MQTT based ECP Api to more readable form (like pyelectroluxconnect).
In my opinion, OneAppApi is inconpatibile nad totally different from pyelectroluxconnect, and should by written from a scrath. @Woyken, you should publish Your API independly from pyelectroluxconnect, because, in mu opinion implementing it in pyelectoluxconnect make no sense.
It's better to develop Your API, than customize pyelectroluxconnect.

@Woyken
Copy link
Author

Woyken commented Sep 29, 2023

@tomeko12 thanks for your response.
Your point makes sense, it is probably a wrapper API around the original API.
Since the new API seems to have all the features I need, I'll fiddle with this idea on my own then

@tomeko12
Copy link
Owner

tomeko12 commented Oct 7, 2023

@Woyken , You should publish Your API, because I'm worry about that Electrolux will close access to ECP. Old mobile apps still working, but with message "This app is closing down".
I think, that now is good time to move effort to develop OneApp API.

@Woyken
Copy link
Author

Woyken commented Oct 7, 2023

@tomeko12 I'll slowly chip at it whenever I have some spare time. Life got quite busy lately 😅

@Palmke
Copy link

Palmke commented Nov 26, 2023

Hey guys, this is probably more of a question to @Woyken as I cannot create issues in your repository.
I managed to get the WebSocket working. I have noticed that every two hours, the websocket disconnects "abnormally".
Did you also observe this behaviour?

@Woyken
Copy link
Author

Woyken commented Nov 26, 2023

I haven't tried keeping it connected for so long.
I think I'll end up doing some sort of polling and websocket hybrid solution...

@Palmke
Copy link

Palmke commented Nov 26, 2023

I see. The WebSocket is very responsive. As far as I know now it's just for getting updates on the device's status.
Based on the data it sends out I don't see why you need a hybrid solution for reading the status.
Here's a snippet of when I ran a quick 30 min cycle:

{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"applianceState","Value":"READY_TO_START","Timestamp":"2023-11-26T11:58:52Z"},{"Name":"minFinishInTime","Value":68400,"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"TEMPORARY_LOCKED","Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"washingNominalLoadWeight","Value":9000,"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"timeManagerLevel":"NORMAL","analogTemperature":"40_CELSIUS","EWX1493A_wmEconomy":true,"programUID":"COTTON_PR_ECO40-60"},"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fCMiscellaneousState","Value":{"ecoLevel":6},"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fcOptisenseLoadWeight","Value":65408,"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":12600,"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"minFinishInTime","Value":14400,"Timestamp":"2023-11-26T11:58:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"dwywWashData","Value":{"wmLoadWeight":90,"wmLoadMoisture":48,"programUID":"COTTON_PR_ECO40-60"},"Timestamp":"2023-11-26T11:58:53Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"NOT_SAFETY_RELEVANT_ENABLED","Timestamp":"2023-11-26T11:58:56Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"TEMPORARY_LOCKED","Timestamp":"2023-11-26T11:59:24Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"EWX1493A_wmEconomy":false,"programUID":"COTTON_PR_COTTONS"},"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fCMiscellaneousState","Value":{"ecoLevel":255},"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fcOptisenseLoadWeight","Value":65535,"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"analogTemperature":"30_CELSIUS","programUID":"DELICATE_PR_DELICATES","analogSpinSpeed":"800_RPM"},"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fCMiscellaneousState","Value":{"ecoLevel":6},"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fcOptisenseLoadWeight","Value":65408,"Timestamp":"2023-11-26T11:59:25Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":3840,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"minFinishInTime","Value":7200,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"washingNominalLoadWeight","Value":2000,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"programUID":"QUICK_20_MIN_PR_20MIN3KG","analogSpinSpeed":"1200_RPM"},"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1200,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"minFinishInTime","Value":3600,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"washingNominalLoadWeight","Value":3000,"Timestamp":"2023-11-26T11:59:26Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"analogTemperature":"40_CELSIUS"},"Timestamp":"2023-11-26T11:59:27Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1800,"Timestamp":"2023-11-26T11:59:27Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"analogTemperature":"30_CELSIUS"},"Timestamp":"2023-11-26T11:59:27Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1200,"Timestamp":"2023-11-26T11:59:27Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"analogTemperature":"40_CELSIUS"},"Timestamp":"2023-11-26T11:59:28Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1800,"Timestamp":"2023-11-26T11:59:28Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"userSelections","Value":{"analogTemperature":"30_CELSIUS"},"Timestamp":"2023-11-26T11:59:28Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1200,"Timestamp":"2023-11-26T11:59:29Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"dwywWashData","Value":{"wmLoadWeight":30,"wmLoadMoisture":64,"programUID":"QUICK_20_MIN_PR_20MIN3KG"},"Timestamp":"2023-11-26T11:59:30Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"NOT_SAFETY_RELEVANT_ENABLED","Timestamp":"2023-11-26T11:59:33Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorState","Value":"CLOSED","Timestamp":"2023-11-26T12:00:03Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"applianceState","Value":"RUNNING","Timestamp":"2023-11-26T12:00:05Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"WASH","Timestamp":"2023-11-26T12:00:05Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorLock","Value":"UNLOCKING","Timestamp":"2023-11-26T12:00:05Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"TEMPORARY_LOCKED","Timestamp":"2023-11-26T12:00:06Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fCMiscellaneousState","Value":{"optisenseResult":0},"Timestamp":"2023-11-26T12:00:06Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorLock","Value":"ON","Timestamp":"2023-11-26T12:00:06Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"ENABLED","Timestamp":"2023-11-26T12:00:09Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fCMiscellaneousState","Value":{"optisenseResult":2200},"Timestamp":"2023-11-26T12:00:49Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fcOptisenseLoadWeight","Value":65412,"Timestamp":"2023-11-26T12:00:50Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"dwywWashData","Value":{"wmLoadWeight":22,"dwywDataType":"FOR_UPDATE"},"Timestamp":"2023-11-26T12:00:51Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1140,"Timestamp":"2023-11-26T12:03:05Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1080,"Timestamp":"2023-11-26T12:04:35Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1020,"Timestamp":"2023-11-26T12:05:36Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":960,"Timestamp":"2023-11-26T12:06:36Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":900,"Timestamp":"2023-11-26T12:07:36Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":840,"Timestamp":"2023-11-26T12:08:37Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":780,"Timestamp":"2023-11-26T12:09:37Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":720,"Timestamp":"2023-11-26T12:10:37Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"RINSE","Timestamp":"2023-11-26T12:10:47Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":660,"Timestamp":"2023-11-26T12:11:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":540,"Timestamp":"2023-11-26T12:11:48Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":480,"Timestamp":"2023-11-26T12:12:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":420,"Timestamp":"2023-11-26T12:13:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"SPIN","Timestamp":"2023-11-26T12:13:50Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":360,"Timestamp":"2023-11-26T12:13:50Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"dwywWashData","Value":{"dwywDataType":"FOR_TD"},"Timestamp":"2023-11-26T12:13:51Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"DRAIN","Timestamp":"2023-11-26T12:14:19Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"SPIN","Timestamp":"2023-11-26T12:15:03Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":300,"Timestamp":"2023-11-26T12:15:03Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":240,"Timestamp":"2023-11-26T12:16:33Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":180,"Timestamp":"2023-11-26T12:17:34Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":120,"Timestamp":"2023-11-26T12:20:05Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"remoteControl","Value":"NOT_SAFETY_RELEVANT_ENABLED","Timestamp":"2023-11-26T12:20:09Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorLock","Value":"UNLOCKING","Timestamp":"2023-11-26T12:20:17Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"applianceState","Value":"END_OF_CYCLE","Timestamp":"2023-11-26T12:20:17Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"cyclePhase","Value":"UNAVAILABLE","Timestamp":"2023-11-26T12:20:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorLock","Value":"OFF","Timestamp":"2023-11-26T12:20:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":0,"Timestamp":"2023-11-26T12:20:18Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"timeToEnd","Value":1200,"Timestamp":"2023-11-26T12:21:52Z"},{"Name":"applianceState","Value":"READY_TO_START","Timestamp":"2023-11-26T12:21:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"doorState","Value":"OPEN","Timestamp":"2023-11-26T12:21:52Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"fcOptisenseLoadWeight","Value":65408,"Timestamp":"2023-11-26T12:21:52Z"}]}]}}

@Woyken
Copy link
Author

Woyken commented Nov 26, 2023

I thought I might make sense to keep polling every few minutes until device is "online" then websocket. If websocket disconnects, reconnect, but also fetch current status, to make sure we have all the lastest states. Until it's offline. Then keep on polling and waiting for it to be online.

I don't know if all devices from Electrolux are like mine but it take like 2 minutes to connect to wifi after I turn it on. Probably no point in trying to keep websocket alive for that long while the washing machine is offline for 14 hours or so (I have to send a ping command every few minutes to keep it alive)

@Palmke
Copy link

Palmke commented Nov 26, 2023

I agree with the states. Upon starting you should poll /appliance/api/v2/appliances to get the states and then update according to the WS messages. I use that endpoint to resolve the appliance id's based on the nicknames I gave my devices anyway.

I have my appliances set up to stay connected all the time. I have checked the WS, when the device loses connection and I get these messages (timestamps are UTC):

{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"connectivityState","Value":"disconnected","Timestamp":"2023-11-26T13:42:06Z"}]}]}}
{"ConnectionId":"Conn","Api":"STREAM","Version":"2.0","Payload":{"Appliances":[{"ApplianceId":"WM","Metrics":[{"Name":"connectivityState","Value":"connected","Timestamp":"2023-11-26T13:42:44Z"}]}]}}

I think it's less of an engineering effort to keep the WS connected than implementing a polling mechanism for data you'd get from the WS anyway on the side. Of all the API's I have reverse engineered that provide a WS, I try to keep it always open because it provides realtime data as opposed to polling with an interval (for instance when starting my car or network events).

@allistermaguire
Copy link

Electrolux Life app has stopped working, have to use Electrolux app now so the old API is no longer working. There are a couple of projects that have popped up for the Electrolux OCP API for reference.

https://github.com/mafredri/electrolux-ocp
https://github.com/tomekkleszcz/homebridge-electrolux-devices / https://github.com/mafredri/homebridge-electrolux-devices/tree/mafredri/main

@mauro-midolo
Copy link

Ciao @tomeko12 and @Woyken,
let me know updates regarding creating a new python api or update.
I am available for any information regarding home assistant integration.
In case it is needed, please feel free to create pull request within the homeassistant_electrolux_status repo, I will approve as always as soon as possible

@henriec
Copy link

henriec commented Dec 21, 2023

ping (want to follow)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants