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 Pet Feeder #2027

Open
pergolafabio opened this issue Jun 20, 2024 · 24 comments
Open

Request support for Pet Feeder #2027

pergolafabio opened this issue Jun 20, 2024 · 24 comments
Labels
awaiting confirmation Wating for confirmation the issue is solved new device Unsupported device unreleased Will be in next release

Comments

@pergolafabio
Copy link
Contributor

pergolafabio commented Jun 20, 2024

Hi, requesting device support for a Cat Pet Feeder, as discussed before, i wasnt able to add the device

image

-->

Log Message

2024-06-20 11:53:12.822 WARNING (MainThread) [custom_components.tuya_local.config_flow] Could not find device: XXXX
2024-06-20 11:53:40.547 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test.

Information about DPS mappings

{
  "result": {
    "model": "{\"modelId\":\"000004ajdj\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[
{\"abilityId\":101,\"accessMode\":\"rw\",\"code\":\"basic_indicator\",\"description\":\"设备指示灯是否打开,true打开,false关闭\",\"name\":\"指示灯\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":103,\"accessMode\":\"rw\",\"code\":\"basic_flip\",\"description\":\"true反转,false正常\",\"name\":\"录制画面翻转\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":104,\"accessMode\":\"rw\",\"code\":\"basic_osd\",\"description\":\"true打开水印,false关闭水印\",\"name\":\"视频osd功能\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":106,\"accessMode\":\"rw\",\"code\":\"motion_sensitivity\",\"description\":\"0-2,灵敏度依次增加;仅为灵敏度,0并不是关闭移动侦测报警;规定0为低灵敏度,1为中灵敏度,2为高灵敏度。\",\"name\":\"移动侦测报警灵敏度\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"0\",\"1\",\"2\"]}},
{\"abilityId\":108,\"accessMode\":\"rw\",\"code\":\"basic_nightvision\",\"description\":\"0:自动\\n1:关\\n2:开\",\"name\":\"红外夜视\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"0\",\"1\",\"2\"]}},
{\"abilityId\":113,\"accessMode\":\"rw\",\"code\":\"motion_record\",\"description\":\"true打开,false关闭\\n摄像头本地功能:功能打开的时候,只有检测到移动才开始录像。\",\"name\":\"移动侦测录像\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":115,\"accessMode\":\"ro\",\"code\":\"movement_detect_pic\",\"description\":\"该功能实现请参考SDK\\n---------------\\n{\\\"dp_id\\\",\\\"bucket;object;key\\\"}/{\\\"dp_id\\\",\\\"bucket;object;\\\"}\\n\\nbucket:根文件夹;objcet:文件路径;key:加密\",\"name\":\"检测到移动\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":134,\"accessMode\":\"rw\",\"code\":\"motion_switch\",\"description\":\"\",\"name\":\"移动侦测\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":201,\"accessMode\":\"rw\",\"code\":\"feed_num\",\"description\":\"返回错误码:\\n0 :投食失败\\n\\n//正数为投食的数量,若下发的投食3分,都投成功了,则返回3,APP则显示投食成功。\\n\",\"name\":\"喂食机-投食\",\"typeSpec\":{\"type\":\"value\",\"max\":20,\"min\":-2000,\"scale\":0,\"step\":1,\"unit\":\"份\"}},
{\"abilityId\":202,\"accessMode\":\"ro\",\"code\":\"food_weight\",\"description\":\"每份食物的重量,单位g \",\"name\":\"每份食物克重\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":1,\"scale\":1,\"step\":1,\"unit\":\"g\"}},
{\"abilityId\":203,\"accessMode\":\"rw\",\"code\":\"control\",\"description\":\"控制类命令,执行结束后返回历史数据\",\"name\":\"控制命令\",\"typeSpec\":{\"type\":\"value\",\"max\":2147483646,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":204,\"accessMode\":\"ro\",\"code\":\"realtime_data\",\"description\":\"设备实时状态数据,按时上报到服务器。包括设备出错类型,出粮份数等\",\"name\":\"设备状态\",\"typeSpec\":{\"type\":\"value\",\"max\":2147483647,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":205,\"accessMode\":\"rw\",\"code\":\"weight\",\"description\":\"百位数为是否使能远程控制出粮,个位十位数为自动出粮分数\",\"name\":\"自动出粮份数\",\"typeSpec\":{\"type\":\"value\",\"max\":255,\"min\":1,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":206,\"accessMode\":\"ro\",\"code\":\"history_data\",\"description\":\"设备执行完成后上报历史数据,上报历史数据时,value由4个字节拼接而成,最高位字节表示错误码(1:无粮  2:食物不足   3:粮食堵塞);次高位字节百位表示出粮类型(2:Alex  1:手动   0:自动);第三字节表示实际出粮份数;最后一字节表示上报ID,每次上报后加1。\\nresult = ((uint32)devState.errType<<24|(uint32)foodCount<<16|(uint32)rebackCount<<8|(uint32)sendID);\\n\",\"name\":\"上报历史数据\",\"typeSpec\":{\"type\":\"value\",\"max\":2147483645,\"min\":0,\"scale\":1,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":207,\"accessMode\":\"rw\",\"code\":\"schedule\",\"description\":\"面板将一个单任务用15个字节表示,然后转为string类型下发给设备端。前9位为有效位,后6位000000。\\n注意:设备端收到指令后先转换格式,byte2~byte8转为十进制整型数,byte0~byte1按照十六进制处理。\\n1. bit0 ~ bit6 代表周日到周六,某bit为1表示当天有效。\\n2. 全为0表示仅限一次。\\n\",\"name\":\"定时\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":208,\"accessMode\":\"rw\",\"code\":\"feed_voice_record\",\"description\":\"目前只需设置数值0(正常状态)、1(开始录音) 2 录音异常触发Toast弹框,APP下发“1”表示设备进入录音模式,下发“0”标示停止录音,设备上报“1”设备正在录音,上报“0”标示录音停止,上报“-1”表示录音异常\",\"name\":\"喂食录音\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"0\",\"1\",\"2\"]}}]}]}"
  },
  "success": true,
  "t": 1718883912216,
  "tid": "8d663ea32efa11efaed6f615e854d753"
}

Product ID: ibnk6keua0zzc2gr

Information about how the device functions

When i add it to tuya cloud integtation, it looks like below:
image

here is the json exported, from the cloud integation, i use it in cloud integration too, since that intergation aslo creates an camera entity... I dont think localtuya or tuyalocal supports camera entities?

ALso important, when i added it to localtuya/tuya cloud, there was 1 important DP missing, it was DP 201 , thats the one where i send values too, to make the catfeeder actually feed... i used the set DP service, it would be wonderfull it you can add this DP 201 too, so can send portions to it , like, below example, i'm sending 5 portions, but as discussed, it can be a numeric entity too ...

Do you need more info from me.

      - service: localtuya.set_dp
        data:
          device_id: !secret tuya_petfeeder_id
          dp: 201
          value: 5
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "XXX",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "XXXX",
    "name": "Pepe Sale",
    "category": "sp",
    "product_id": "ibnk6keua0zzc2gr",
    "product_name": "PetFeeder",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2022-12-10T20:29:24+00:00",
    "create_time": "2022-12-10T20:29:24+00:00",
    "update_time": "2022-12-10T20:29:24+00:00",
    "function": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_flip": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "motion_sensitivity": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "motion_switch": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status_range": {
      "basic_indicator": {
        "type": "Boolean",
        "value": {}
      },
      "basic_flip": {
        "type": "Boolean",
        "value": {}
      },
      "basic_osd": {
        "type": "Boolean",
        "value": {}
      },
      "motion_sensitivity": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "basic_nightvision": {
        "type": "Enum",
        "value": {
          "range": [
            "0",
            "1",
            "2"
          ]
        }
      },
      "motion_record": {
        "type": "Boolean",
        "value": {}
      },
      "movement_detect_pic": {
        "type": "Raw",
        "value": {}
      },
      "motion_switch": {
        "type": "Boolean",
        "value": {}
      }
    },
    "status": {
      "basic_indicator": false,
      "basic_flip": false,
      "basic_osd": false,
      "motion_sensitivity": 0,
      "basic_nightvision": 0,
      "motion_record": false,
      "movement_detect_pic": "**REDACTED**",
      "motion_switch": false
    },
    "home_assistant": {
      "name": "Pepe Sale",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "camera.pepe_sale",
            "state": "idle",
            "attributes": {
              "access_token": "XXXX",
              "model_name": "PetFeeder",
              "brand": "Tuya",
              "frontend_stream_type": "hls",
              "entity_picture": "**REDACTED**",
              "friendly_name": "Pepe Sale",
              "supported_features": 2
            },
            "last_changed": "2024-06-20T09:51:52.276627+00:00",
            "last_reported": "2024-06-20T11:31:47.380596+00:00",
            "last_updated": "2024-06-20T11:31:47.380596+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "light.pepe_sale_indicator_light",
            "state": "off",
            "attributes": {
              "supported_color_modes": [
                "onoff"
              ],
              "color_mode": null,
              "friendly_name": "Pepe Sale Indicator light",
              "supported_features": 0
            },
            "last_changed": "2024-06-20T09:51:52.333519+00:00",
            "last_reported": "2024-06-20T09:51:52.333519+00:00",
            "last_updated": "2024-06-20T09:51:52.333519+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.pepe_sale_night_vision",
            "state": "0",
            "attributes": {
              "options": [
                "0",
                "1",
                "2"
              ],
              "friendly_name": "Pepe Sale Night vision"
            },
            "last_changed": "2024-06-20T09:51:52.335867+00:00",
            "last_reported": "2024-06-20T09:51:52.335867+00:00",
            "last_updated": "2024-06-20T09:51:52.335867+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.pepe_sale_motion_detection_sensitivity",
            "state": "0",
            "attributes": {
              "options": [
                "0",
                "1",
                "2"
              ],
              "friendly_name": "Pepe Sale Motion detection sensitivity"
            },
            "last_changed": "2024-06-20T09:51:52.336442+00:00",
            "last_reported": "2024-06-20T09:51:52.336442+00:00",
            "last_updated": "2024-06-20T09:51:52.336442+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.pepe_sale_motion_recording",
            "state": "off",
            "attributes": {
              "friendly_name": "Pepe Sale Motion recording"
            },
            "last_changed": "2024-06-20T09:51:52.346518+00:00",
            "last_reported": "2024-06-20T09:51:52.346518+00:00",
            "last_updated": "2024-06-20T09:51:52.346518+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.pepe_sale_flip",
            "state": "off",
            "attributes": {
              "friendly_name": "Pepe Sale Flip"
            },
            "last_changed": "2024-06-20T09:51:52.347134+00:00",
            "last_reported": "2024-06-20T09:51:52.347134+00:00",
            "last_updated": "2024-06-20T09:51:52.347134+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.pepe_sale_time_watermark",
            "state": "off",
            "attributes": {
              "friendly_name": "Pepe Sale Time watermark"
            },
            "last_changed": "2024-06-20T09:51:52.347545+00:00",
            "last_reported": "2024-06-20T09:51:52.347545+00:00",
            "last_updated": "2024-06-20T09:51:52.347545+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "original_icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.pepe_sale_motion_alarm",
            "state": "off",
            "attributes": {
              "friendly_name": "Pepe Sale Motion alarm"
            },
            "last_changed": "2024-06-20T09:51:52.347928+00:00",
            "last_reported": "2024-06-20T09:51:52.347928+00:00",
            "last_updated": "2024-06-20T09:51:52.347928+00:00"
          }
        }
      ]
    },
    "set_up": true,
    "support_local": false
  }
}
@pergolafabio pergolafabio added the new device Unsupported device label Jun 20, 2024
@make-all make-all added the enhancement New feature or request label Jun 20, 2024
@pergolafabio
Copy link
Contributor Author

