royto / logbook-card

Logbook card for Home Assistant UI Lovelace
GNU General Public License v3.0
192 stars 9 forks source link

Unable to display attribute #44

Open gulli1986 opened 3 years ago

gulli1986 commented 3 years ago

I have an entity attribute (named 'vehicles') that looks like this (plate recognizer integration):

- vehicles:
  - plate: XXXXX
    confidence: 0.9
    region_code: gb
    vehicle_type: Sedan

Here is what the logbook-card is showing: Capture

And here is how I configured the card:

      - type: custom:logbook-card
        entity: image_processing.platerecognizer_driveway
        history: 1
        max_items: -1
        title: Latest plates recognized (last 24h)
        show:
          state: true
          duration: false
          start_date: true
          end_date: false
          icon: true
          separator: true
        attributes:
          - value: vehicles

Is there a way to display the vehicles attributes with all of its values?

Thanks.

royto commented 3 years ago

Can you try with

   attributes:
          - value: vehicles.plate

What do you expect ? that all vehicules props are rendered ?

royto commented 3 years ago

find way to test this. My suggestion does not work. Will try to fix this soon

gulli1986 commented 3 years ago

@royto , thanks! I can mention that I tried both:

attributes:
          - value: vehicles.plate

and

attributes:
          - value: vehicles['plate']

But it didn't help.

royto commented 3 years ago

Should be fixed in 1.4.1

gulli1986 commented 3 years ago

Hello @royto, thanks for you looking at it. I updated to 1.4.1, however I still cannot display all of the vehicle attribute:

Config:

      - type: custom:logbook-card
        entity: image_processing.platerecognizer_driveway
        history: 1
        max_items: -1
        title: Latest plate recognized - history
        show:
          state: true
          duration: false
          start_date: true
          end_date: false
          icon: true
          separator: true
        attributes:
          - value: vehicles

Entity (image_processing.platerecognizer_driveway):

last_detection: 2021-09-08_16-53-14
vehicles:
  - plate: AB12345
     confidence: 0.902
     region_code: gb
     vehicle_type: Sedan
orientation: []
statistics:
  total_calls: 2500
  usage:
    year: 2021
    month: 9
    resets_on: '2021-09-10T23:59:43.752029Z'
    calls: 143
  calls_remaining: 2357
save_file_folder: /config/www/platerecognizer
save_timestamped_file: true
always_save_latest_file: false
unit_of_measurement: plate
friendly_name: platerecognizer_driveway

Lovelace: Capture

royto commented 3 years ago

Ok. I need to handle recursivity

royto commented 3 years ago

@gulli1986 Could you provide me the response body from the http call (using dev tools > network)

URL should be like https://your_instance/api/history/period/2021-09-13T19:22:41.097Z?filter_entity_id=your_entity&end_time=2021-09-14T19:22:41.097Z

gulli1986 commented 3 years ago

Hello @royto, see below:

[[{"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-13_15-35-13", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 313}, "calls_remaining": 2187}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-13T19:46:01.825000+00:00", "last_updated": "2021-09-13T19:46:01.825000+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "1", "attributes": {"last_detection": "2021-09-14_08-13-49", "vehicles": [{"plate": "ek94837", "confidence": 0.903, "region_code": "no", "vehicle_type": "Sedan"}], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": true}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 318}, "calls_remaining": 2182}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T06:13:54.361882+00:00", "last_updated": "2021-09-14T06:13:54.361882+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-14_08-42-42", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 320}, "calls_remaining": 2180}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T06:43:27.360163+00:00", "last_updated": "2021-09-14T06:43:27.360163+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "1", "attributes": {"last_detection": "2021-09-14_11-50-28", "vehicles": [{"plate": "aj89411", "confidence": 0.818, "region_code": "no", "vehicle_type": "Sedan"}], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 324}, "calls_remaining": 2176}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T09:50:32.607539+00:00", "last_updated": "2021-09-14T09:50:32.607539+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-14_12-11-32", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 326}, "calls_remaining": 2174}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T10:12:06.471361+00:00", "last_updated": "2021-09-14T10:12:06.471361+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "1", "attributes": {"last_detection": "2021-09-14_14-44-35", "vehicles": [{"plate": "ek94831", "confidence": 0.812, "region_code": "no", "vehicle_type": "Sedan"}], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 328}, "calls_remaining": 2172}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T12:44:38.647592+00:00", "last_updated": "2021-09-14T12:44:38.647592+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-14_15-29-19", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 333}, "calls_remaining": 2167}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T13:29:46.498019+00:00", "last_updated": "2021-09-14T13:29:46.498019+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "1", "attributes": {"last_detection": "2021-09-14_15-48-05", "vehicles": [{"plate": "ek94837", "confidence": 0.899, "region_code": "no", "vehicle_type": "Sedan"}], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": true}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 334}, "calls_remaining": 2166}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T13:48:09.927163+00:00", "last_updated": "2021-09-14T13:48:09.927163+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-14_15-48-05", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 335}, "calls_remaining": 2165}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T13:49:12.750835+00:00", "last_updated": "2021-09-14T13:49:12.750835+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "1", "attributes": {"last_detection": "2021-09-14_19-07-35", "vehicles": [{"plate": "aj89415", "confidence": 0.845, "region_code": "no", "vehicle_type": "Sedan"}], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 343}, "calls_remaining": 2157}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T17:07:39.790338+00:00", "last_updated": "2021-09-14T17:07:39.790338+00:00"}, {"entity_id": "image_processing.platerecognizer_driveway", "state": "0", "attributes": {"last_detection": "2021-09-14_19-07-35", "vehicles": [], "orientation": [], "watched_plates": {"aj89419": false, "ek94837": false}, "statistics": {"total_calls": 2500, "usage": {"year": 2021, "month": 9, "resets_on": "2021-10-10T23:59:43.752029Z", "calls": 344}, "calls_remaining": 2156}, "regions": ["no"], "save_file_folder": "/config/www/platerecognizer", "save_timestamped_file": true, "always_save_latest_file": false, "unit_of_measurement": "plate", "friendly_name": "platerecognizer_driveway"}, "last_changed": "2021-09-14T18:58:47.324616+00:00", "last_updated": "2021-09-14T18:58:47.324616+00:00"}]]