webdjoe / pyvesync

pyvesync is a python library to manage Etekcity & Levoit smart devices
MIT License
170 stars 80 forks source link

COSORI Smart WiFi Air Fryer 5.5L Air Fryer #55

Open brianrossmeisl opened 4 years ago

brianrossmeisl commented 4 years ago

I am new to home Assistant and was trying to track if there was an integration with pyvesync to the "COSORI Smart WiFi Air Fryer 5.8QT(100 Recipes), 1700-Watt Programmable Base for Air Frying, Roasting & Keep Warm 11 Cooking Preset,Preheat&Shake Remind". My wife uses it with VeSync all the time.

https://www.amazon.com/COSORI-1700-Watt-Programmable-Roasting-Touchscreen/dp/B07VLKMMJ5 I would love to help spec the function calls but do not know the best way to trace the app. It appears to preload cooking temperature, times, and a "shake reminder". It seems like a fun thing to get going to me. Let me know if you are interested.

JerTeske commented 4 years ago

I too am interested in this integration. Would love push notifications and led color changes when food is done

webdjoe commented 3 years ago

If you capture the packets I will work on this

justinmartin commented 3 years ago

webdjoe What would you need captured to work on this?

webdjoe commented 3 years ago

You can use a packet capture app, Packet Capture works for me and you don't need to root the device, to capture all of the associated packets with the vesync device. So you would start packet capture, go to VeSync, get the device list, go to the device and run each function possible. You can then stop the Packet Capture app and download all of the associated packets from the app. Upload them here and please redact your token and account id. That is unless you want your VeSync devices to become possessed 😉

scruffynerf commented 3 years ago

Just got a Cosori Smart Oven, same sort of thing. I'll capture the packets for that. Would love to see Home Assistant controlling it eventually.

fmartingr commented 3 years ago

I'm considering buying a Cosori with wifi capabilities as well. Have been any progress on this? If I end up buying it I can provide packet capture as well and help with this (with some guidance probably).

scruffynerf commented 3 years ago

Haven't had a chance to do a packet capture yet...however, I have noticed something interesting: control via the phone app is NOT as good in some ways as the Alexa control. Asking Alexa allows you to do things easier (no button push required) than the vesync app. Strangely the Google Assistant control isn't as good as either. So if we do some packet capture, might be worthwhile seeing if we can replicate the best method(s) of control.

For example, Alexa can't control the Toast level, only invoke Toast.

webdjoe commented 3 years ago

Haven't gotten any packet captures for this yet but I have two more devices that I am working on so it will be some time before I can get to this. Generally, interfacing with Alexa skills from python is not that simple. The HA Component Hue Emulator is an example but has very limited functionality. There is also the paid subscription based Nabu Casa for Home Assistant that gives you a more robust interface with Alexa but you wouldn't need the pyvesync library for that. The vesync api is managed directly by Alexa in those cases.

Try to upgrade the device firmware and app and play around as much as possible with the controls while capturing the packets. Another more painful and probably less fruitful option is to decompile the APK and read through the code to see if there are any API calls for this device that aren't shown in the apps interface.

If you would like me to develop this, feel free to shoot the captures over to my email webdjoe 'AT' gmail.com

On Fri, Jan 22, 2021 at 2:51 PM scruffynerf notifications@github.com wrote:

Haven't had a chance to do a packet capture yet...however, I have noticed something interesting: control via the phone app is NOT as good in some ways as the Alexa control. Asking Alexa allows you to do things easier (no button push required) than the vesync app. Strangely the Google Assistant control isn't as good as either. So if we do some packet capture, might be worthwhile seeing if we can replicate the best method(s) of control.

For example, Alexa can't control the Toast level, only invoke Toast.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/markperdue/pyvesync/issues/55#issuecomment-765647205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6JJBTWIPA66XFBPW54A7TS3HJMLANCNFSM4NJ233QQ .

BKrnk1337 commented 3 years ago

Hello - one question. Do you still work on the implementation?

webdjoe commented 3 years ago

I was sent a few packet captures for this and I started but they were incomplete. Once I receive all captures from the device list forward I'll work on this further.

Infiniski commented 3 years ago

Webdjoe are you in the home assistant Facebook page?

I've opened up a post about this air fryer and I'm sure a couple of us there will help you out get those packets.

I downloaded the packet app and ran the VESYNC app, however when I tried to connect to the air fryer the VPN was blocking it or something?

urechi commented 2 years ago

Hey @webdjoe ,

I am not a dev but I work in the cyber security area and I am happy to help with some traffic captures for the COSORI Smart WiFi Air Fryer 5.5L.

Get status request:

POST /cloud/v1/deviceManaged/bypass HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 497
Connection: close

{
  "pid": "8t8o******lsbosm",
  "appVersion": "VeSync 3.1.52 build9",
  "acceptLanguage": "en",
  "jsonCmd": {
    "getStatus": "status"
  },
  "phoneBrand": "iPhone 12 Pro",
  "traceId": "1638456091583",
  "timeZone": "Europe/London",
  "userCountryCode": "GB",
  "accountID": "2*****1",
  "uuid": "92e3e134-****-4216-****-65c7656bcf3b",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "cid": "0MCk86********Hg65mzxlE-6vcTp",
  "phoneOS": "iOS 15.1.1",
  "method": "bypass",
  "debugMode": false
}

Status responses

standby: No cooking at all.

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 14:46:34 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 98

{
  "traceId": "1638456091583",
  "code": 0,
  "msg": null,
  "result": {
    "returnStatus": {
      "cookStatus": "standby"
    }
  }
}

pullOut: Baskets are not pushed in all the way.

{
  "traceId": "1638454636576",
  "code": 0,
  "msg": null,
  "result": {
    "returnStatus": {
      "cookStatus": "pullOut"
    }
  }
}

cooking: Cooking in progress

{
  "traceId": "1638459417561",
  "code": 0,
  "msg": null,
  "result": {
    "returnStatus": {
      "curentTemp": 32,
      "cookSetTemp": 175,
      "mode": "custom",
      "cookSetTime": 15,
      "cookLastTime": 15,
      "cookStatus": "cooking",
      "tempUnit": "celsius",
      "accountId": "2*****1",
      "customRecipe": "Manual"
    }
  }
}

cookStop - While you are cooking something and you press pause in the app:

{
  "traceId": "1638457432788",
  "code": 0,
  "msg": null,
  "result": {
    "returnStatus": {
      "curentTemp": 38,
      "cookSetTemp": 175,
      "mode": "custom",
      "cookSetTime": 15,
      "cookLastTime": 15,
      "cookStatus": "cookStop",
      "tempUnit": "celsius",
      "accountId": "2*****1",
      "customRecipe": "Manual"
    }
  }
}

Initiate a manual cooking

POST /cloud/v1/deviceManaged/bypass HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 695
Connection: close

{
  "accountID": "2*****1",
  "traceId": "1638456459244",
  "cid": "0MCk86********Hg65mzxlE-6vcTp",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "timeZone": "Europe/London",
  "acceptLanguage": "en",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "userCountryCode": "GB",
  "debugMode": false,
  "method": "bypass",
  "uuid": "92e3e134-****-4216-****-65c7656bcf3b",
  "jsonCmd": {
    "cookMode": {
      "cookStatus": "cooking",
      "mode": "custom",
      "cookSetTime": 15,
      "tempUnit": "celsius",
      "cookSetTemp": 175,
      "customRecipe": "Manual",
      "accountId": "2*****1",
      "recipeId": 1,
      "appointmentTs": 0,
      "readyStart": false,
      "recipeType": 1
    }
  },
  "phoneBrand": "iPhone 12 Pro",
  "pid": "8t8o******lsbosm",
  "phoneOS": "iOS 15.1.1",
  "appVersion": "VeSync 3.1.52 build9"
}

Successful response, where the air fryer started to cook:

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 15:47:25 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 74

{
  "traceId": "1638456459244",
  "code": 0,
  "msg": "cookMode set ok",
  "result": null
}

A failed response, The baskets are not pushed in all the way. Please secure them to start cooking.

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 14:17:11 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 83

{
  "traceId": "1638454631216",
  "code": 11901000,
  "msg": "cookMode set fail",
  "result": null
}

Pause the cooking:

POST /cloud/v1/deviceManaged/bypass HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 509
Connection: close

