simbaja / gehome

Python SDK for GE smart appliances
MIT License
42 stars 29 forks source link

Air Fry Mode Support #26

Closed jrobinson041 closed 3 years ago

jrobinson041 commented 3 years ago

Looking through the oven cook mode files, it doesn't seem as though the newer "Air Fry" option is supported. This would be a great feature to add.

simbaja commented 3 years ago

Shouldn't be a problem to add it. Any chance you can run the websocket_example and setting the oven to the air fry mode so I can see the underlying values that need to be set?

jrobinson041 commented 3 years ago
{
  "kind": "websocket#api",
  "id": "D828C9455538-allErd",
  "request": {
    "host": "api.brillion.geappliances.com",
    "method": "GET",
    "path": "/v1/appliance/D828C9455538/erd"
  },
  "success": true,
  "code": 200,
  "body": {
    "kind": "appliance#erdList",
    "userId": "",
    "applianceId": "D828C9455538",
    "items": [
      {
        "erd": "0x0001",
        "value": "0C50545337303030534E32535300000000000000000000000000000000000000",
        "time": "2021-08-17T20:15:20.044Z"
      },
      {
        "erd": "0x0002",
        "value": "0B534E5352303730313337510000000000000000000000000000000000000000",
        "time": "2021-08-17T20:15:20.044Z"
      },
      { "erd": "0x0006", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x0007", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x0008", "value": "07", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x0009", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x000A", "value": "01", "time": "2021-08-17T20:15:20.044Z" },
      {
        "erd": "0x0100",
        "value": "00000253",
        "time": "2021-08-17T20:15:20.044Z"
      },
      {
        "erd": "0x0101",
        "value": "00000000",
        "time": "2021-08-17T20:15:20.044Z"
      },
      { "erd": "0x0105", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      {
        "erd": "0x0106",
        "value": "00000535",
        "time": "2021-08-17T20:15:20.044Z"
      },
      {
        "erd": "0x0107",
        "value": "00000000",
        "time": "2021-08-17T20:15:20.044Z"
      },
      { "erd": "0x0108", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5000", "value": "01", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5001", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5003", "value": "01", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5007", "value": "08C0", "time": "2021-08-17T20:15:20.044Z" },
      {
        "erd": "0x5008",
        "value": "022600AA",
        "time": "2021-08-17T20:15:20.044Z"
      },
      {
        "erd": "0x5100",
        "value": "9E019000000000000000000000",
        "time": "2021-08-18T19:31:06.853Z"
      },
      { "erd": "0x5101", "value": "5A", "time": "2021-08-18T19:31:06.883Z" },
      { "erd": "0x5102", "value": "0000", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5103", "value": "0000", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5104", "value": "0000", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5105", "value": "002D", "time": "2021-08-18T19:30:23.116Z" },
      { "erd": "0x5106", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5107", "value": "00", "time": "2021-08-17T20:15:20.044Z" },
      { "erd": "0x5108", "value": "0000", "time": "2021-08-18T19:31:06.883Z" },
      { "erd": "0x5109", "value": "0190", "time": "2021-08-18T19:31:09.209Z" },
      { "erd": "0x510A", "value": "01", "time": "2021-08-17T20:15:20.044Z" },
      {
        "erd": "0x510B",
        "value": "0000000E6673399CBCCF",
        "time": "2021-08-17T20:15:20.044Z"
      },
      { "erd": "0x510D", "value": "0121", "time": "2021-08-18T19:30:59.244Z" },
      {
        "erd": "0x5113",
        "value": "00014000000000000000000000000000000000000000",
        "time": "2021-08-17T20:15:20.044Z"
      },
      {
        "erd": "0x5200",
        "value": "00000000000000000000000000",
        "time": "2021-05-01T01:25:41.104Z"
      },
      { "erd": "0x5201", "value": "00", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5202", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5203", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5204", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5205", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5206", "value": "00", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5207", "value": "00", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5208", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x5209", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      { "erd": "0x520A", "value": "01", "time": "2021-05-01T01:25:41.104Z" },
      {
        "erd": "0x520B",
        "value": "00000000000000000000",
        "time": "2021-05-01T01:25:41.104Z"
      },
      { "erd": "0x520D", "value": "0000", "time": "2021-05-01T01:25:41.104Z" },
      {
        "erd": "0x5300",
        "value": "0000000000000000000000000000000000000000000000",
        "time": "2021-05-22T03:41:52.344Z"
      },
      { "erd": "0x551C", "value": "0000", "time": "2021-05-22T03:41:52.344Z" },
      { "erd": "0x5770", "value": "00", "time": "2021-05-22T03:41:52.344Z" }
    ]
  }
}

This is the response that seems to have everything while the oven is set to Air Fry. I also got a message about unsupported oven mode 158.

I added an erd_oven_cook_mode of 158, along with some const and map entry, and I was able to successfully call OvenCookSetting(OVEN_COOK_MODE_MAP[ErdOvenCookMode.AIR_FRY], 400) and have my oven go to air fry mode.

The oven state looks to be "5A", but I also saw "5B" right after as seen in the logs below, I wasn't sure how to handle that part or what either of those values would correspond to. I also didn't figure out the bitmask for "Available Cook Modes".

2021-08-18 17:40:16,285 DEBUG    client < Frame(fin=True, opcode=<Opcode.TEXT: 1>, data=b'{"item":{"applianceId":"D828C9455538","erd":"0x5100","time":"2021-08-18T21:40:15.190Z","value":"9E019000000000000000000000"},"resource":"/appliance/D828C9455538/erd/0x5100","kind":"publish#erd","userId":""}', rsv1=False, rsv2=False, rsv3=False)
2021-08-18 17:40:16,285 DEBUG    Setting ErdCode.UPPER_OVEN_COOK_MODE to Air Fry TEST (400°)
2021-08-18 17:40:16,300 DEBUG    Appliance state change detected in GeAppliance(D828C9455538) (ErdApplianceType.OVEN). Updated keys: ErdCode.UPPER_OVEN_COOK_MODE
2021-08-18 17:40:16,519 DEBUG    client - event = data_received(<16 bytes>)
2021-08-18 17:40:16,519 DEBUG    client < Frame(fin=True, opcode=<Opcode.TEXT: 1>, data=b'{"item":{"applianceId":"D828C9455538","erd":"0x5101","time":"2021-08-18T21:40:15.284Z","value":"5A"},"resource":"/appliance/D828C9455538/erd/0x5101","kind":"publish#erd","userId":""}', rsv1=False, rsv2=False, rsv3=False)
2021-08-18 17:40:16,535 DEBUG    Setting ErdCode.UPPER_OVEN_CURRENT_STATE to Off
2021-08-18 17:40:16,535 DEBUG    Appliance state change detected in GeAppliance(D828C9455538) (ErdApplianceType.OVEN). Updated keys: ErdCode.UPPER_OVEN_CURRENT_STATE
2021-08-18 17:40:16,550 DEBUG    client - event = data_received(<10 bytes>)
2021-08-18 17:40:16,550 DEBUG    client < Frame(fin=True, opcode=<Opcode.TEXT: 1>, data=b'{"item":{"applianceId":"D828C9455538","erd":"0x5101","time":"2021-08-18T21:40:15.284Z","value":"5B"},"resource":"/appliance/D828C9455538/erd/0x5101","kind":"publish#erd","userId":""}', rsv1=False, rsv2=False, rsv3=False)

If there's more data that would be useful let me know. Thanks!

simbaja commented 3 years ago

Can you pull down the latest version and confirm that you see air fry listed in the extended modes (0x5113 or 0x5213)? I think the reason that air fry was initially missed is that it's not actually part of the available modes, it's a completely different code. Once you confirm here, I can modify the modes logic in the HA component to get it included there too.

simbaja commented 3 years ago

The 0.5.0-dev0 release of the HA component should have the air fry mode enabled. Let me know if you run into issues using it.

jrobinson041 commented 3 years ago

This all works great, thanks!