Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Control over individual feeding schedules #26

Open
1 task done
C4-Dimitri opened this issue Nov 17, 2024 · 1 comment
Open
1 task done

[Feature Request]: Control over individual feeding schedules #26

C4-Dimitri opened this issue Nov 17, 2024 · 1 comment
Assignees
Labels
Documentation Improvements or additions to documentation Enhancement New feature or request

Comments

@C4-Dimitri
Copy link
Contributor

C4-Dimitri commented Nov 17, 2024

Device model name

I think all feeder models?

Device model number

I think all feeder models?

Device type

Feeder

Feature name

Control over individual feeding schedules

Describe the feature

Create, delete, enable and disasble specific feedings in the schedule.

prefereable to scheduling it with HA automations, as i believe that these schedules will be stored in the feeder, so will still trigger if internet is down, whereas from HA it wont, as we have to send manual feeding events to the API.

enable and disable already created individual feedings in the schedule:
https://api.us.petlibro.com/device/feedingPlan/enable
Post: Disable command:

{
  "deviceSn": "AF06013AF056214A2",
  "planId": 1270679,
  "enable": false
}

Post: enable command:

{
  "deviceSn": "AF06013AF056214A2",
  "planId": 1270679,
  "enable": true
}

Post: Add a new feeding plan feed:
https://api.us.petlibro.com/device/feedingPlan/add

{
  "id": 0,
  "deviceSn": "AF06013AF056214A2",
  "executionTime": "23:59",
  "repeatDay": "[1,3,5]",
  "label": "Test",
  "enable": false,
  "enableAudio": true,
  "audioTimes": 1,
  "grainNum": 2,
  "petIds": []
}

repeat day refers to the days to repeat, 1 is Monday, 2 is Tuesday, 3 is Wednesday, etc.
i dont see what petIds is for, as i see no selection for the pet, when i create a feeding.
i also dont know why it sets it to enable: false, since as soon as the add is triggered that new feed is active?

Post: remove an existing feeding plan:
https://api.us.petlibro.com/device/feedingPlan/remove

{
  "deviceSn": "AF06013AF056214A2",
  "planId": 1679548
}

for all of these the API response data is the same:

{
  "code": 0,
  "msg": null,
  "data": null
}

We can of course get all of the active feeding plans for the specific feeder via this:
https://api.us.petlibro.com/device/feedingPlan/list
Get: list all feedings in schedule.

{
  "id": "AF06013AF056214A2"
}

response:

{
  "code": 0,
  "msg": null,
  "data": [
    {
      "id": 1270679,
      "memberId": 189153051,
      "productIdentifier": "PLAF301",
      "deviceSn": "AF06013AF056214A2",
      "executionTime": "04:00",
      "repeatDay": "[7,2,1,3,4,5,6]",
      "label": "1st",
      "enable": true,
      "enableAudio": false,
      "audioTimes": 2,
      "grainNum": 1,
      "timezone": "Europe/London",
      "syncState": 3,
      "createTime": 1725628462000,
      "updateTime": 1731838705000,
      "petInfo": []
    },
    {
      "id": 1270681,
      "memberId": 189153051,
      "productIdentifier": "PLAF301",
      "deviceSn": "AF06013AF056214A2",
      "executionTime": "10:00",
      "repeatDay": "[7,1,2,3,5,6,4]",
      "label": "2nd",
      "enable": true,
      "enableAudio": false,
      "audioTimes": 2,
      "grainNum": 1,
      "timezone": "Europe/London",
      "syncState": 3,
      "createTime": 1725628487000,
      "updateTime": 1725628487000,
      "petInfo": []
    },
    {
      "id": 1270686,
      "memberId": 189153051,
      "productIdentifier": "PLAF301",
      "deviceSn": "AF06013AF056214A2",
      "executionTime": "16:00",
      "repeatDay": "[7,1,2,3,4,5,6]",
      "label": "3rd",
      "enable": true,
      "enableAudio": false,
      "audioTimes": 2,
      "grainNum": 1,
      "timezone": "Europe/London",
      "syncState": 3,
      "createTime": 1725628503000,
      "updateTime": 1725628505000,
      "petInfo": []
    },
    {
      "id": 1270688,
      "memberId": 189153051,
      "productIdentifier": "PLAF301",
      "deviceSn": "AF06013AF056214A2",
      "executionTime": "22:00",
      "repeatDay": "[7,1,2,3,4,5,6]",
      "label": "4th",
      "enable": true,
      "enableAudio": false,
      "audioTimes": 2,
      "grainNum": 1,
      "timezone": "Europe/London",
      "syncState": 3,
      "createTime": 1725628520000,
      "updateTime": 1731764987000,
      "petInfo": []
    }
  ]
}

so the id in this list, is the same as the planId refered to in the other commands.

What problem does this feature solve?

Able to control feeding schedules for individual feeds.

Available to help with the feature development

  • I agree to help with testing or providing relevant information for this feature request
@C4-Dimitri
Copy link
Contributor Author

The above enable and disable refer to enabling and disabling scheduled feedings ENTIRELY - not just for the day. the enpoints for just the day are:

Individual Feedings Today:
https://api.us.petlibro.com/device/feedingPlan/enableTodaySingle
Post: Disable command:

{
  "deviceSn": "AF0601314D89978A9",
  "enable": false,
  "planId": 1306270
}

Post: Enable command:

{
  "deviceSn": "AF0601314D89978A9",
  "enable": true,
  "planId": 1306270
}

All Feedings Today:
https://api.us.petlibro.com/device/feedingPlan/enableTodayAll
Post: Disable Command:

{
  "deviceSn": "AF0601314D89978A9",
  "enable": false
}

Post: Enable Command:

{
  "deviceSn": "AF0601314D89978A9",
  "enable": true
}

and then we can get a list of all the scheduled feedings for TODAY here:
https://api.us.petlibro.com/device/feedingPlan/todayNew
Post:

{
  "id": "AF06013AF056214A2"
}

Response:

{
  "code": 0,
  "msg": null,
  "data": {
    "plans": [
      {
        "planId": 1270679,
        "index": 1,
        "time": "04:00",
        "grainNum": 1,
        "state": 3,
        "repeat": true
      },
      {
        "planId": 1270681,
        "index": 2,
        "time": "10:00",
        "grainNum": 1,
        "state": 3,
        "repeat": true
      },
      {
        "planId": 1270686,
        "index": 3,
        "time": "16:00",
        "grainNum": 1,
        "state": 3,
        "repeat": true
      },
      {
        "planId": 1270688,
        "index": 4,
        "time": "22:00",
        "grainNum": 1,
        "state": 4,
        "repeat": true
      }
    ],
    "allExpired": true,
    "allSkipped": true
  }
}

i believe that i have figured out most of the states.

1 = Enabled Feeding, Not yet happened.
2 = Disabled Feeding, Not yet happened.
3 = Enabled Feeding, Completed.
4 = Disabled Feeding, Time Passed

There may be a few more for unsuccessful feeds - not entirely sure as this is difficult to test for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation Enhancement New feature or request
Projects
Status: To triage
Development

No branches or pull requests

2 participants