{
  "cid": "0MCk86********Hg65mzxlE-6vcTp",
  "traceId": "1638456308273",
  "uuid": "92e3e134-****-4216-****-65c7656bcf3b",
  "userCountryCode": "GB",
  "method": "bypass",
  "phoneOS": "iOS 15.1.1",
  "acceptLanguage": "en",
  "jsonCmd": {
    "cookMode": {
      "cookStatus": "stop"
    }
  },
  "appVersion": "VeSync 3.1.52 build9",
  "accountID": "2*****1",
  "phoneBrand": "iPhone 12 Pro",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "pid": "8t8o******lsbosm",
  "timeZone": "Europe/London",
  "debugMode": false,
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw=="
}

Successful response:

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 15:47:33 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 74

{
  "traceId": "1638456308273",
  "code": 0,
  "msg": "cookMode set ok",
  "result": null
}

Failed response:

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:03:24 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 83

{
  "traceId": "1638456308273",
  "code": 11901000,
  "msg": "cookMode set fail",
  "result": null
}

Resume or continue the cooking after a pause:

POST /cloud/v1/deviceManaged/bypass HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 512
Connection: close

{
  "traceId": "1638461430107",
  "pid": "8t8o******lsbosm",
  "timeZone": "Europe/London",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "appVersion": "VeSync 3.1.52 build9",
  "phoneOS": "iOS 15.1.1",
  "uuid": "92e3e134-****-4216-****-65c7656bcf3b",
  "accountID": "2*****1",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "jsonCmd": {
    "cookMode": {
      "cookStatus": "cooking"
    }
  },
  "phoneBrand": "iPhone 12 Pro",
  "cid": "0MCk86********Hg65mzxlE-6vcTp",
  "method": "bypass",
  "userCountryCode": "GB",
  "debugMode": false,
  "acceptLanguage": "en"
}

Successful response:

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:10:30 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 74

{
  "traceId": "1638461430107",
  "code": 0,
  "msg": "cookMode set ok",
  "result": null
}

Failed response:

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:14:54 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 83

{
  "traceId": "1638461693432",
  "code": 11901000,
  "msg": "cookMode set fail",
  "result": null
}

End the cooking:

POST /cloud/v1/deviceManaged/bypass HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 508
Connection: close

{
  "accountID": "2*****1",
  "timeZone": "Europe/London",
  "phoneBrand": "iPhone 12 Pro",
  "userCountryCode": "GB",
  "jsonCmd": {
    "cookMode": {
      "cookStatus": "end"
    }
  },
  "debugMode": false,
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "cid": "0MCk86********Hg65mzxlE-6vcTp",
  "uuid": "92e3e134-****-4216-****-65c7656bcf3b",
  "method": "bypass",
  "pid": "8t8o******lsbosm",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "traceId": "1638456337118",
  "phoneOS": "iOS 15.1.1",
  "appVersion": "VeSync 3.1.52 build9",
  "acceptLanguage": "en"
}

Successful and failed responses are the same as when you pause the cooking.

Apologies for the long comment! If you need anything else please let me know.

urechi commented 2 years ago
POST /cloud/v2/deviceManaged/getFirmwareUpdateInfoList HTTP/1.1
Host: smartapi.vesync.com
Tz: Europe/London
Content-Type: application/json
Accept: */*
Tk: p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==
Accountid: 2******1
Content-Length: 442
User-Agent: VeSync/3.1.52 (iPhone; iOS 15.1.1; Scale/3.00)
Accept-Language: en
Accept-Encoding: gzip, deflate
Connection: close

{
  "userCountryCode": "GB",
  "phoneOS": "iOS 15.1.1",
  "acceptLanguage": "en",
  "phoneBrand": "iPhone 12 Pro",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "timeZone": "Europe/London",
  "traceId": "1638463323221",
  "cidList": [
    "0MVz0ePMG8*********D2otJoGYR",
    "0MVyh25XIH2K*********_Hi64sb3AX",
    "0MCk86avk94********mzxlE-6vcTp"
  ],
  "appVersion": "VeSync 3.1.52 build9",
  "accountID": "2******1",
  "macIDList": [],
  "method": "getFirmwareUpdateInfoList"
}

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:42:03 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 1837

{
  "traceId": "1638463323221",
  "code": 0,
  "msg": "request success",
  "result": {
    "cidFwInfoList": [
      {
        "deviceCid": "0MVz0ePMG8*********D2otJoGYR",
        "deviceName": "Kitchen Air Purifier",
        "deviceImg": "https://image.vesync.com/defaultImages/LV_PUR131S_Series/icon_131_air_purifier_80.png",
        "uuid": "17e60652-6077-****-****-11069e5c2c26",
        "configModule": "AirPurifier131",
        "connectionType": "wifi",
        "macID": "",
        "deviceRegion": "US",
        "code": 0,
        "msg": null,
        "firmUpdateInfos": [
          {
            "upgradeLevel": 0,
            "latestVersionUrl": null,
            "partFirmwareVersionUrl": null,
            "currentVersion": "2.0.58",
            "latestVersion": null,
            "releaseNotes": null,
            "pluginName": "mainFw",
            "priority": 1,
            "upgradeTimeoutInSec": 120,
            "isMainFw": true
          }
        ]
      },
      {
        "deviceCid": "0MVyh25XIH2K*********_Hi64sb3AX",
        "deviceName": "Master Bedroom Air Purifier",
        "deviceImg": "https://image.vesync.com/defaultImages/LV_PUR131S_Series/icon_131_air_purifier_80.png",
        "uuid": "bdb182e1-eea1-*****-******-1cd7fd821559",
        "configModule": "AirPurifier131",
        "connectionType": "wifi",
        "macID": "",
        "deviceRegion": "US",
        "code": 0,
        "msg": null,
        "firmUpdateInfos": [
          {
            "upgradeLevel": 0,
            "latestVersionUrl": null,
            "partFirmwareVersionUrl": null,
            "currentVersion": "2.0.58",
            "latestVersion": null,
            "releaseNotes": null,
            "pluginName": "mainFw",
            "priority": 1,
            "upgradeTimeoutInSec": 120,
            "isMainFw": true
          }
        ]
      },
      {
        "deviceCid": "0MCk86avk94********mzxlE-6vcTp",
        "deviceName": "Kitchen Air Fryer",
        "deviceImg": "https://image.vesync.com/defaultImages/CS158_AF_Series/airfryer_80.png",
        "uuid": "92e3e134-e419-*****-*****-65c7656bcf3b",
        "configModule": "WiFi_AirFryer_CS158-AF_EU",
        "connectionType": "wifi",
        "macID": "",
        "deviceRegion": "EU",
        "code": 0,
        "msg": null,
        "firmUpdateInfos": [
          {
            "upgradeLevel": 0,
            "latestVersionUrl": null,
            "partFirmwareVersionUrl": null,
            "currentVersion": "1.0.06",
            "latestVersion": null,
            "releaseNotes": null,
            "pluginName": "mainFw",
            "priority": 1,
            "upgradeTimeoutInSec": 120,
            "isMainFw": true
          }
        ]
      }
    ],
    "macIDFwInfoList": null
  }
}
POST /cloud/v1/homeManaged/getHomeDeviceStatus HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 514
Connection: close

{
  "userCountryCode": "GB",
  "phoneBrand": "iPhone 12 Pro",
  "deviceList": [
    {
      "cid": "0MVz0ePMG8*********D2otJoGYR",
      "subDeviceNo": 0
    },
    {
      "cid": "0MVyh25XIH2K*********_Hi64sb3AX",
      "subDeviceNo": 0
    },
    {
      "subDeviceNo": 0,
      "cid": "0MCk86avk94********mzxlE-6vcTp"
    }
  ],
  "debugMode": false,
  "method": "getHomeDeviceStatus",
  "acceptLanguage": "en",
  "traceId": "1638463353181",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "appVersion": "VeSync 3.1.52 build9",
  "accountID": "2******1",
  "phoneOS": "iOS 15.1.1",
  "timeZone": "Europe/London"
}

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:42:33 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 630

{
  "traceId": "1638463353181",
  "code": 0,
  "msg": "request success",
  "result": {
    "deviceList": [
      {
        "cid": "0MVz0ePMG8*********D2otJoGYR",
        "subDeviceNo": 0,
        "currentFirmVersion": "2.0.58",
        "deviceStatus": "off",
        "connectionStatus": "online",
        "mode": "auto",
        "speed": null,
        "extension": null
      },
      {
        "cid": "0MVyh25XIH2K*********_Hi64sb3AX",
        "subDeviceNo": 0,
        "currentFirmVersion": "2.0.58",
        "deviceStatus": "off",
        "connectionStatus": "online",
        "mode": "auto",
        "speed": null,
        "extension": null
      },
      {
        "cid": "0MCk86avk94********mzxlE-6vcTp",
        "subDeviceNo": 0,
        "currentFirmVersion": "1.0.06",
        "deviceStatus": "off",
        "connectionStatus": "online",
        "mode": null,
        "speed": null,
        "extension": null
      }
    ]
  }
}
POST /cloud/v2/deviceManaged/configurationsV2 HTTP/1.1
Host: smartapi.vesync.com
Accept: */*
Content-Type: application/json
Accept-Encoding: gzip, deflate
User-Agent: VeSync/3.1.52 (com.etekcity.vesyncPlatform; build:9; iOS 15.1.1) Alamofire/5.2.1
Accept-Language: en-GB;q=1.0, ro-US;q=0.9
Content-Length: 423
Connection: close