hey @make-all , i was reading some more about yoru integration, seesm i can add my own device in the "devices" dir?

Would that work for now? since i was receiving error below:

2024-06-20 11:53:12.822 WARNING (MainThread) [custom_components.tuya_local.config_flow] Could not find device: XXXX
2024-06-20 11:53:40.547 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Test.

@make-all
Copy link
Owner

Adding a config in the devices dir will not help, as you are getting the "Failed to refresh device state for Test" error. This is because the device is not returning any data. If you can find a way to force the device to return some data, then it will be detectable, and can proceed to looking for a matching device config in the devices directory.

@make-all
Copy link
Owner

Same status as #847 and #857

@pergolafabio
Copy link
Contributor Author

hmm, how can i do that? how can i force the device for data? maybe by accessing it from the smart life add, and then maybe feed a portion ?

@pergolafabio
Copy link
Contributor Author

if i add it back to localtuya, and then do a local activity, will that work? will that provide data to be detactable? Probably not ? since it opens a session i belive, and only once sessios is allowed?

@pergolafabio
Copy link
Contributor Author

aha!!! when adding it to tuya-local, and forcing some data, it was now added in your intergration, all entities are disabled , probably because the type doesnt match with my DP points?

I choose "ceres_plus_petfeeder" during the setup when adding it

image

  "data": {
    "name": "petfeeder",
    "type": "ceres_plus_petfeeder",
    "device_id": "**REDACTED**",
    "device_cid": "",
    "local_key": "**REDACTED**",
    "host": "**REDACTED**",
    "protocol_version": 3.3,
    "tinytuya_version": "1.14.0",
    "api_version_set": 3.3,
    "api_version_used": 3.3,
    "api_working": true,
    "status": {},
    "cached_state": {
      "updated_at": 0
    },
    "pending_state": {},
    "connected": true,
    "force_dps": [],
    "home_assistant": {
      "name": "petfeeder",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": [
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.petfeeder_nightvision",
            "state": "unavailable",
            "attributes": {
              "options": [
                "Auto",
                "Off",
                "On"
              ],
              "icon": "mdi:weather-night",
              "friendly_name": "petfeeder Nightvision"
            },
            "last_changed": "2024-06-20T12:34:38.888842+00:00",
            "last_reported": "2024-06-20T12:34:38.888842+00:00",
            "last_updated": "2024-06-20T12:34:38.888842+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "select.petfeeder_recording_mode",
            "state": "unavailable",
            "attributes": {
              "options": [
                "Event",
                "Continuous"
              ],
              "icon": "mdi:video",
              "friendly_name": "petfeeder Recording mode"
            },
            "last_changed": "2024-06-20T12:34:38.889992+00:00",
            "last_reported": "2024-06-20T12:34:38.889992+00:00",
            "last_updated": "2024-06-20T12:34:38.889992+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "button.petfeeder_format_sd_card",
            "state": "unavailable",
            "attributes": {
              "icon": "mdi:micro-sd",
              "friendly_name": "petfeeder Format SD card"
            },
            "last_changed": "2024-06-20T12:34:38.868073+00:00",
            "last_reported": "2024-06-20T12:34:38.868073+00:00",
            "last_updated": "2024-06-20T12:34:38.868073+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": "restart",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "button.petfeeder",
            "state": "unavailable",
            "attributes": {
              "device_class": "restart",
              "friendly_name": "petfeeder"
            },
            "last_changed": "2024-06-20T12:34:38.868795+00:00",
            "last_reported": "2024-06-20T12:34:38.868795+00:00",
            "last_updated": "2024-06-20T12:34:38.868795+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "problem",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "binary_sensor.petfeeder_food_blockage",
            "state": "unavailable",
            "attributes": {
              "device_class": "problem",
              "friendly_name": "petfeeder Food blockage"
            },
            "last_changed": "2024-06-20T12:34:38.859568+00:00",
            "last_reported": "2024-06-20T12:34:38.859568+00:00",
            "last_updated": "2024-06-20T12:34:38.859568+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "problem",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "binary_sensor.petfeeder_dispenser_stuck",
            "state": "unavailable",
            "attributes": {
              "device_class": "problem",
              "friendly_name": "petfeeder Dispenser stuck"
            },
            "last_changed": "2024-06-20T12:34:38.860452+00:00",
            "last_reported": "2024-06-20T12:34:38.860452+00:00",
            "last_updated": "2024-06-20T12:34:38.860452+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": "portions",
          "state": {
            "entity_id": "number.petfeeder_manual_feed",
            "state": "unavailable",
            "attributes": {
              "min": 0.0,
              "max": 3.0,
              "step": 1.0,
              "mode": "auto",
              "unit_of_measurement": "portions",
              "icon": "mdi:food-drumstick",
              "friendly_name": "petfeeder Manual feed"
            },
            "last_changed": "2024-06-20T12:34:38.878453+00:00",
            "last_reported": "2024-06-20T12:34:38.878453+00:00",
            "last_updated": "2024-06-20T12:34:38.878453+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": "weight",
          "icon": null,
          "unit_of_measurement": "g",
          "state": {
            "entity_id": "number.petfeeder",
            "state": "unavailable",
            "attributes": {
              "min": 1.0,
              "max": 255.0,
              "step": 1.0,
              "mode": "auto",
              "unit_of_measurement": "g",
              "device_class": "weight",
              "friendly_name": "petfeeder"
            },
            "last_changed": "2024-06-20T12:34:38.879260+00:00",
            "last_reported": "2024-06-20T12:34:38.879260+00:00",
            "last_updated": "2024-06-20T12:34:38.879260+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.petfeeder_timestamp",
            "state": "unavailable",
            "attributes": {
              "icon": "mdi:clock-time-eight",
              "friendly_name": "petfeeder Timestamp"
            },
            "last_changed": "2024-06-20T12:34:38.869829+00:00",
            "last_reported": "2024-06-20T12:34:38.869829+00:00",
            "last_updated": "2024-06-20T12:34:38.869829+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "switch.petfeeder_record",
            "state": "unavailable",
            "attributes": {
              "icon": "mdi:record-rec",
              "friendly_name": "petfeeder Record"
            },
            "last_changed": "2024-06-20T12:34:38.870487+00:00",
            "last_reported": "2024-06-20T12:34:38.870487+00:00",
            "last_updated": "2024-06-20T12:34:38.870487+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "config",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "light.petfeeder_indicator",
            "state": "unavailable",
            "attributes": {
              "supported_color_modes": [
                "onoff"
              ],
              "friendly_name": "petfeeder Indicator",
              "supported_features": 0
            },
            "last_changed": "2024-06-20T12:34:38.876080+00:00",
            "last_reported": "2024-06-20T12:34:38.876080+00:00",
            "last_updated": "2024-06-20T12:34:38.876080+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": null,
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "sensor.petfeeder_status",
            "state": "unavailable",
            "attributes": {
              "icon": "mdi:paw",
              "friendly_name": "petfeeder Status"
            },
            "last_changed": "2024-06-20T12:34:38.891454+00:00",
            "last_reported": "2024-06-20T12:34:38.891454+00:00",
            "last_updated": "2024-06-20T12:34:38.891454+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": "battery",
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "sensor.petfeeder",
            "state": "unavailable",
            "attributes": {
              "device_class": "battery",
              "friendly_name": "petfeeder"
            },
            "last_changed": "2024-06-20T12:34:38.892878+00:00",
            "last_reported": "2024-06-20T12:34:38.892878+00:00",
            "last_updated": "2024-06-20T12:34:38.892878+00:00"
          }
        },
        {
          "disabled": false,
          "disabled_by": null,
          "entity_category": "diagnostic",
          "device_class": null,
          "original_device_class": null,
          "icon": null,
          "unit_of_measurement": null,
          "state": {
            "entity_id": "sensor.petfeeder_food_bucket",
            "state": "unavailable",
            "attributes": {
              "icon": "mdi:fridge",
              "friendly_name": "petfeeder Food bucket"
            },
            "last_changed": "2024-06-20T12:34:38.893562+00:00",
            "last_reported": "2024-06-20T12:34:38.893562+00:00",
            "last_updated": "2024-06-20T12:34:38.893562+00:00"
          }
        }
      ]
    }
  }
}

