PETLIBRO Cloud integration (non Tuya !) WIP

This is still under development and with limited (one at this time) device support, this might take some time

Hi,

I’m working on a custom integration to connect PETLIBRO devices to Home Assistant using their cloud (sadly).

This is aimed toward new devices that no longer use Tuya (PETLIBRO LITE app) like the granary feeder PLAF103.

I only have a granary feeder, anyone that got some technical skill and other devices are welcome !

It’s my first HA component, so it’s a pain, and I’m slowly progressing.

Here is the GitHub repo

I got the PETLIBRO API by using Waydroid with mitmproxy in WireGuard mode and patch the latest APK from APKPure with apk-mitm and the mitmproxy’s SSL CA and set it as a system trusted CA.

10 Likes

I have successfully created the integration, there is somewhat of a code base and I can retrieve informations ! :tada:

This is heavily based on the Litter-Robot integration.

5 Likes

I have a PLWF105 that I just purchased and was in the process of returning after I realized it didn’t work with Tuya - then I saw your post!

Not much of a coder but happy to help test with the Dockstream if helpful.

I have the PLAF203 and am willing to do some testing :slight_smile: Is the integration ready to install now?
Edit: I installed and authorized fine, but I can’t see any device yet.

1 Like

Nice work! I just purchased the same feeder (PLAF103) and set up the integration. Was able to auth and locate the device with no issues, however, the desiccant sensor seems to report that I might be good for a little while, hahaha.

Edit: The sensor is reporting the right value, the default display precision was/is just bugged out

Installed the repo in HACS, component showed up just fine in integrations and logged in with my petlibro account. No devices yet, but I presume theyll show up as they poll the cloud when events occur.

If I can get every informations from the already discovered API endpoints, this could be easy to do.

Can you give me some examples of controls or sensors you want to get in HA ?

@teachingbirds @jbrukardt you can’t see devces not supported, there should be some logs

I’m focusing on my feeder to have the base of the integration first to avoid maintaining multiple devices trough code refactor

1 Like

Since my desiccant remaining days are in negative, I thought this works correctly…

I need to learn how to properly tune the sensor, thanks for the feedback!

1 Like

Some feedback when trying to integrate other devices

Logger: custom_components.petlibro.hub
Source: custom_components/petlibro/hub.py:67
integration: PETLIBRO (documentation)
First occurred: 10:15:23 AM (4 occurrences)
Last logged: 12:36:38 PM

Unsupported device found: Dockstream Fountain
Unsupported device found: One RFID Pet Feeder

For the Dockstream fountain mainly the remaining water amount - although filter/cleaning days remaining would be useful as well.

addl debug info on the variables the cloud sends back for Dockstream Connect and One RFID