{
  "method": "configurationsV2",
  "appVersion": "VeSync 3.1.52 build9",
  "phoneOS": "iOS 15.1.1",
  "token": "p5RD57Vgczk-Nrg_**********_YKjd0vKMEIIYUrf1ZywA5Vw==",
  "acceptLanguage": "en",
  "debugMode": false,
  "traceId": "1638463406174",
  "deviceRegion": "EU",
  "accountID": "2******1",
  "timeZone": "Europe/London",
  "configModule": "WiFi_AirFryer_CS158-AF_EU",
  "phoneBrand": "iPhone 12 Pro",
  "cid": "0MCk86avk94********mzxlE-6vcTp",
  "userCountryCode": "GB"
}

HTTP/1.1 200 
Date: Thu, 02 Dec 2021 16:43:26 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Content-Length: 1010

{
  "traceId": "1638463406174",
  "code": 0,
  "msg": "request success",
  "result": {
    "deviceName": "Kitchen Air Fryer",
    "deviceImg": "https://image.vesync.com/defaultImages/CS158_AF_Series/airfryer_80.png",
    "defaultDeviceImg": "https://image.vesync.com/defaultImages/CS158_AF_Series/airfryer_80.png",
    "allowNotify": "on",
    "currentFirmVersion": "1.0.06",
    "latestFirmVersion": "1.0.06",
    "deviceStatus": "off",
    "connectionStatus": "online",
    "ownerShip": true,
    "rssi": -58,
    "wifiName": null,
    "macID": "c8:**:96:**:15:**",
    "wifiMacID": "c8:**:96:**:15:**",
    "btMacID": null,
    "cid": "0MCk86avk94********mzxlE-6vcTp",
    "uuid": "92e3e134-e419-*****-*****-65c7656bcf3b",
    "configModule": "WiFi_AirFryer_CS158-AF_EU",
    "connectionType": "wifi",
    "firmwareUrl": "http://fw.vesync.com/WiFi_AirFryer_CS158-AF_EU/v1.0.06/",
    "outletInfo": null,
    "switchInfo": null,
    "hygrometerInfo": null,
    "airPurifierInfo": null,
    "subDevices": null,
    "airFryerInfo": {
      "tempUnit": 2,
      "workTempUnit": "c"
    },
    "meatThermometerInfo": null,
    "humidifierInfo": null,
    "ovenInfo": null,
    "deviceRegion": "EU",
    "deviceType": "CS158-AF"
  }
}
eddyliao commented 2 years ago

@urechi Can you tell me how did you manage to sniff this? Im using fiddler with a android emulator but i cant get the app to connect

urechi commented 2 years ago

@eddyliao I am using Burp Suite with my IOS device. You can follow this guide for android.

webdjoe commented 2 years ago

I use the Packet Capture app on android. You have to install a custom certificate so make so you uninstall both app and certificate when you are done - https://github.com/webdjoe/pyvesync#feature-requests

eddyliao commented 2 years ago

hi thanks for the replies, i tried the packet capture app and nox as well (i also tried other android emulators) Nothing seems to work. I am able to sniff other packets but when i open the vesync app, i dont see any device. When i remove the proxy info from the wifi settings, everything seems to work fine afterwards

Tried root and installed the certificate correctly as well

urechi commented 2 years ago

I usually have issues when there is ssl certificate pinning implemented but I doubt they've done it for Android and not for the IOS app.

timtimmahh commented 2 years ago

