Aln-Symfony is a replacement for the Aln original API powering pet feeding machines.
It is a pure PHP Symfony implementation of my legacy Aln-NodeJs implementation. It relies heavily on tests to prevent regressions.
This API is hosted on http://api.feedmypet.app. Please use it with your machine if you feel to!
Because the original API is not secure, not maintained, and as of the latest news, is offline.
When the original (not-secured) API was still alive, I was able to use it to reverse engineer the whole set of communications between my pet feeding machine, and their server. Then, I could spoof their connection to my server, and make my machine communicate with only my server
You will find a hosted version of this server that you can use for your machine without self-hosting the code if you want:
Above, you'll also find a Swagger UI that will document available endpoints, responses and body requirements for each of them.
POST user/register
with your email in the body. It'll send an email with an activation link. For now this link is dead, but note the token in this URL for the next step.POST user/reset/consume
with the above in-url token to get your authorization token.GET user/me
will allow to make sure the token is valid, that you're authenticated. And it'll respond with your associated feeders ; and your user id. Note it for next step.PUT user/{id}
with your password to create (or update) your password.Please note that POST user/register will send a reset password mail if the email already exists (see below)
POST user/reset
with your email in the body. It'll send an email with an activation link. For now this link is dead, but note the token in this URL for the next step.POST user/reset/consume
with the above in-url token to get your authorization token.Please note that POST user/reset will sent a 200 response code even if the email does not exists.
POST user/login
with your email & password in the body to get your authorization token.Before anything, you need to configure your feeder to communicate with our API.
HF-LPT120
.api.feedmypet.app
(or your local IP if you deploy the app yourself)TCP-Client
; and Port ID is 9999
POST /feeders/associate
with your feeder identifier. The identifier of your feeder is in your feeder manual. You can also get it by scanning the QR Code inside your feeder. Mine is ALE
followed with 9 digits.GET user/me
will send you the list of associated feeder ids. Note the number associated to your feeder for next callsGET feeders/{id}
will send you current status & parameters of your feeder.PUT feeders/{id}
with a name; to set a name to your feeder. I use the name of my pet for this.POST feeders/{id}/feed
with an amount between 5 and 150 grams. Trigger an immediate meal.PUT feeders/{id}/amount
with an amount between 5 and 150 grams. Set the amount of food distributed when you press the button.PUT feeders/{id}/planning
with a set of meals. Allow to update the planned meals times and amount. Note that hours should be provided in UTC timezone, and is not sensitive to DST.Tests run using a Docker environment:
composer install
docker-compose up -d
.composer test
.
APP_ENV=prod
APP_SECRET=
DATABASE_URL="mysql://user>:<password>@<host:
RABBITMQ_HOST=127.0.0.1 RABBITMQ_PORT=5672 RABBITMQ_USERNAME=guest RABBITMQ_PASSWORD=guest
- Install dependencies:
```shell
composer install --optimize-autoloader
Even if authentication is left disabled, you need to generate a jwt pair of keys:
./bin/console lexik:jwt:generate-keypair
Expose the Symfony /public/index.php using your preferred method. (I prefer nginx)\ See https://symfony.com/doc/current/deployment.html
Start the websocket for your feeder to connect to. Using something like supervisor is recommended.
./bin/console aln:socket:run
Now you can follow the steps for configuring your feeder above, and use it. If you do not enable authentication, you can skip all the authentication steps and use your feeder directly!