TuyaInc / tuyasmart-home-sdk-react-native

MIT License
29 stars 65 forks source link

AutoScene created on iOS not working #7

Closed tronginc closed 4 years ago

tronginc commented 5 years ago

Hello, I have created AutoScene on android and iOS, but only AutoScene on android work. After check data, I see AutoScene created on iOS is missing field conditions

I have to add [conditionList addObject:actionModel]; to this line . Then I try creating again but it not work

Data of condition of autoscene created on Android:

{
    "entityType": 1,
    "exprDisplay": "switch : OPEN",
    "entityId": "12120404840d8e99bffa",
    "condType": 1,
    "id": "KoOrSjTL29zZlIqOa8bV",
    "iconUrl": "https://images.tuyaus.com/smart/rule/env/_new.png",
    "entityName": "Door Sensor",
    "entitySubIds": "101",
    "expr": [
      [
        "$dp101",
        "==",
        true
      ]
    ]
  }

Data of condition of autoscene created on iOS

{
  "entityType": 0,
  "entityId": "12120404840d8e99bffa",
  "condType": 1,
  "id": "2xxtQJoXvaAf6NUDrx4Z",
  "iconUrl": "https://images.tuyaus.com/smart/rule/env/_new.png",
  "entitySubIds": "101",
  "expr": [
    [
      "dp101",
      "==",
      true
    ]
  ]
}:
tronginc commented 5 years ago

Update: What different? I make sure that I passed the same params on both device. But on iOS :

  1. matchType = 0
  2. entityType on conditions = 0
  3. Missing exprDisplay on conditions
  4. Missing actionDisplay on conditions

autoscene created on iOS

{
  "matchType": 0,
  "stickyOnTop": true,
  "id": "R35RP7gK2tCITRY4",
  "boundForPanel": false,
  "code": "",
  "conditions": [
    {
      "scenarioId": "R35RP7gK2tCITRY4",
      "entitySubIds": "1",
      "status": 0,
      "iconUrl": "https://images.tuyaus.com/smart/rule/env/_new.png",
      "id": "8SPuymiNyfzpvsUasLek",
      "entityId": "22553644840d8ea14462",
      "cityLatitude": 0,
      "expr": [
        [
          "dp1",
          "==",
          false
        ]
      ],
      "entityType": 0,
      "cityLongitude": 0
    }
  ],
  "enabled": true,
  "devList": [
    "22553644840d8ea14462"
  ],
  "background": "https://images.tuyaus.com/smart/rule/cover/sport.png",
  "actions": [
    {
      "scenarioId": "R35RP7gK2tCITRY4",
      "status": 0,
      "id": "zHl25LZAYTwNSPKbMag3",
      "entityId": "22553644840d8ea14462",
      "actionDisplay": "Currently : ON",
      "actionDisplayNew": {
        "1": [
          "Currently",
          "ON"
        ]
      },
      "entityName": "Đèn nhiều màu nè",
      "executorProperty": {
        "1": true
      },
      "actionExecutor": "dpIssue"
    }
  ],
  "name": "Tắt thì bật"
}

autoscene created on Android

{
  "matchType": 1,
  "stickyOnTop": false,
  "id": "PeWxrZvcTpeg5n8v",
  "boundForPanel": false,
  "code": "",
  "conditions": [
    {
      "id": "owYKNVi4ihIP5SOAWI5J",
      "exprDisplay": "Currently : OFF",
      "entityType": 1,
      "entityName": "Đèn nhiều màu nè",
      "entityId": "22553644840d8ea14462",
      "scenarioId": "PeWxrZvcTpeg5n8v",
      "cityLongitude": 0,
      "expr": [
        [
          "$dp1",
          "==",
          false
        ]
      ],
      "cityLatitude": 0,
      "iconUrl": "https://images.tuyaus.com/smart/rule/env/_new.png",
      "status": 0,
      "entitySubIds": "1"
    }
  ],
  "enabled": true,
  "devList": [
    "22553644840d8ea14462"
  ],
  "background": "https://images.tuyaus.com/smart/rule/cover/bathroom.png",
  "actions": [
    {
      "scenarioId": "PeWxrZvcTpeg5n8v",
      "status": 0,
      "id": "rbQLfbNLUIvQD3ZNNEJX",
      "entityId": "22553644840d8ea14462",
      "actionDisplay": "Currently : ON",
      "actionDisplayNew": {
        "1": [
          "Currently",
          "ON"
        ]
      },
      "entityName": "Đèn nhiều màu nè",
      "executorProperty": {
        "1": true
      },
      "actionExecutor": "dpIssue"
    }
  ],
  "name": "Android"
}
linqwFmt commented 4 years ago

Bugs fixed