Download the “Tuya Smart” app to your smartphone (version 5.13.0 was used for this guide).
Press both buttons on the pet feeder at the same time.
Run the “Tuya Smart” app, press “Add Device”, the Pet feeder should appear automatically, turn on your Bluetooth if it doesn’t. Insert the wireless credentials and press login. Make sure the pet feeder and the Home Assistant are in the same network.
-
Once the account is created, navigate to the
developer platform on the top right corner of the page you were redirected to.
Skip the tutorials, hover the cursor over “Cloud” on the sidebar and click on “Development”.
Fig. 14
Click on “Create Cloud Project“ on the Development page. Fill in the project details. Pick “Custom” Development method and “Central European Data Center”, pick the rest as you see fit.
Fig. 15
In the next step, add “Smart Home Basic Service” and ”[Deprecate]Device Log Query“ to the selected
API services. Click on “Authorize”.
Fig. 16
Now that the project is created, let’s add the pet feeder to the project. Navigate to “Devices” → “Link Tuya App Account” → “Add App Account”.
Fig. 17
A QR code will appear, open the “Tuya Smart” app on your phone, press on “Me” on the bottom right and then press on the scan icon on the top right, scan the QR code.
After the QR code is scanned, pick “Automatic Device Linking Method” and click on OK.
Fig. 18
Once the linking is complete, you should be able to see your account details on the “Link Tuya App Account” tab.
Make note of the “UID”, we will use this later. Click on “Manage Devices”.
Fig. 19
If the Pet Feeder is shown as unlinked, check the checkbox next to the pet feeder and hit “Link Device”.
Fig. 20
Confirm the pet feeder exists on the “All Devices” tab, do not close this webpage.
Fig. 21
-
Go to “Settings” → “Devices & Services” → “Add Integration” on the bottom right corner, Search for “LocalTuya”. Click on “LocalTuya Integration”.
Fig. 22
Once LocalTuya is installed, Cloud
API configuration pop up will appear. Make sure
API server region is EU. For the rest of the credentials, we need to navigate back to
Tuya developer platform.
Fig. 23
On the left sidebar, hover on “Cloud” → “Development” → “Open Project”. The “Client ID” and the “Secret” can be found under the “Overview” tab of the cloud project. (not the Overview on the sidebar, the one under our project name).
Fig. 24
Insert the credentials back to Home Assistant. Use the previously mentioned “UID” from “Link Tuya App Account” tab and click on “Submit”.
LocalTuya Integration is now linked with your Tuya Development Account. We still need to configure the pet feeder for local use.
You will be redirected to LocalTuya integration page, if not, Navigate to “Settings” → “Devices & Integrations” → “LocalTuya”.
-
Skip to step 23 if the credentials of the Pet Feeder are configured automatically. If the Pet Feeder’s configuration is
not set automatically, navigate back to the Tuya Developer Platform, hover on the “Cloud” icon on the sidebar → “API Explorer”.
Fig. 29: Optional step, refer to step 22.a.
On the
API explorer, Navigate to “Query Devices in Project” on “Device Management”.
Type “1” to “page_size” and click on “Submit Request”.
The response query gives us credentials of the device. We can find the local key and device id (called “id”).
Fig. 30: Optional step, refer to step 22.a.
The Host address can be obtained via your router’s web interface.
After you submit, you will be met with the “Entity Type Selection” pop-up. The pet feeder has different functions such as dispensing food or turning the LED on the pet feeder on and off. Each of these functions has their own “Data Point ID” to communicate with the cloud. We need to intercept these Data Points and create separate entities to control the device via the Home Assistant.
Fig. 31
Do not exit the Home Assistant instance and navigate back to Tuya Developer Platform. Open your project and navigate to “All Devices” tab under “Devices” and click on “Debug Device”.
Fig. 32
On the device debugging page, under “Standard Instructions Set” are the functions of the device we can set new values for. Under “Standard Status Set” are the previously mentioned functions and the available sensors of the device.
To find out which Data Point is associated with which function of the device, navigate to “Device Logs” tab.
Fig. 33
Turn the developer console on of your browser (CTRL+SHIFT+I or F12 for Google Chrome). Navigate to “Network” tab on the developer console.
Notice the “Select DP ID” dropdown menu on the top left side of the page.
While the Developer console is on, click on the DP ID dropdown menu and select “Manual Feed”, click on “Search”.
After you click on “Search”, you should see the network tab of your developer console update with several different logs. “list” is the one we are looking for.
Fig. 34
Click on “list”, and navigate to the “Payload” tab, “Code” is the Data Point ID we are looking for. In this case it’s 3.
Fig. 35
The ID is our Data Point, which is 3.
Navigate back to “Device Debugging” tab, make note of the manual_feed’s type and values. It’s an integer with a minimum value of 1, maximum value of 20 and with a step of 1.
Fig. 36
Navigate back to Home Assistant, last time, we were at the Entity Type Selection pop-up. “Settings” → “Devices & Services” → “LocalTuya” → “Configure” → “Add a new Device” → ”Submit” → “Submit”.
Let’s add the manual feed function to LocalTuya. LocalTuya includes integers in “number”, pick it from the dropdown menu and submit.
Fig. 37
The “ID” dropdown menu includes DP IDs of the pet feeder, we know 3 is manual feed. From the dropdown menu, pick 3. Call it Manual Feed. The minimum value is 1, maximum value is 20 and the increment between values is 1. Click “Submit’.
Fig. 38
On the next step, the entity type selection will appear again, for now, check the “Do not add any more entities” and click “Submit” (we can always add more later).
Fig. 39
Now let’s see if the manual feed entity works. Click on “1 device” below the logo of localtuya.
Fig. 40
Slide the Manual Feed to any value and check the Pet Feeder is dispensing food.
Fig. 41
Add more entities by repeating step 26 and beyond.