@pergolafabio
Copy link
Contributor Author

pergolafabio commented Jun 20, 2024

ok, added a new yaml file like below , added it to the devices dir, changed the product id...
I tried re adding the device, but how can i make the intergation choose for the v330 file?
it asks me below instead

image

name: Pet feeder
products:
  - id: ibnk6keua0zzc2gr
    name: V330 Petfeeder
primary_entity:
  entity: number
  category: config
  icon: "mdi:food-drumstick"
  name: Manual feed
  dps:
    - id: 201
      type: integer
      name: value
      range:
        min: 1
        max: 6
secondary_entities:
  - entity: light
    translation_key: indicator
    category: config
    dps:
      - id: 101
        type: boolean
        name: switch
  - entity: switch
    name: Flip
    icon: "mdi:flip-horizontal"
    category: config
    dps:
      - id: 103
        type: boolean
        name: switch
  - entity: switch
    name: Timestamp
    icon: "mdi:clock-time-eight"
    category: config
    dps:
      - id: 104
        type: boolean
        name: switch
        optional: true
  - entity: switch
    name: Motion notification
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 134
        type: boolean
        name: switch
  - entity: select
    name: Motion sensitivity
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 106
        type: string
        name: option
        mapping:
          - dps_val: "0"
            value: Low
          - dps_val: "1"
            value: Medium
          - dps_val: "2"
            value: High
  - 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"

@make-all
Copy link
Owner

Ceres is not a good match. The problem with these pet feeders not providing much / any info by default is that they can't reliably be distinguished from each other. Ceres requires the "101: basic_indicator" dp - I don't know whether that device consistently reports that, or the user that reported it came across a workaround like you used. That happens to match on your device, along with a few more of the optional video related controls, but the manual_feed id is 245 on that device, and 201 on your device, so the important feature that you want is not going to be available. If you do write a config, I think even if the number entity for dp 201 shows Unavailable and may be disabled in the UI as a result, you can still set it with the number.set_value service.

@pergolafabio
Copy link
Contributor Author

hmm, not following, i added a yaml file in the custom_components\tuya_local\devices
created a file here : v330l_petfeeder.yaml , with the contents i posted above? why is it then still asking me to add the ceres?

not sure what i need todo ?

@pergolafabio
Copy link
Contributor Author

i took a lot of copy/paste config from the petlibro_camera_feeder file,

@pergolafabio
Copy link
Contributor Author

when i want to add the device, and i force the state change of DP 101 , it indeed adds the device, i just need/want to know how can i force it using my new added config file, it still propeses to use the ceres file

@pergolafabio
Copy link
Contributor Author

ok, i'm a step further now, seems the "optional: true/false" is in important setting to match a device, when adding the device, it now asked me to setup the v330 device, so i selected it, but still all values are unavaible and disabled? what am i missing here?

