tomeko12 / pyelectroluxconnect

A python module to communicate with Elecrolux Connectivity Platform
Apache License 2.0
25 stars 9 forks source link

Unable to set HACL with string values #8

Closed kentora closed 1 year ago

kentora commented 1 year ago

Discovered while messing around with mauro-midolo/homeassistant_electrolux_status#38

Some HACL values require to be set as a string, but in Session.py:682-686 all string are converted to int values. It should be possible to check up against the profile data_format, which in my case is "string" rather than "uint_16".

tomeko12 commented 1 year ago

What is Your Appliance PNC number (9+2 digits)?

kentora commented 1 year ago

According to the library it is these 9 digits: 944188409

kentora commented 1 year ago

... And inside the oven it says the same, but adds / 02

tomeko12 commented 1 year ago

Could You make some tests with curl, and check proper values to send for process change?

  1. Get session_token (replace :EMAIL: and :PASSWORD: with Your credentials):

    curl --request POST \
    --insecure \
    --url https://api.emea.ecp.electrolux.com/authentication/authenticate \
    --header 'Authorization: Basic dXNlcjpwYXNz' \
    --header 'Content-Type: application/json' \
    --header 'x-api-key: 714fc3c7-ad68-4c2f-9a1a-b3dbe1c8bb35' \
    --header 'x-ibm-client-id: 714fc3c7-ad68-4c2f-9a1a-b3dbe1c8bb35' \
    --data $'{
    "brand":"Electrolux",
    "country":"GB",
    "fields":{},
    "deviceId":"012345678901234567890012345678900123456789001234567890012345678900123456",
    "username":":EMAIL:",
    "password":":PASSWORD:"
    }'
  2. Get appliances list (replace :EMAIL: with Your email, :SESSION_KEY: with sessionKey value):

    curl --request GET \
    --insecure \
    --url https://api.emea.ecp.electrolux.com/user-appliance-reg/users/:EMAIL:/appliances \
    --header 'session_token: :SESSION_KEY:' \
    --header 'x-ibm-client-id: 714fc3c7-ad68-4c2f-9a1a-b3dbe1c8bb35'
  3. Send command to appliance (replace :PNC:, :ELC:, :SN:, :MAC: with values from appliances list, :SESSION_KEY: with sessionKey value):

    curl --request POST \
    --insecure \
    --url 'https://api.emea.ecp.electrolux.com/commander/remote/sendjson?pnc=:PNC:&elc=:ELC:&sn=:SN:&mac=:MAC:' \
    --header 'Content-Type: application/json' \
    --header 'session_token: :SESSION_KEY:' \
    --header 'x-ibm-client-id: 714fc3c7-ad68-4c2f-9a1a-b3dbe1c8bb35' \
    --data '{
    "components": [{"name": "1440", "value": "CDC1"}], 
    "destination": "OV1", 
    "operationMode": "EXE", 
    "source": "RP1", 
    "timestamp": "1672416228", 
    "version": "ad"
    }'

    Try to set proper "value", that chenge setting in appliance.

kentora commented 1 year ago

I'm not quite sure what this would accomplish, that I haven't already? I have successfully changed the OvenProcess, by commenting out the part that converts to integer (thus sending the raw string). This works flawlessly.

tomeko12 commented 1 year ago

Is "CDC1", and "0xCDC1" as value works?

kentora commented 1 year ago

"CDC1" as it is also represented in the profile

tomeko12 commented 1 year ago

Updated in 0.3.11, please test it.

kentora commented 1 year ago

Works like a charm! Ty very much