This seems like a good option to get it working, however I'm really not a fan of the cloud-based requirements of VeSync devices. I've got a Corsori Smart Wifi Toaster Oven/Air Fryer (CS130-A0) and it looks like it uses an ESP32 microprocessor for WiFi/Bluetooth connectivity (and hopefully also controls the device itself). Looking at the FCC images, it looks like the JTAG interface is exposed, so using a JTAG programmer it might be possible to obtain/modify the device's firmware (or completely make it from scratch) and use that to make it locally controlled as well. If all Cosori devices work similarly, it might be possible to create a bunch of custom firmware for the devices in order to provide what VeSync won't provide (such as support for the upcoming Matter protocol later this year).

When I have time, I'll take apart my Cosori device and see if this is actually possible.

TRusselo commented 2 years ago

hope to see progress on this too

rdlvm commented 2 years ago

Hi, has anyone managed to install Tasmota on AirFryer Wifi? That would be great and maybe make things easier.

webdjoe commented 2 years ago

This will be in the next release!

In terms of Tasmota, I don't know much but would love to hear if you have any success.

rdlvm commented 2 years ago

This will be in the next release!

In terms of Tasmota, I don't know much but would love to hear if you have any success.

It would be great to be able to install Tasmota on it, but I don't know if it actually allows it.

When will Cosori airfryer compatible integration launch?

eddyliao commented 2 years ago

Quick update on this I was not able to successfully get the states of the air fryer Also i noticed that it would be not a good idea to try simulating sending command coming from an android device as well This is because whatever you do, you will have to manually press start on the air fryer for it to start

So instead i decided to emulate a google home command and it works for turning it on/off (however only able to use common preset built in only). Doing it this way, you dont have to manually press the button on the air fryer for it to start

timtimmahh commented 2 years ago

Update on accessing the ESP32 board in Cosori devices. I haven't been able to get the JTAG programmer to work with the ESP32 board, but I found a workaround using the serial communication between the ESP32 and the main control board (LCD/button board). It appears that the control board sends the current state of the device any time something changes (ie. rotating function nob, toggling light/fan, etc). I haven't been able to decode the entire output, but was able to get some useful information.

Hex output: A5 22 30 1E 00 3B 01 26 40 00 07 00 00 00 03 F1 01 C2 01 84 03 00 00 02 01 01 00 00 00 00 00 00 00 00 00 00

example data num bytes byte range info
A5 22 30 1E 00 3B 01 26 40 00 07 00 00 00 14 0-14 seemingly random or possibly a timestamp
03 1 15 the current function, on mine it goes up to 12 or 0C (12 total functions)
F1 01 2 16-17 unknown data, possibly temperature unit setting or wifi status?
C2 01 2 18-19 the current temperature (decimal)
84 03 2 20-21 the current timer (seconds)
00 00 2 22-23 unknown setting (again maybe temp unit/wifi?)
02 1 24 fan setting (0=off, 1=normal fan, 2=high speed fan)
01 1 25 light setting (0=off, 1=on)
01 1 26 unknown setting (again maybe temp unit?)
00 00 00 00 00 00 00 00 00 00 10 27-36 unknown data (possibly just excess serial data)

Still investigating this further, but I think this shows a lot of potential.

Edit: In case anyone wants to know the configuration I used to obtain this, I connected an ESP32 (a USB to TTL adapter also works) to the control board from the oven over it's exposed serial port (see photo 8). The serial configuration I used is 9600-8-N-1 (baud-data bits-parity-stop bits). Also, it's important to know that the serial output is in little-endian and must be converted to big-endian to get the correct values. For example, the temperature data above is represented as C2 01 which is 49665 in decimal, whereas 01 C2 is 450, which is exactly what is displayed on the LCD.

sofakng commented 2 years ago

I'm also looking forward to this!

danyknight commented 2 years ago

Is this still something that is being considered?

webdjoe commented 2 years ago

Yes, this is in the works. I've just been short on free time lately.

janpgu commented 2 years ago

Thanks a lot for your work on this @webdjoe ! Really looking forward to integrating the Cosori with Home Assistant. Do you have rough idea when the next release with this feature might come out?

saundersrg commented 2 years ago

I know this is a thread for Air Fryers, but any thoughts on the Cosori Kettles as well?

KyleStilkey commented 2 years ago

I'm also hoping we see this soon. Would love to integrate this with Home Assistance.

Xelinor commented 2 years ago

Oh sweet, I was literally just gifted one of these air fryers earlier today. Glad to see it's in the works! 😁♥️

zx81uk commented 2 years ago

I’m also interested in a solution for this

austin202220 commented 2 years ago

Im interested in this too. I installed the integration into HA but no devices show. I want to be able to set the temperature of my COSORI Electric Gooseneck Kettle. I am happy to provide testing or anything else anyone may need to assist this project.

https://www.amazon.com/COSORI-Electric-Gooseneck-Temperature-Kettle/dp/B08BFS92RP

smenzer commented 2 years ago

really looking forward to this one, too, @webdjoe. If there's anything I can do to help, please let me know.

joshms123 commented 1 year ago

Also interested in this. If there is anything I can do (how to capture packets ETC) let me know.

rtech73 commented 1 year ago

Just bought one of these and would love to have communication in HA. Happy to help where I can!

webdjoe commented 1 year ago

I have the packet captures, I am just trying to model the best way to build this and given some limitations, if it is even worth it. Would love to get everyone's thoughts:

  1. The unit cannot be directly started via the api, you can trigger it but someone has to physically press the start button to start the fryer. I haven't found any way around this, so IMHO that makes the API less useful
  2. There is no callback or event hook for the cooking to be finished. The App handles all of the timing and notification internally by getting the status. So essentially, the main functionality of the library would be to get the status of the air fryer. Is this everyone's primary goal?
  3. Does anyone want to use the recipe functionality?
  4. A minor note is there is a new key pid which I haven't been able to figure out where this comes from, it is never returned from the API. I tried to do bitwise operations on the cid, uuid & mac id but haven't had any luck. The API does work without it currently but I wonder if it might not one day.
smenzer commented 1 year ago

Great progress!

For me, the point of the library (and further, the integration into home assistant) is mostly to get the status of the air fryer, and once it's cooking, adjust time/temp and enable/disable "shake".

  1. that's how the Vesync app works, too (must be a safety feature), so I don't think that's a game changer.
  2. I guess you'd have to rely on polling instead, then, right? status is the main point for me, so this would work
  3. Is this the equivalent of pressing one of the pre-programmed buttons? I suppose it would be nice to activate those (even if you still have to click the "start" button), but to me it's not a big requirement

Thanks for the work on this so far!

ctoth commented 1 year ago

I agree this is excellent! I am also mostly looking for something that retrieves status. It seems like a firmware limitation that we can't bypass to start cooking without being in front of the machine, which really isn't the worst thing. IF you could expose the existing gated cook functionality someone could always rig up a Switchbot to trigger the button if they wanted truly automated cooking.

At the end of the day I just want my Home Assistant tTS integration to be able to tell me to come get my food :) so please just share what you have and we can always iterate on it!

eddyliao commented 1 year ago

Hi just want to let u guys know that if you use a google assistant routine. It bypass the button press So one could use the google assistant relay addon to simulate the cooking process

On Thu, Sep 22, 2022, 1:14 AM Christopher Toth @.***> wrote:

I agree this is excellent! I am also mostly looking for something that retrieves status. It seems like a firmware limitation that we can't bypass to start cooking without being in front of the machine, which really isn't the worst thing. IF you could expose the existing gated cook functionality someone could always rig up a Switchbot to trigger the button if they wanted truly automated cooking.

At the end of the day I just want my Home Assistant tTS integration to be able to tell me to come get my food :) so please just share what you have and we can always iterate on it!

— Reply to this email directly, view it on GitHub https://github.com/webdjoe/pyvesync/issues/55#issuecomment-1254538820, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWXHEM7BRVEHM6OHGBJZLDV7PTNDANCNFSM4NJ233QQ . You are receiving this because you were mentioned.Message ID: @.***>

Subia75 commented 1 year ago

Hi everyone, I got an air fryer too, and found this thread. It sounds like a great job and I would love to try it out.

I leave my thoughts about the questions.

I think it is already interesting to monitor the status, in case you are not close and you do not hear the beep, you can be viewed by eg a google home or echo dot. For me, starting it is one more thing, it could be useful to start a cooking before arriving home from work

rtech73 commented 1 year ago

Not being able to start the device remotely is not a deal breaker. There is a school of thought that says that shouldn’t be a thing you can do. Plus, it’s just a button, so if someone really wanted to, they could (SwitchBot anyone?).

But, to be able to have the status of what’s happening with the Fryer available to Home Assistant for notifications, other automations, would be really sweet. I have a smart washer and dryer and dishwasher, and none of them can be started with their app or HA, but the data provided to HA really helps in the overall possibilities of a fully smart home. I love the work that’s happening here!

Basically, if we can get HA to be able to do most of what the VeSync app can do, that would be terrific! Looks like that is within reach!

On September 21, 2022 at 10:58:58 PM, Scott Menzer @.***) wrote:

Great progress!

For me, the point of the library (and further, the integration into home assistant) is mostly to get the status of the air fryer, and once it's cooking, adjust time/temp and enable/disable "shake".

  1. that's how the Vesync app works, too (must be a safety feature), so I don't think that's a game changer.
  2. I guess you'd have to rely on polling instead, then, right? status is the main point for me, so this would work
  3. Is this the equivalent of pressing one of the pre-programmed buttons? I suppose it would be nice to activate those (even if you still have to click the "start" button), but to me it's not a big requirement

Thanks for the work on this so far!

— Reply to this email directly, view it on GitHub https://github.com/webdjoe/pyvesync/issues/55#issuecomment-1254456614, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALLHS7N5LSQEQTX4BFYKIPDV7PDPFANCNFSM4NJ233QQ . You are receiving this because you commented.Message ID: @.***>

KyleStilkey commented 1 year ago

I think for me and I see others so far just at least having the ability to see the devices status would be great, if you can implement the recipe that would be cool and I have no issue setting then pressing the button myself, but at least being able to see the status and change temps/time and other functions as it cooks would be a great function to have.

SHadley1138 commented 1 year ago

Fantastic!

On 24 Mar 2022, at 03:21, Joe Trabulsy @.***> wrote:

 This will be in the next release!

In terms of Tasmota, I don't know much but would love to hear if you have any success.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

Zwordi commented 1 year ago

Update on accessing the ESP32 board in Cosori devices. I haven't been able to get the JTAG programmer to work with the ESP32 board, but I found a workaround using the serial communication between the ESP32 and the main control board (LCD/button board). It appears that the control board sends the current state of the device any time something changes (ie. rotating function nob, toggling light/fan, etc). I haven't been able to decode the entire output, but was able to get some useful information.

Hex output: A5 22 30 1E 00 3B 01 26 40 00 07 00 00 00 03 F1 01 C2 01 84 03 00 00 02 01 01 00 00 00 00 00 00 00 00 00 00

example data num bytes byte range info A5 22 30 1E 00 3B 01 26 40 00 07 00 00 00 14 0-14 seemingly random or possibly a timestamp 03 1 15 the current function, on mine it goes up to 12 or 0C (12 total functions) F1 01 2 16-17 unknown data, possibly temperature unit setting or wifi status? C2 01 2 18-19 the current temperature (decimal) 84 03 2 20-21 the current timer (seconds) 00 00 2 22-23 unknown setting (again maybe temp unit/wifi?) 02 1 24 fan setting (0=off, 1=normal fan, 2=high speed fan) 01 1 25 light setting (0=off, 1=on) 01 1 26 unknown setting (again maybe temp unit?) 00 00 00 00 00 00 00 00 00 00 10 27-36 unknown data (possibly just excess serial data) Still investigating this further, but I think this shows a lot of potential.

Edit: In case anyone wants to know the configuration I used to obtain this, I connected an ESP32 (a USB to TTL adapter also works) to the control board from the oven over it's exposed serial port (see photo 8). The serial configuration I used is 9600-8-N-1 (baud-data bits-parity-stop bits). Also, it's important to know that the serial output is in little-endian and must be converted to big-endian to get the correct values. For example, the temperature data above is represented as C2 01 which is 49665 in decimal, whereas 01 C2 is 450, which is exactly what is displayed on the LCD.

Any news regarding your work ? I’m wondering to buy one, my wife is not into the app stuff so why not using an Tasmota/esphome support :).

Thanks,

Subia75 commented 1 year ago

Hi, there are updates on that, the implementation of air fryers. For what little I can do if I need some help I can do some tests if you tell me how

KyleStilkey commented 1 year ago

Love to hear any update on this, I'd be willing to help out if needed or do any testing.

grewhit25 commented 1 year ago

Same 👍

webdjoe commented 1 year ago

I will have a working branch for the Air Fryer 158 and 138 very soon but if someone wants to capture packets on any of the other devices, I am happy to add it