the DP 101 is the DP where i match the device

name: Pet feeder
products:
  - id: ibnk6keua0zzc2gr
    name: V330 Petfeeder
primary_entity:
  entity: number
  category: config
  icon: "mdi:food-drumstick"
  name: Manual feed
  dps:
    - id: 201
      type: integer
      name: value
      optional: true
      range:
        min: 1
        max: 10
secondary_entities:
  - entity: light
    translation_key: indicator
    category: config
    dps:
      - id: 101
        type: boolean
        name: switch
  - entity: switch
    name: Flip
    icon: "mdi:flip-horizontal"
    category: config
    dps:
      - id: 103
        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: switch
    name: Motion notification
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 134
        type: boolean
        name: switch
        optional: true
  - entity: select
    name: Motion sensitivity
    icon: "mdi:motion-sensor"
    category: config
    dps:
      - id: 106
        type: string
        name: option
        optional: true
        mapping:
          - dps_val: "0"
            value: Low
          - dps_val: "1"
            value: Medium
          - dps_val: "2"
            value: High
  - 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: binary_sensor
    name: Food empty
    class: problem
    category: diagnostic
    dps:
      - id: 206
        type: bitfield
        name: sensor
        optional: true
        mapping:
          - dps_val: 1
            value: true
          - value: false
  - entity: binary_sensor
    name: Not enough food
    class: problem
    category: diagnostic
    dps:
      - id: 206
        type: bitfield
        name: sensor
        optional: true
        mapping:
          - dps_val: 2
            value: true
          - value: false
  - entity: binary_sensor
    name: Blocked
    class: problem
    category: diagnostic
    dps:
      - id: 206
        type: bitfield
        name: sensor
        optional: true
        mapping:
          - dps_val: 3
            value: true
          - value: false

