jjjonesjr33 / petlibro

Petlibro | Home Assistant integration
https://community.home-assistant.io/t/petlibro-cloud-integration-non-tuya-wip/759978
GNU General Public License v3.0
14 stars 5 forks source link

[Feature Request]: OneRFIDFeeder - Light Matrix Display Switch #20

Open C4-Dimitri opened 1 day ago

C4-Dimitri commented 1 day ago

Device model name

OneRFIDFeeder

Device model number

PLAF301

Device type

Feeder

Feature name

Light Matrix Display Switch

Describe the feature

Turn on and off the light display matrix - we can look into changing what is displayed later.

API endpoint: https://api.us.petlibro.com/device/setting/updateDisplayMatrixSetting

post request data (this is for an off request):

{
  "deviceSn": "AF06013AF056214A2",
  "screenDisplayAgingType": 1,
  "screenDisplayStartTime": null,
  "screenDisplayEndTime": null,
  "screenDisplaySwitch": false
}

response data:

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

post request data (this is for an on request):

{
  "deviceSn": "AF06013AF056214A2",
  "screenDisplayAgingType": 1,
  "screenDisplayStartTime": null,
  "screenDisplayEndTime": null,
  "screenDisplaySwitch": true
}

response data:

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

What problem does this feature solve?

Currently only able to control the screen from the petlibro app.

Available to help with the feature development

C4-Dimitri commented 1 day ago

found the different ID's of the built in different light configs (at least the ones that i have)

id 5 = Heart Image id 7 = Cat Image id 6 = Dog Image id 8 = Elk Image id null = ANY Letters, HELLO or anything Custom Written.

so all requests with an ID look like this to the endpoint:

https://api.us.petlibro.com/device/device/displayMatrix

{
  "deviceSn": "AF06013AF056214A2",
  "screenDisplayId": 5,
  "screenDisplayMatrix": null,
  "screenLetter": "HELLO"
}

response is the same for all so i wont repeat it:

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

then any with null in the display id have the screen letter filled in like this:

{
  "deviceSn": "AF06013AF056214A2",
  "screenDisplayId": null,
  "screenDisplayMatrix": null,
  "screenLetter": "JAMIE JONES"
}

So i think we can probably build this in too! with an input text for custom messages and then a send to feeder button, and maybe an input select for the default id's?

character limit is 20, only accepts alphanumeric (and spaces) characters (not sure about different languages), and minimum 1 character. space is not allowed as the first character if it s the only character. but if other characters are there you can have as many spaces in the front as you like.

jjjonesjr33 commented 22 hours ago

Awesome work @C4-Dimitri I'll do some testing with this once I'm home.

jjjonesjr33 commented 15 hours ago

Tested, and it works great. The only thought I had was to shorted the naming on the buttons and in the translations

        PetLibroButtonEntityDescription[OneRFIDSmartFeeder](
            key="manual_lid_open",
            translation_key="manual_lid_open",
            set_fn=lambda device: device.set_manual_lid_open(),
            name="Open Lid"
        ),
        PetLibroButtonEntityDescription[OneRFIDSmartFeeder](
            key="display_matrix_on",
            translation_key="display_matrix_on",
            set_fn=lambda device: device.set_display_matrix_on(),
            name="Turn On Display"
        ),
        PetLibroButtonEntityDescription[OneRFIDSmartFeeder](
            key="display_matrix_off",
            translation_key="display_matrix_off",
            set_fn=lambda device: device.set_display_matrix_off(),
            name="Turn Off Display"
        )
            "manual_lid_open": {
                "name": "Open Lid"
            },
            "display_matrix_on": {
                "name": "Turn On Display"
            },
            "display_matrix_off": {
                "name": "Turn Off Display"
            }