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]: "Last Feed Time" #37

Open
1 task done
brwyatt opened this issue Nov 25, 2024 · 2 comments
Open
1 task done

[Feature Request]: "Last Feed Time" #37

brwyatt opened this issue Nov 25, 2024 · 2 comments
Assignees
Labels
Enhancement New feature or request Pending Pending

Comments

@brwyatt
Copy link

brwyatt commented Nov 25, 2024

Device model name

Granary

Device model number

PLAF103

Device type

Feeder

Feature name

"Last Feed Time"

Describe the feature

Sensor that has the last time the feeder dispensed food. Possibly another sensor that has the last feed amount. Also could be reasonable if it was an attribute on the feed counter as well.

One feature I miss about the PetSafe integration (for the PetSafe Smart Feed feeder) was a sensor that stated the last feed time. Right now I can kinda fake this, and use the "last changed" time, but this will also include when the timer resets to 0 every day.

What problem does this feature solve?

Being able to keep track of the last feed time (and a good proxy for seeing if something went wrong)

Available to help with the feature development

  • I agree to help with testing or providing relevant information for this feature request
@jjjonesjr33 jjjonesjr33 added the Enhancement New feature or request label Nov 25, 2024
@github-project-automation github-project-automation bot moved this to To triage in Petlibro Nov 25, 2024
@C4-Dimitri
Copy link
Contributor

@jjjonesjr33 , we could potentially do something like this via this endpoint?
https://api.us.petlibro.com/device/workRecord/list

post request:

{
  "deviceSn": "AF06013AF056214A2",
  "startTime": 1727388467369,
  "endTime": 1732572467369,
  "size": 5,
  "type": []
}

startTime and EndTime are timestamps. they refer to the time of the request and 24 hours after.
size refers to the amount of events to return. they use 5 when requesting the events when initially loading a feeder as those 5 are shown on the front page of the feeder. we could probably just request 20 or so, to ensure we definitely catch a GRAIN_OUTPUT_SUCCESS or FEEDING_PLAN_SUCCESS (depending on what we decide is best to record) event.

response data:

{
  "code": 0,
  "msg": null,
  "data": [
    {
      "recordTime": "2024/11/25",
      "dayOfWeek": 1,
      "workRecords": [
        {
          "id": "78a5d2bfbc3f4f6fa72c42b794dc525e",
          "productIdentifier": null,
          "deviceSn": "AF06013AF056214A2",
          "type": "DETECTION_EVENT",
          "eventType": "PET_IDENTIFY_LEAVE_EVENT_BIND_PET",
          "expectGrainNum": null,
          "actualGrainNum": null,
          "electricQuantity": null,
          "recordTime": 1732572449000,
          "formatRecordTime": "2024-11-25 22:07",
          "createTime": 1732572469147,
          "alarmTag": false,
          "content": "Jet came to eat and ate for 01m06s.",
          "totalMl": null,
          "drinkTime": null
        },
        {
          "id": "470ad184d8854145b7518f0da3bde2cc",
          "productIdentifier": null,
          "deviceSn": "AF06013AF056214A2",
          "type": "DETECTION_EVENT",
          "eventType": "PET_IDENTIFY_LEAVE_EVENT_BIND_PET",
          "expectGrainNum": null,
          "actualGrainNum": null,
          "electricQuantity": null,
          "recordTime": 1732572170000,
          "formatRecordTime": "2024-11-25 22:02",
          "createTime": 1732572189966,
          "alarmTag": false,
          "content": "Jet came to eat and ate for 02m06s.",
          "totalMl": null,
          "drinkTime": null
        },
        {
          "id": "642863c805a14ed4b26919d66d1cfee1",
          "productIdentifier": null,
          "deviceSn": "AF06013AF056214A2",
          "type": "GRAIN_OUTPUT_SUCCESS",
          "eventType": "FEEDING_PLAN_SUCCESS",
          "expectGrainNum": 1,
          "actualGrainNum": 1,
          "electricQuantity": null,
          "recordTime": 1732572000000,
          "formatRecordTime": "2024-11-25 22:00",
          "createTime": 1732572120274,
          "alarmTag": false,
          "content": "Feeding schedule successful. {actualGrainNum}{actualGrainUnit} dispensed.",
          "totalMl": null,
          "drinkTime": null
        },
        {
          "id": "43bf25e5b07a4949a84b4b3bd4e32deb",
          "productIdentifier": null,
          "deviceSn": "AF06013AF056214A2",
          "type": "DETECTION_EVENT",
          "eventType": "PET_IDENTIFY_LEAVE_EVENT_BIND_PET",
          "expectGrainNum": null,
          "actualGrainNum": null,
          "electricQuantity": null,
          "recordTime": 1732561903000,
          "formatRecordTime": "2024-11-25 19:11",
          "createTime": 1732561923550,
          "alarmTag": false,
          "content": "Jet came to eat and ate for 14s.",
          "totalMl": null,
          "drinkTime": null
        },
        {
          "id": "9341af31e4de4632be213850f4066dd7",
          "productIdentifier": null,
          "deviceSn": "AF06013AF056214A2",
          "type": "DETECTION_EVENT",
          "eventType": "PET_IDENTIFY_LEAVE_EVENT_BIND_PET",
          "expectGrainNum": null,
          "actualGrainNum": null,
          "electricQuantity": null,
          "recordTime": 1732558924000,
          "formatRecordTime": "2024-11-25 18:22",
          "createTime": 1732558943828,
          "alarmTag": false,
          "content": "Jet came to eat and ate for 01m15s.",
          "totalMl": null,
          "drinkTime": null
        }
      ]
    }
  ]
}

we would just need to iterate through the list to find the GRAIN_OUTPUT_SUCCESS or FEEDING_PLAN_SUCCESS and then return the actualGrainNum and formatRecordTime (or recordTime) into some sensors.

@jjjonesjr33
Copy link
Owner

It sounds like you’ve got a solid grasp on this, @C4-Dimitri. Would it be possible to implement this across all devices?

@jjjonesjr33 jjjonesjr33 moved this from To triage to Pending in Petlibro Dec 21, 2024
@jjjonesjr33 jjjonesjr33 added the Pending Pending label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Pending Pending
Projects
Status: Pending
Development

No branches or pull requests

3 participants