Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request support for Ceres Plus smart pet feeder with camera #507

Closed
nyok92 opened this issue Mar 7, 2023 · 4 comments
Closed

Request support for Ceres Plus smart pet feeder with camera #507

nyok92 opened this issue Mar 7, 2023 · 4 comments

Comments

@nyok92
Copy link
Contributor

nyok92 commented Mar 7, 2023

Log Message

2023-03-07 14:41:23.118 DEBUG (MainThread) [custom_components.tuya_local.device] Refreshing device state for Test
2023-03-07 14:41:23.119 INFO (MainThread) [custom_components.tuya_local.device] Setting protocol version for Test to 3.3
2023-03-07 14:41:23.124 DEBUG (SyncWorker_2) [tinytuya.core] status() entry (dev_type is default)
2023-03-07 14:41:23.124 DEBUG (SyncWorker_2) [tinytuya.core] building command 10 payload=b'{"gwId":"bf0a4a3a4eb3586d1czint","devId":"bf0a4a3a4eb3586d1czint","uid":"bf0a4a3a4eb3586d1czint","t":"1678196483"}'
2023-03-07 14:41:23.136 DEBUG (SyncWorker_2) [tinytuya.core] sending payload
2023-03-07 14:41:23.137 DEBUG (SyncWorker_2) [tinytuya.core] payload encrypted=b'000055aa000000010000000a0000008803b59a76f9870b071fed34c6e3d69163309557ff089ec0b5b23090c607b2455f4156c34e7e404a5b1f6a667457b91611461325400e9d8942419a1f500e7bf51dc99a8822e73739ae233cf09d95d4f>
2023-03-07 14:41:23.149 DEBUG (SyncWorker_2) [tinytuya.core] received data=b'000055aa000000010000000a0000002c00000001663b112c52e9b13db8b682ad720888dfe5add1416bdeca84d639f6cd667823b86507f2700000aa55'
2023-03-07 14:41:23.149 DEBUG (SyncWorker_2) [tinytuya.core] received message=TuyaMessage(seqno=1, cmd=10, retcode=1, payload=b'f;\x11,R\xe9\xb1=\xb8\xb6\x82\xadr\x08\x88\xdf\xe5\xad\xd1Ak\xde\xca\x84\xd69\xf6\xcdfx#\xb8', crc=1695019632, crc_good=True, prefix=21930, iv>2023-03-07 14:41:23.149 DEBUG (SyncWorker_2) [tinytuya.core] raw unpacked message = TuyaMessage(seqno=1, cmd=10, retcode=1, payload=b'f;\x11,R\xe9\xb1=\xb8\xb6\x82\xadr\x08\x88\xdf\xe5\xad\xd1Ak\xde\xca\x84\xd69\xf6\xcdfx#\xb8', crc=1695019632, crc_good=True, prefix=219>
2023-03-07 14:41:23.150 DEBUG (SyncWorker_2) [tinytuya.core] decode payload=b'f;\x11,R\xe9\xb1=\xb8\xb6\x82\xadr\x08\x88\xdf\xe5\xad\xd1Ak\xde\xca\x84\xd69\xf6\xcdfx#\xb8'
2023-03-07 14:41:23.150 DEBUG (SyncWorker_2) [tinytuya.core] decrypting=b'f;\x11,R\xe9\xb1=\xb8\xb6\x82\xadr\x08\x88\xdf\xe5\xad\xd1Ak\xde\xca\x84\xd69\xf6\xcdfx#\xb8'
2023-03-07 14:41:23.150 DEBUG (SyncWorker_2) [tinytuya.core] decrypted 3.x payload='json obj data unvalid'
2023-03-07 14:41:23.151 DEBUG (SyncWorker_2) [tinytuya.core] payload type = <class 'str'>
2023-03-07 14:41:23.151 DEBUG (SyncWorker_2) [tinytuya.core] 'data unvalid' error detected: switching to dev_type 'device22'
2023-03-07 14:41:23.151 DEBUG (SyncWorker_2) [tinytuya.core] _decode_payload() failed!
2023-03-07 14:41:23.151 DEBUG (SyncWorker_2) [tinytuya.core] Device22 detected and updated (default -> device22) - Update payload and try again
2023-03-07 14:41:23.151 DEBUG (SyncWorker_2) [tinytuya.core] ERROR Device22 Detected: Retry Command - 908 - payload: null
2023-03-07 14:41:23.152 DEBUG (SyncWorker_2) [tinytuya.core] status() received data={'Error': 'Device22 Detected: Retry Command', 'Err': '908', 'Payload': None}
2023-03-07 14:41:23.153 DEBUG (SyncWorker_2) [tinytuya.core] status() rebuilding payload for device22
2023-03-07 14:41:23.153 DEBUG (SyncWorker_2) [tinytuya.core] building command 10 payload=b'{"devId":"bf0a4a3a4eb3586d1czint","uid":"bf0a4a3a4eb3586d1czint","t":"1678196483","dps":{"1":null}}'
2023-03-07 14:41:23.159 DEBUG (SyncWorker_2) [tinytuya.core] sending payload
2023-03-07 14:41:23.159 DEBUG (SyncWorker_2) [tinytuya.core] payload encrypted=b'000055aa000000020000000d00000087332e33000000000000000000000000b98c2f3bdd5e0f3689fbe71f42cc5e58461325400e9d8942419a1f500e7bf51dc99a8822e73739ae233cf09d95d4f45b309557ff089ec0b5b23090c607b2455>
2023-03-07 14:41:23.176 DEBUG (SyncWorker_2) [tinytuya.core] received data=b'000055aa000000020000000d0000000c000000008de14f440000aa55'
2023-03-07 14:41:23.176 DEBUG (SyncWorker_2) [tinytuya.core] received null payload (TuyaMessage(seqno=2, cmd=13, retcode=0, payload=b'', crc=2380353348, crc_good=True, prefix=21930, iv=None)), fetch new one - retry 0 / 1
2023-03-07 14:41:28.182 DEBUG (SyncWorker_2) [custom_components.tuya_local.device] Test refreshed device state: null
2023-03-07 14:41:28.182 DEBUG (SyncWorker_2) [custom_components.tuya_local.device] new state (incl pending): {"updated_at": 0}

Information about DPS mappings

{
  "result": {
    "category": "sp",
    "functions": [
      {
        "code": "basic_indicator",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_nightvision",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_format",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_record",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_switch",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      },
      {
        "code": "device_restart",
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "basic_indicator",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_nightvision",
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_storge",
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "sd_status",
        "type": "Integer",
        "values": "{\"min\":1,\"max\":5,\"scale\":0,\"step\":1}"
      },
      {
        "code": "sd_format",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_record",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "sd_format_state",
        "type": "Integer",
        "values": "{\"min\":-20000,\"max\":200000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "record_switch",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      },
      {
        "code": "device_restart",
        "type": "Boolean",
        "values": "{}"
      }
    ]
  },
  "success": true,
  "t": 1678198685726,
  "tid": "e0b73262bcf211ed98e69e0bfac44282"
}
{
  "result": {
    "category": "sp",
    "functions": [
      {
        "code": "basic_indicator",
        "dp_id": 101,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "dp_id": 104,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_nightvision",
        "dp_id": 108,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_format",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_record",
        "dp_id": 113,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_switch",
        "dp_id": 150,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "dp_id": 151,
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      },
      {
        "code": "device_restart",
        "dp_id": 162,
        "type": "Boolean",
        "values": "{}"
      }
    ],
    "status": [
      {
        "code": "basic_indicator",
        "dp_id": 101,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_osd",
        "dp_id": 104,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "basic_nightvision",
        "dp_id": 108,
        "type": "Enum",
        "values": "{\"range\":[\"0\",\"1\",\"2\"]}"
      },
      {
        "code": "sd_storge",
        "dp_id": 109,
        "type": "String",
        "values": "{\"maxlen\":255}"
      },
      {
        "code": "sd_status",
        "dp_id": 110,
        "type": "Integer",
        "values": "{\"min\":1,\"max\":5,\"scale\":0,\"step\":1}"
      },
      {
        "code": "sd_format",
        "dp_id": 111,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "motion_record",
        "dp_id": 113,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "sd_format_state",
        "dp_id": 117,
        "type": "Integer",
        "values": "{\"min\":-20000,\"max\":200000,\"scale\":0,\"step\":1}"
      },
      {
        "code": "record_switch",
        "dp_id": 150,
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "record_mode",
        "dp_id": 151,
        "type": "Enum",
        "values": "{\"range\":[\"1\",\"2\"]}"
      },
      {
        "code": "device_restart",
        "dp_id": 162,
        "type": "Boolean",
        "values": "{}"
      }
    ]
  },
  "success": true,
  "t": 1678198789362,
  "tid": "1e7f5b3cbcf311ed9f7936041e250963"
}

ok means that i managed to get feedback with tinytuya script or change the values

import tinytuya

tinytuya.set_debug(True)

d = tinytuya.OutletDevice(
      dev_id="bf0a4a3a4eb3586d1czint",
      address="192.168.1.4",
      local_key="XXXXXXXXXXX",
      dev_type = "device22",
      version=3.3)

d.add_dps_to_request(XXX)

data = d.status()
print('Device status: %r' % data)
ok-101-switch: Indicator light  [True/False]
ok-104-switch: Timestamp  [True/False]
ok-108-select: Night vision "range": ["0"auto,"1"off,"2"on] 
ok-109-Sensor: SD card capacity (string) string "maxlen": 255

ok-110: SD card Status  (integer min 1 max 5 scale 0 step 1)  : info existente 
ok-111: Format SD card (ON/OFF) info existente
113: Recording mode: Record when feeding  [True/false]
ok-117: Formatted state  "min": -20000,"max": 200000,"scale": 0,"step": 1 ----> info existante:0

ok-150-switch : Record to SD card [True/False]                
ok-151-select: Recording mode "range": ["1"Record events only,"2"continuous recording]

162-switch: Restart [True/False] 
232: 每份食物克重 Grams per Serving
233: 控制命令 control commands ??
234: 设备状态 device status ??
235: 自动出粮份数 Automatic food delivery
236: 上报历史数据 Report historical data
ok-237: 定时 Automatic Feeding setting (set time and portion)
      cmd:7f08000310000007f12000310000007f19000310000007f1431051000000
           7f/HH:MM/XX portions/1000000(x times)

238-sensor: 电池电量 Battery [High, low]
239-binary sensor: 粮筒状态 Food bucket status ["Full", ???]
240-binary_sensor : 堵粮状态 Jam State
241-binary_sensor : 卡粮状态 stuck state
**238 to 241 : not getting actual feedback when requested, i think they are pushed by the unit when the value change**

ok-242: 喂食录音 feeding recording
243: 手动喂食上报-告警用 Manual feeding report - for alarm
244: 自动喂食上报-告警用 Automatic feeding report - for alarm
245-喂食下发 Feeding (selecting a number of portions)
246: 喂食上报 feeding report
247: 备用透传 Backup transparent transmission ?

8zrzjldq07tlxnlv

Information about how the device functions

Momoschoice Ceres Plus cat pet feeder (with camera)

@nyok92 nyok92 added the new device Unsupported device label Mar 7, 2023
@nyok92 nyok92 changed the title Request support for [device description] Request support for Ceres Plus smart pet feeder with camera Mar 7, 2023
@make-all
Copy link
Owner

make-all commented Apr 22, 2023

There is not enough information about the type of some of these to add a config. Most useful would be to get the Home Assistant log message that is output when you try to add the device under this integration, as that will have all the details of actual data that is received from the device locally.
The issue that prevents device22 type devices from being detected may have been fixed in the main branch yesterday, so it may be possible now to collect the data needed.

@make-all make-all added the awaiting feedback Needs more information label Apr 22, 2023
@nyok92
Copy link
Contributor Author

nyok92 commented Apr 29, 2023

Hi @make-all ,

Thanks, here are the logs received on first attempt.
I had to force protocol 3.2 and set ip to get feedback.

Logger: custom_components.tuya_local.config_flow
Source: custom_components/tuya_local/config_flow.py:46
Integration: tuya_local (documentation, issues)
First occurred: 00:33:25 (2 occurrences)
Last logged: 00:33:25

Device matches None with quality of 0%. DPS: {"updated_at": 1682807603.8370926, "101": false}
Report this to https://github.com/make-all/tuya-local/issues/

@nyok92
Copy link
Contributor Author

nyok92 commented Jun 23, 2023

@make-all
I have to set protocol to 3.2.
Sensors found in Diagnostic take time to be transmitted to the integration.
But here is a good start for the .yaml file :

name: Pet feeder
products:
  - id: 8zrzjldq07tlxnlv
    name: Ceres Plus Momoschoice
primary_entity:
  entity: sensor
  name: Status
  icon: "mdi:paw"
  dps:
    - id: 234
      type: string
      name: sensor
      optional: true
secondary_entities:
  - entity: switch
    name: Indicator
    category: config
    icon: "mdi:led-on"
    dps:
      - id: 101
        type: boolean
        name: switch
        optional: true
  - entity: switch
    name: Timestamp
    icon: "mdi:clock-time-eight"
    category: config
    dps:
      - id: 104
        type: boolean
        name: switch
        optional: true
  - entity: select
    name: Nightvision
    icon: "mdi:weather-night"
    category: config
    dps:
      - id: 108
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: "0"
            value: Auto
          - dps_val: "1"
            value: "Off"
          - dps_val: "2"
            value: "On"
  - entity: button
    name: Memory card format
    icon: "mdi:micro-sd"
    category: config
    dps:
      - id: 111
        type: boolean
        name: button
        optional: true
      - id: 110
        type: integer
        name: status
        optional: true
        mapping:
          - dps_val: "1"
            value: "formaté"
          - dps_val: "4"
            value: "formatage"
          - dps_val: "0"
            value: "0"
      - id: 109
        type: string
        name: capacity
        optional: true
      - id: 117
        type: integer
        name: format_state
        optional: true
  - entity: switch
    name: Record
    icon: "mdi:record-rec"
    category: config
    dps:
      - id: 150
        type: boolean
        name: switch
        optional: true
  - entity: select
    name: Recording mode
    icon: "mdi:video"
    category: config
    dps:
      - id: 151
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: "1"
            value: Event
          - dps_val: "2"
            value: Continuous
  - entity: button
    name: Restart
    icon: "mdi:restart"
    category: config
    dps:
      - id: 111
        type: boolean
        name: button
        optional: true
  - entity: sensor
    name: feed_plan
    icon: "mdi:paw"
    dps:
      - id: 237
        type: string
        name: sensor
        optional: true
      - id: 237
        type: hex
        name: schedule
        optional: true
  - entity: sensor
    name: Battery
    icon: "mdi:battery"
    category: diagnostic
    dps:
      - id: 238
        type: string
        name: sensor
        optional: true
  - entity: sensor
    name: Food bucket
    icon: "mdi:fridge"
    category: diagnostic
    dps:
      - id: 239
        type: string
        name: sensor
        optional: true
  - entity: binary_sensor
    name: jam
    class: problem
    category: diagnostic
    dps:
      - id: 240
        type: string
        name: sensor
        optional: true
        mapping:
          - dps_val: "true"
            value: "jammed"
          - dps_val: "false"
            value: "ok"
  - entity: binary_sensor
    name: stuck
    class: problem
    category: diagnostic
    dps:
      - id: 241
        type: string
        name: sensor
        optional: true
        mapping:
          - dps_val: "true"
            value: "jammed"
          - dps_val: "false"
            value: "ok"
  - entity: number
    name: Manual feed
    icon: "mdi:food-drumstick"
    dps:
      - id: 245
        type: integer
        name: value
        unit: portions
        optional: true
        range:
          min: 0
          max: 3
        persist: false
        mapping:
          - dps_val: 0
            value: 0
          - dps_val: 1
            value: 1
          - dps_val: 2
            value: 2
          - dps_val: 
            value: 3
  - entity: number
    name: Weight
    category: config
    class: weight
    icon: "mdi:scale"
    dps:
      - id: 232
        type: integer
        name: value
        optional: true
        unit: g
        range:
          min: 1
          max: 255
  - entity: sensor
    name: feeding_report
    dps:
      - id: 242
        type: string
        name: sensor
        optional: true
  - entity: sensor
    name: manual_feed_report
    dps:
      - id: 243
        type: string
        name: sensor
        optional: true
  - entity: sensor
    name: planned_feed_report
    dps:
      - id: 244
        type: string
        name: sensor
        optional: true
  - entity: sensor
    name: power_report
    class: enum
    category: diagnostic
    dps:
      - id: 246
        type: string
        name: sensor
        optional: true
        mapping:
          - dps_val: 0
            value: 0
          - dps_val: 1
            value: OK
          - dps_val: 2
            value: 2
          - dps_val: 3
            value: 3

@make-all make-all added config provided Config included by reporter and removed awaiting feedback Needs more information labels Aug 12, 2023
make-all added a commit that referenced this issue Aug 13, 2023
@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release and removed config provided Config included by reporter new device Unsupported device awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Aug 13, 2023
@pergolafabio
Copy link
Contributor

Hey @nyok92 , I have an petfeeder that looks like yours, almost the same DP's.

It's not detectable either, untill I do something manually on it...
How did you solve it ? When I add the device and manually force an event, it can add it, but after restart HA, all entities are unavailable, untill I force something manually...
Is 3.2 the trick to make it detectable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants