Home | Software | Linux | Windows | Mobile | Gura Humorului |
miercuri, 16 noiembrie 2022
Configure a Tuya pet feeder with Home Assistant and LocalTuya
Scris miercuri, 16 noiembrie 2022 , 15:56 , de Ovidiu
I will assume that you went through the steps to configure LocalTuya and you already have your Client ID and Client Secret. You will also need to add the device into the Devices tab of your Tuya IoT project and get the device's local key by installing the tinytuya Python module and running python3 -m tinytuya wizard to query and configure local Tuya devices.
After installing localtuya through HACS or by manually adding it to custom_components, add a new LocalTuya integration in Home Assistants integration page and check Do not configure a Cloud API account, since we already have everything we need to set up the integration. After the integration is added, click on the Configure button and select Add a new device in the LocalTuya Configuration popup. Select your device and in the next step replace the Device ID field's value with the value of the "id" field returned by tinytuya:
Also, fill the "key" value returned by tinytuya into the Local key field and give your device a nice name. Leave 3.3 selected for the protocol and for Manual DPS add 101, which is the indicator light status datapoint, and 239, which is the empty/full status of the food bucket. There are many other datapoints for night mode, memory card status and so on, if you're interested into getting the DPs for those see the Zigbee2MQTT great documentation about finding them.
After submitting the form, select switch as a platform for the newly created entity type, then in the next step make sure 101 is selected for the ID, give it a suggestive name, e.g. Indicator Light. Submit this and for the next entity select binary_sensor, make sure to uncheck Do not add any more entities, give it again a name (e.g. Food Bucket Empty), for the On Value set less and for the Off Value set full. Finally, click on Submit and you should now have a new device with a switch entity and a binary sensor available. Don't worry about the Food Bucket Empty sensor being unavailable, it will be updated as soon as it gets updated (you can check this by covering/uncovering the sensors inside the bucket).
Triggering the feeding motor require to manually set a value for the 245 datapoint. For that, go to Services tab in Developer tools (/developer-tools/service) and call the localtuya.set_dp service with the following data:
device_id: <your_device_id>
dp: 245
value: 1
4 comentarii :
Did you manage to make the camera and speaker working?
Camera stream can be accessed via RTSP at rtsp://admin:admin@DEVICE_IP:554/1. I never tried to make the speaker working.
I have the same feeder. Managed to get a full list of hidden DP's: '101': false, basic indicator
'104': false, basic OSD
'108': '0', basic nightvision
'109': '100|0|100', SD storage
'110': 5, sd status
'111': false, sd format
'113': false, motion record
'117': 0, sd format state
'150': false, record switch
'151': '1', record mode
'162': false, device restart
'232': 6,
'233': 0,
'234': 0,
'235': 1,
'236': 0,
'237': '7f12000110000007f17300110000007f21000210000007f06150110000007f08150210000007f14000110000007f15300110000007f23000110000007f1100011000000',
'238': 'high',
'239': 'full',
'240': false,
'241': false,
'242': '0',
'243': 2,
'244': 1,
'245': -2000,
'246': 2
And also the chinese Dp names: Device Event DP ID Event Details Source
Report 喂食上报 2份 (2 portions feeded) device itself
Report 手动喂食上报-告警用 0.20 device itself
Report 卡粮状态 off device itself
Report 堵粮状态 off device itself
Publish 喂食下发 2份 (feed 2 portions) app client
As you can see, I have logged a feeding action from the app with w2 portions.
Since the command you use for feeding with DP 245 does not work for me, how did you discover the DP id from the chinese signs?
I looked into this dropdown: https://i.imgur.com/XrIxsN0.png and tried to guess it from there. When I found something promising, I would select the option and press Search to get the DP from the POST request to /list: https://i.imgur.com/tb0dUAv.png (the "code" parameter). For me, the right option was 喂食下发, which seems to translate to Feeding.
Trimiteți un comentariu