Advertisement
kornelremete

Flex Table Custom Card

Apr 24th, 2024
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | Software | 0 0
  1. type: custom:flex-table-card
  2. title: Pestre induló vonatok
  3. clickable: true
  4. entities:
  5. include:
  6. - sensor.mav_debrecen_bp_keleti
  7. - sensor.mav_debrecen_bp_nyugati_2
  8. sort: next_departures
  9. columns:
  10. - name: Indulás
  11. data: next_departures
  12. modify: |-
  13. if(x.length == 0)
  14. {"-"}
  15. else {
  16. var date = new Date(x);
  17. String(date.getHours()).padStart(2,'0')+":"+
  18. String(date.getMinutes()).padStart(2,'0')
  19. }
  20. - name: Célállomás
  21. data: next_departures_headsign
  22. modify: |-
  23. if (typeof x === 'string' && x.length > 0) {
  24. var match = x.match(/\(([^)]+)\)/);
  25. if (match) {
  26. match[1]
  27. } else {
  28. "-"
  29. }
  30. } else {
  31. "-"
  32. }
  33. - name: Vonal
  34. data: next_departures_lines
  35. modify: |-
  36. if (typeof x === 'string' && x.length > 0) {
  37. var match = x.match(/\(([^)]+)\)/);
  38. if (match) {
  39. var parts = match[1].split('/');
  40. if (parts.length > 1 && parts[0] === "None") {
  41. parts.splice(0, 1); // Remove the "None" part
  42. }
  43. parts.join('/');
  44. } else {
  45. "-"
  46. }
  47. } else {
  48. "-"
  49. }
  50. max_rows: 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement