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

Dps not visible with status #537

Open
FredrikM97 opened this issue Sep 18, 2024 · 0 comments
Open

Dps not visible with status #537

FredrikM97 opened this issue Sep 18, 2024 · 0 comments
Labels
tuya_device Support for specific Tuya Devices

Comments

@FredrikM97
Copy link

Hi!

I have an odd issue. I am trying to modify a pet feeder and update the meal_plan. However there is no dps info with the status query.

{'dps': {'3': 1, '11': 70, '12': False, '14': 0, '15': 1, '19': True, '101': 'ac_power_on', '103': 'real_time_mode', '112': 2, '116': '94%'}}

However if I use the following

import tinytuya

d = tinytuya.OutletDevice('DEVICEID', 'DEVICEIP', 'DEVICEKEY')
d.set_version(3.3)
d.set_socketPersistent(True)

print(" > Send Request for Status < ")
payload = d.generate_payload(tinytuya.DP_QUERY)
d.send(payload)

print(" > Begin Monitor Loop <")
while(True):
    # See if any data is available
    data = d.receive()
    print('Received Payload: %r' % data)

    # Send keyalive heartbeat
    print(" > Send Heartbeat Ping < ")
    payload = d.generate_payload(tinytuya.HEART_BEAT)
    d.send(payload)

I receive data on changes made with the smartlife app.

    Received Payload: {'Error': 'Unexpected Payload from Device', 'Err': '904', 'Payload': None}
Received Payload: None
Received Payload: None
Received Payload: {'dps': {'1': 'fwQAAgF/BgABAX8JAAEBfw8AAQF/FQACAX8XAAEBKBIAAQE='}, 't': 1726661921}
Received Payload: {'dps': {'1': 'fwQAAgF/BgABAX8JAAEBfw8AAQF/FQACAX8XAAEBKBIAAQE='}, 't': 1726661921}
Received Payload: {'dps': {'1': 'fwQAAgF/BgABAX8JAAEBfw8AAQF/FQACAX8XAAEBKBIAAQE='}, 't': 1726661921}
Received Payload: None
Received Payload: None
Received Payload: None
Received Payload: None

Is there any way to get the data to the status query?

Here is the Data Model:

{
  "result": {
    "model": "{\"modelId\":\"000004d15o\",\"services\":[{\"actions\":[],\"code\":\"\",\"description\":\"\",\"events\":[],\"name\":\"默认服务\",\"properties\":[{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"meal_plan\",\"description\":\"同步到设备端本地,即使设备离线,仍能正常喂食出粮,喂食计划最多支持10个\\nraw格式约定:按照“周期+时间+喂食份数+开关”来实现本地定时,具体如下\\n1,前7个比特位代表周一到周日,二进制转十六进制,占用一个字节,0代表未设置,1代表设置,如0000001,表示周日生效,转换为16进制就是01\\n2,时间按照小时分钟格式,占用2个字节,分钟和小时,十进制转16进制,如18:50,转为16进制为1232\\n3,喂食份数,占用1个字节,十进制转16进制,如12,转为16进制为0c\\n4,开关,占用1个字节,00表示关闭,01表示开启\\n上述举例,对于APP端时间下发的结果为0112320c01,表示周日,18:50,喂食12份,开启。\",\"extensions\":{\"iconName\":\"icon-dp_time3\",\"attribute\":\"1120\"},\"name\":\"喂食计划\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"manual_feed\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-icon-test13\",\"attribute\":\"1028\"},\"name\":\"手动喂食\",\"typeSpec\":{\"type\":\"value\",\"max\":20,\"min\":1,\"scale\":0,\"step\":1,\"unit\":\"\"}},{\"abilityId\":9,\"accessMode\":\"rw\",\"code\":\"factory_reset\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-a_nav_mode\",\"attribute\":\"1120\"},\"name\":\"恢复出厂\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":11,\"accessMode\":\"ro\",\"code\":\"battery_percentage\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_battery\",\"attribute\":\"1152\"},\"name\":\"电池电量\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"%\"}},{\"abilityId\":12,\"accessMode\":\"ro\",\"code\":\"charge_state\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-battery\",\"attribute\":\"1024\"},\"name\":\"充电状态\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":14,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_notice\",\"scope\":\"fault\",\"attribute\":\"1024\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"food_shortages\",\"food_jam\",\"battery_low\",\"ac_power_off\"],\"maxlen\":4}},{\"abilityId\":15,\"accessMode\":\"ro\",\"code\":\"feed_report\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_upload\",\"attribute\":\"1152\",\"id\":15,\"trigger\":\"direct\"},\"name\":\"喂食结果上报\",\"typeSpec\":{\"type\":\"value\",\"max\":20,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"\"}},{\"abilityId\":19,\"accessMode\":\"rw\",\"code\":\"light\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-dp_light2\",\"attribute\":\"1153\"},\"name\":\"指示灯开关\",\"typeSpec\":{\"type\":\"bool\"}},{\"abilityId\":101,\"accessMode\":\"ro\",\"code\":\"power_state\",\"description\":\"\",\"name\":\"适配器状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"no_adapter\",\"ac_power_off\",\"ac_power_on\"]}},{\"abilityId\":103,\"accessMode\":\"ro\",\"code\":\"mode\",\"description\":\"\",\"name\":\"工作模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"real_time_mode\",\"eco_mode\"]}},{\"abilityId\":112,\"accessMode\":\"rw\",\"code\":\"mfeed_speech_volume\",\"description\":\"\",\"extensions\":{\"attribute\":\"4\"},\"name\":\"音量\",\"typeSpec\":{\"type\":\"value\",\"max\":3,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"\"}},{\"abilityId\":116,\"accessMode\":\"ro\",\"code\":\"battery_capacity\",\"description\":\"\",\"name\":\"电量\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}}]}]}"
  },
  "success": true,
  "t": 1726664031923,
  "tid": "0e2784da75bd11efbc016e7818a0f8a2"
}
@jasonacox jasonacox added the tuya_device Support for specific Tuya Devices label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tuya_device Support for specific Tuya Devices
Projects
None yet
Development

No branches or pull requests

2 participants