PETLIBRO Cloud integration (non Tuya !) WIP

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.

4 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!

1 Like

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.

No matter what I do, I can’t seem to find any devices when I install the integration from any repo. I’m using a PLAF103 and the device has been shared to a separate account. Any idea what may be causing this issue? Thanks.

Since yours seems to be way further along, would you mind pulling in the other devices that people have added? Notably the the PLWF105 water fountain and the PLAF103 granary feeder. Not sure if @flifloo is still interested in owning this project since he hasn’t touched it in a couple months. It might be best for everyone to rally around your repo?

Yeah I don’t mind at all working/building it for the other devices. Just throwing this out there tho I’m kind of a visual guy so if I could get a test account that has shared access to the devices we need to get added I can get it done. totally would help me see the live data it pulls to know what to code.

On the repo side of things that might be the way to go at this point? But if that’s the case I would need to migrate the repo instead of branching off. I probably should do that anyway since I’m a branch of a branch at this point.

I’ll get that setup here shortly and get things up and going.

The PLAF103 may not be enabled if you are using my build, you could throw this in your configuration.yaml for home assistant and see what it pulls from the logs.

logger:
  default: warning  # Default log level for all components
  logs:
    custom_components.petlibro: debug    # Enable debug logging for your component

Repo has been updated to GitHub - jjjonesjr33/petlibro: PETLIBRO Home Assistant integration I can now take a look at any other devices that people may have. :smiley: