robmarkcole / HASS-plate-recognizer

Read number plates with https://platerecognizer.com/
128 stars 25 forks source link

Image filenames are very long and dont display well #65

Open craggyh opened 2 years ago

craggyh commented 2 years ago

Can the filenames generated be customized? I just need the format to be shorter to display neatly in my gallery browser card but the generated filename is something like platerecognizer_driveway_cam_jpg_2022-07-22_10-04-48 which is really long and messes us how things are displayed with text for thumbnails overlaying on top of each other etc.

craggyh commented 2 years ago

I actually found a workaround - custom gallery card- https://github.com/TarheelGrad1998/gallery-card. Use the caption option to convert "platerecognizer_driveway_cam_jpg_2022-07-22_10-04-48" to display as just "07/22 10:04 AM"

Calimerorulez commented 2 years ago

I actually found a workaround - custom gallery card- https://github.com/TarheelGrad1998/gallery-card. Use the caption option to convert "platerecognizer_driveway_cam_jpg_2022-07-22_10-04-48" to display as just "07/22 10:04 AM"

Hi @craigueh

Could you please share the yaml of the card you created with me? I'm having the same 'problem'. Thank you in advance.

craggyh commented 2 years ago

Here you go:

  • theme: Backend-selected title: Vehicles path: vehicles type: sidebar badges: [] cards:
    • type: custom:gallery-card entities:
      • media-source://media_source/media/ menu_alignment: bottom maximum_files: '10' caption_format: '%d/%m %H:%M %p' file_name_format: platerecognizer_driveway_camjpg%YYY-%m-%d_%H-%M-%S show_reload: true
    • type: vertical-stack cards:
      • type: entity entity: image_processing.platerecognizer_driveway_cam_jpg attribute: last_detection name: Last Detection
      • type: entity entity: image_processing.platerecognizer_driveway_cam_jpg attribute: vehicles name: Detected Plate
      • type: entity entity: image_processing.platerecognizer_driveway_cam_jpg attribute: watched_plates name: Watched Plates
      • type: entity entity: image_processing.platerecognizer_driveway_cam_jpg attribute: statistics name: Statistics view_layout: position: sidebar

I still have one issue with the _latest image not being parsed correctly. I don't know how to get around it. If I could disable the "latest" image being added each time a vehicle is detected that would also solve the problem.