PETLIBRO Cloud integration (non Tuya !) WIP

Have mitm working with petlibro + ios - so I can provide logs from that if you need.
Would really like to see manual feeding made available, but I don’t know enough of HA to make an extension yet :slight_smile:
I’ve dropped you the manual feeding info via chat.

Hey, ive been trying to read the packets from app to api and vice versa. But its encrypted via tls.1.3 how did you go about unencrypting the data?

The way I did it with iOS was using

This allows me to mitm anything coming out of my phone

Thanks for the link. I tried to do something like this with an emulated android device, and using a programme called fidler but newer android apps seem to have to specifically allow CA Certificates, otherwise it doesnt work…

Looks like i may need to edit the apk itself on android to get it working.

Thanks again anyway :slight_smile:

Hey Mezzle, before adding this extension I was trying to get the API to use the “feed now” feature in a “HTTP switch” like this user did with another brand of cat feeder Any chance your manual feeding info would work with this method? (would you mind sharing it with me too?) I cant wait to have the feeding now option on HA too. Thank you

I’ve started building the ability into the addon (and learning enough of HA’s code to do so!).

Here’s the call:-

POST /device/device/manualFeeding HTTP/1.1
source: IOS
language: EN
timezone: Europe/London
version: 1.3.62
accept-encoding: gzip
content-length: 92
host: api.us.petlibro.com
content-type: application/json; charset=utf-8
token: redacted

{"deviceSn":"SERIALNUMBER","grainNum":1,"requestId":"50ef5fdf9c8146bdba873934b1041200"}

HTTP/1.1 200 OK
Server: nginx/1.22.1
Date: Mon, 26 Aug 2024 00:15:42 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers

26
{"code":0,"msg":"Feeding...","data":3}
0

I believe that requestId is just a random MD5 to try and provide idempotency (if for whatever reason the request goes through multiple times, it’ll only feed once)
the grainNum is the “amount” - in 1/12th cup increments (or whatever equivalent you’ve set it to). The smallest amount you see on the manual feeding button is “1” - multiply it to get more :slight_smile:

You’ll need to use the token provided by logging in first - which will be the difficult bit.

also, make sure you set deviceSn to the right device!

2 Likes

Thank you so much! thanks to you I was able to make a Siri Shortcut and now I just press a philips hue button and it feeds my cat ( no more holding 5sec to unlock the feeder or opening petlibro app).

2 Likes

Would you be willing to share more api call urls?

Just realized I have the Tuya version, sooo. I applaud the efforts but won’t be able to help after all.

i have made a great start on adding support for PLAF301 i feel in my fork of this. of course i am certain there is a bunch of changes to the structure of things that you want to do @flifloo this is my first time coding in python, so i am sorry if things are a bit messy.
here are the current sensors and controls:

if someone wants to test to see how it works for them, try and use my fork. let me know what you think.

keep in mind that i will be itterating a lot - so i cant guarantee that everything will be working as you download it.

what i will be working on next is trying to implement control over the individual scheduled daily feedings.
i am also going to try and convert the manual feed switch into a button entity instead, as that is probably more appropriate.

3 Likes

I also bought a Petlibro feeder, the PLAF203S specifically, a few weeks ago and was surprised that my model differs from the old PLAF203 (non S variants) that support local tuya.

I have been following this thread and the other one about the petlibro feeders (PetLibro cat feeder) which also provided valuable information to support my own reverse engineering efforts.

My personal goal was to have the device running locally with the feeding features and not having to communicate with Petlibro’s platform at all.

I published my findings including a working AppDaemon python integration on my github: https://github.com/icex2/plaf203

Some key highlights:

  • Local integration using AppDaemon
  • Communicate with feeder using its default MQTT protocol
  • (Nearly) fully reverse engineered application level messaging protocol on top of MQTT
  • Kinda “everything” works except for the video and audio streaming because it uses a 3rd party SaaS platform

Please take some time and have a thorough read of the readme I provided.

2 Likes

I’m thinking of getting the plaf103 which is how I stumbled across this thread. Based on the conversation so far, is it correct to assume that all the calls to make this work with HASS are still being routed out to Petlibro’s servers?

Thanks!

Unfortunately, for the newer models yes. I believe there is someone who’s got into another device, which may provide some information - but for now, we only know that the device communicates to an MQTT server, which is controlled by the API - I know there are people out there trying to get into this though

1 Like

I just got the water fountain as a gift. I was excited for integrate into TUYA but now I’m seeing that there is a HACS options.
But after install and config, I don’t see my water fountain yet.
if I can provide any assistance or help, please let me know

I have both the PLWF105 water fountain and the PLAF103 granary feeder. I’m also available to help test and give feedback.

Hey, Hi, Hello everyone!

I stumbled across @flifloo and @dimitri.landerloos work on the RFID setup and did some work of my own.

If any of you want to go review/go over it the repo I have put together is this one. Feel free to import it to HA and test it out. It is 100% working as of right now without errors :+1:t2: just missing some buttons :rofl:

Supported Devices

This has been reworked to work with the following devices

  • One RFID Smart Feeder (PLAF301)
  • Dockstream RFID Smart Fountain (PLWF305)

May or may not work as intended with

  • Granary Feeder (PLAF103)

Features

  • This is still a WIP integration, features may or may not be removed at any time. If you have suggestions please let me know.
  • Features missing, but in the works.

    Buttons for scheduling - One RFID Smart Feeder (PLAF301)

    Buttons to reset Cleaning/Filter Days - Dockstream RFID Smart Fountain (PLWF305)

    Tracking RFID per pet intance eat/drink - Both (PLAF301) & (PLWF305) - Currently missing the API to setup tracking.

One RFID Smart Feeder Preview

And here is

Dockstream RFID Smart Fountain Preview

Updated - repo changed to GitHub - jjjonesjr33/petlibro: PETLIBRO Home Assistant integration

:rocket: Enhanced integration: Revamped API, polished platform functionality, and improved logging for a smoother experience!

Since this is a lot better than what i have managed to get working so far - you should probably just make this a pull request into the original repo.

I don’t know if I can just add it to the main repo at this point, I changed a ton of stuff when it comes to logging in , how it loads and stores devices, and the api calls.

I might just have to keep this as it’s own or move it to a separate repo and just re-import what I’ve done.

So far though testing with adding my repo into HACS it pulls correctly and if I update the release it pushes it to HACS too. First time I’ve done something like that so :smiley: learning something new all the time.