2024-08-16 12:36:38.401 DEBUG (MainThread) [custom_components.petlibro.api] Making POST request to https://api.us.petlibro.com/device/device/list
2024-08-16 12:36:38.468 DEBUG (MainThread) [custom_components.petlibro.api] Received 200 response from https://api.us.petlibro.com/device/device/list: {'code': 0, 'msg': None, 'data': [{'deviceSn': 'WF0101395322147YV', 'name': 'Dockstream Fountain', 'icon': 'https://oss.us.petlibro.com/dlcloud/platform/product_icon/product_icon_66b4a84f048e592c7e3a75dc.png', 'productIdentifier': 'PLWF105', 'productName': 'Dockstream Fountain', 'roomId': 4, 'roomName': 'Kitchen', 'mac': 'REDACTED', 'thirdSn': None, 'cameraId': None, 'softwareVersion': '1.0.7', 'timezone': 'America/New_York', 'online': True, 'surplusGrain': True, 'powerType': 1, 'powerMode': 1, 'electricQuantity': 0, 'batteryState': 'low', 'vacuumState': True, 'pumpAirState': True, 'vacuumMode': 'NORMAL', 'lowBatteryState': None, 'enableSound': True, 'enableLight': True, 'enableFeedingPlan': True, 'enableAutoUpgrade': True, 'nextFeedingDay': None, 'nextFeedingTime': None, 'nextFeedingEndTime': None, 'planState': None, 'nextFeedingQuantity': None, 'autoChangeType': None, 'autoThreshold': None, 'wifiRssiLevel': 4, 'wifiRssi': -49, 'productKey': None, 'useWaterType': 0, 'remainingReplacementDays': 13, 'remainingCleaningDays': 3, 'useWaterInterval': 15, 'useWaterDuration': 15, 'exceptionMessage': 'Cleaning reminder', 'todayTotalMl': 50, 'weightPercent': 1, 'weight': 2743.0, 'grainOutletState': None, 'snowflake': True, 'temperature': None, 'platePosition': None, 'deviceShareState': 3, 'deviceCloudStorageState': None, 'shareId': None, 'unitType': 2, 'enableBatteryPercent': False, 'barnDoorState': None, 'barnDoorError': False, 'coverOpenMode': None, 'errorState': False, 'doorErrorState': 'NORMAL', 'bowlMode': None, 'whetherInSleepMode': None, 'imageId': '705076f573e54ca3b10ae1232b579a98', 'imageName': 'White'}, {'deviceSn': 'AF060134A31A0197E', 'name': "REDACTED", 'icon': 'https://oss.us.petlibro.com/dlcloud/platform/product_icon/product_icon_66b4a757048e592c7e3a75d4.png', 'productIdentifier': 'PLAF301', 'productName': 'One RFID Pet Feeder', 'roomId': None, 'roomName': None, 'mac': 'REDACTED', 'thirdSn': None, 'cameraId': None, 'softwareVersion': '2.0.21', 'timezone': 'America/New_York', 'online': True, 'surplusGrain': False, 'powerType': 1, 'powerMode': 1, 'electricQuantity': 0, 'batteryState': 'low', 'vacuumState': True, 'pumpAirState': True, 'vacuumMode': 'NORMAL', 'lowBatteryState': None, 'enableSound': True, 'enableLight': True, 'enableFeedingPlan': True, 'enableAutoUpgrade': True, 'nextFeedingDay': None, 'nextFeedingTime': '02:00', 'nextFeedingEndTime': None, 'planState': None, 'nextFeedingQuantity': 2, 'autoChangeType': None, 'autoThreshold': None, 'wifiRssiLevel': 4, 'wifiRssi': -36, 'productKey': None, 'useWaterType': None, 'remainingReplacementDays': None, 'remainingCleaningDays': None, 'useWaterInterval': None, 'useWaterDuration': None, 'exceptionMessage': 'Low food levels', 'todayTotalMl': 0, 'weightPercent': 0, 'weight': 0.0, 'grainOutletState': True, 'snowflake': True, 'temperature': None, 'platePosition': None, 'deviceShareState': 3, 'deviceCloudStorageState': None, 'shareId': None, 'unitType': 2, 'enableBatteryPercent': False, 'barnDoorState': True, 'barnDoorError': False, 'coverOpenMode': 'KEEP_OPEN', 'errorState': False, 'doorErrorState': 'NORMAL', 'bowlMode': None, 'whetherInSleepMode': None, 'imageId': 'd8eba6c52cda41e480b3711ccdb2c6ad', 'imageName': 'Dark coffee'}]}
1 Like

@flifloo you want us to make github issues? or do initial dev here.

Got the integration installed, but no devices have showed up, is there anything else I need to do in order to have the devices and their associated entities?

Yes, a new issue would be fantastic, you can create a New device issue here.

@epiphanyplx Once created, if the model is the same, you can follow and help us if you want

1 Like

Hey o/

As written at the top of the first message, there is only one device supported at this time.

You can follow my last message to open an issue for each missing device if not already open (the Dockstream Connect and One RFID may open soon)

Ok I just opened two issues. If you need any help just let me know.

+1 for the One RFID, have one coming tomorrow, very willing to help test anything. Will likely be getting a second 1 aswell.

Just opened an issue for the One RFID (PLAF301). @jbrukardt, feel free to comment on the issue on Github with any information you have. would love to work with you to get this working like a dream :slight_smile:

Hi there!

Just bought a PLAF103 - it looks like you’ve done some investigation in terms of this - I might be able to help out.

I should be able to capture any/all traffic from the app<->API - so I’ll hopefully be able to help with some of the reverse engineering.

1 Like