@pergolafabio
Copy link
Contributor Author

ahh, i now why, after restarting HA, i see this:

2024-06-20 16:52:53.406 ERROR (MainThread) [custom_components.tuya_local.device] Failed to refresh device state for Petfeeder.

Once i change someting on the petfeeder manually, all entities are alive ... that means i just need to find out the DP that makes the device refresh, seems 101 doesnt do the trick ...

how can i find that out?

@pergolafabio
Copy link
Contributor Author

Created a PR for mine v330 , it works, but to make the entities avaible, i need todo manally an action on my petfeeder
it doesnt seem any of the DP are giving a state when i try to add it, so i created an automation on restart HA, to force an update on the device, so the enities are avaible

Not sure if you know a trick to find out what DP is giving state so its detectable ?

#2038

@make-all
Copy link
Owner

I don't know any tricks for finding this out without trying all of them.

@pergolafabio
Copy link
Contributor Author

pergolafabio commented Jun 22, 2024

i tried them all in the device file, by defining : "optional: false" to all DP
but still it didnt detect it :-(
this is the correct way? not?

do other devices also have such kind of behaviour? have you seen it before?

@make-all
Copy link
Owner

At least one dp need to not be marked optional. Otherwise there is nothing left to match against. Probably it is best to wait for the enhancement that will remove that restriction and allow matching without dps.

@pergolafabio
Copy link
Contributor Author

What enhancement is that? Is that a new feature coming? But then I still have the issue if I restart HA, that all entities are unavailable, right? Untill I manually force an event...

@make-all
Copy link
Owner

Probably.

@pergolafabio
Copy link
Contributor Author

Ok, I see a similar issue here, I can try changing it to 3.2 ?

#507 (comment)

@make-all
Copy link
Owner

You can try, but I think you would be getting a different error and the workaround of making a change using the app while adding would most likely not work if the protocol version was the source of the problem.

@pergolafabio
Copy link
Contributor Author

adding it by using 3.2 is working! seems the config file is correct, 101 is a working DP
maybe you can merge my PR now?

@pergolafabio
Copy link
Contributor Author

tried restarting HA, entities also still avaible

@make-all make-all removed the enhancement New feature or request label Jun 22, 2024
@pergolafabio
Copy link
Contributor Author

Btw, do you also have support for camera streams? My petfeeder camera doesn't expose RTSP 554 , I need the tuya cloud integration to fetch it...

Thnx

@make-all make-all added awaiting confirmation Wating for confirmation the issue is solved unreleased Will be in next release labels Jun 23, 2024
make-all added a commit that referenced this issue Jun 23, 2024
- Add camera
- Add additional attributes for non-useful data.

Issue #2027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting confirmation Wating for confirmation the issue is solved new device Unsupported device unreleased Will be in next release
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants