custom-cards / flex-table-card

Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept
GNU General Public License v3.0
198 stars 23 forks source link

TypeError: m[0].map is not a function Error Message #10

Closed gcobb321 closed 5 years ago

gcobb321 commented 5 years ago

I am trying to set up a simple list table that will take attributes within en entity and list them and am having a problem getting it working. Below is a sample of the attribute and how I have setup the card. I'm running HA 0.90.1. When the invalid function error is displayed, the card disappears from the lovelace screen.

Am I missing something?

I am the developer of the icloud3 device_tracker program (go here for information about it) so I can change the program if something related to how the attribute list & dictionary is set u is needed. My goal is to keep an event log of significant events while determining the location of an iphone and then display them. Since I'm keeping this log im memory, only the last 400 entries will be kept.

jinja query and result: {{ states.sensor.icloud3_event_log.attributes.eventlog }}

[{'fname': 'Gary', 'time': '14:22:21', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Command: event_log .'},{'fname': 'Gary', 'time': '14:10:25', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Update Complete'},{'fname': 'Gary', 'time': '14:10:25', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'IOS App Data Prepared (27.726639,-80.3904565)'},{'fname': 'Gary', 'time': '14:10:25', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Update via IOS trigger'},{'fname': 'Gary', 'time': '14:10:25', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Moving back into last zone'},{'fname': 'Gary', 'time': '14:10:25', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'New Trigger Background Fetch @ 14:09:56'},{'fname': 'Gary', 'time': '14:01:51', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Command: event_log .'},{'fname': 'Gary', 'time': '14:00:10', 'zone': 'home', 'dist': '0mi', 'trav': '', 'interval': '2 hrs', 'text': 'Update Complete'},{'fname': 'Gary', 'time': '14:00:10', 'zone': '', 'dist': '', 'trav': '', 'interval': '0 sec', 'text': 'iCloud Data Prepared (27.72679575618569,-80.39053289340372)'},{'fname': 'Gary', 'time': '14:00:10', 'zone': '', 'dist': '', 'trav': '', 'interval': '0 sec', 'text': 'Zone=not_set'},{'fname': 'Gary', 'time': '14:00:05', 'zone': '', 'dist': '', 'trav': '', 'interval': '0 sec', 'text': 'Cancelled, Old data, Age=9.5m'},{'fname': 'Gary', 'time': '14:00:05', 'zone': '', 'dist': '', 'trav': '', 'interval': '0 sec', 'text': 'iCloud Data Prepared (27.72666067040769,-80.39055797966861)'},{'fname': 'Gary', 'time': '14:00:05', 'zone': '', 'dist': '', 'trav': '', 'interval': '0 sec', 'text': 'Old Location Data'}]

My lovelace card set up

type: custom:flex-table-card
  title: iCloud3 Event Log
  entites:
    include: sensor.icloud3_event_log
  columns:
    - name: Time 
      attr_as_list: eventlog
      modify: x.time
    - name: Zone
      attr_as_list: eventlog
      modify: x.zone
    - name: Dist
      attr_as_list: eventlog
      modify: x.dist

The error displayed in the HA log file 2019-04-01 14:24:12 ERROR (MainThread) [frontend.js.latest.201903210] https://cobbha.duckdns.org/local/custom_lovelace/flex-table-card.js?v=1:4:23 Uncaught TypeError: m[0].map is not a function

daringer commented 5 years ago

mmmh, there is no error check (yet) to verify that there is actually a list inside the attribute refered in attr_as_list, as this is actually how the error is looking like.

Did you try?

gcobb321 commented 5 years ago

Thanks for the reply. I went in another direction.