Skip to content

5. Visualizing the data

Arjan edited this page Apr 21, 2024 · 30 revisions

Static data and relatime combined

Using 'multiple entity row' card

image

Vehicle positions

When vehcile positions have been added to the configuration, a geojson file is created in your wwww/gtfs2 folder You can create entities with position, using the geojson integration, refering to that file

important: filename is case sensitive

image

Example geojson entity:

image Note: to make the entity unique, the name of the entity is a combination of the route 'B', the direction '(0)' and the last 3 digites of the trip_id

Then you can configure a Map card to show the positions of active vehicles along that route

image

Note: geojson currently only updates each 5 minutes and can not be refreshed by a service call

Local stops and departures

image

image

type: custom:auto-entities
filter:
  include:
    - name: '*_local_stop'
  exclude:
    - state: unavailable
card:
  type: custom:flex-table-card
  clickable: true
  max_rows: 30
  title: Local Stop dep.
  strict: true
  sort_by:
    - next_departures_lines
  columns:
    - hidden: true
      data: next_departures_lines
      modify: x.departure
    - name: Route
      data: next_departures_lines
      modify: '''<ha-icon icon='' + x.icon + ''></ha-icon>'' + x.route'
    - name: Time
      data: next_departures_lines
      modify: x.departure
    - name: Stop
      data: next_departures_lines
      modify: x.stop_name
    - name: Headsign
      data: next_departures_lines
      modify: x.headsign
  css:
    table+: 'padding: 0px'
  card_mod:
    style: |
      ha-card {
        overflow: auto;
        max-height: 500px;
      }

Local stops and departures: filtering certain routes

Note: I cannot get this to work with flex-table-card

image

type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_text.local_stops_filter
  - type: markdown
    content: >-
      <table>  {% set next =
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')%}
      {% for i in range(0, next | count, 1) %} {%- if
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].route 
        == states("input_text.local_stops_filter") -%}
      <tr> <td>{{
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].route
      }}</td> <td>{{
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].departure
      }}</td> <td>{{
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].stop_name
      }}</td> <td>{{
      state_attr('sensor.01254_0608400_local_stop_person_abcd','next_departures_lines')[i].headsign
      }}</td> {% endif %} {% endfor %}
    card_mod:
      style:
        .: |
          ha-card ha-markdown {
                    padding:0px
                    border-top: 1px groove var(--divider-color);
                    overflow-y: scroll;
                    height: 300px;
                  }
          ha-card ha-markdown.no-header {
            padding:0px
          }
        $: |
          h1.card-header {
            background-color:rgb(100, 100, 100);
              padding: 0px 0px 0px 12px !important;
              color: white !important;
              font-weight: normal;
              font-size: 1.5em !important;
              border-top-left-radius: 5px; 
              border-top-right-radius: 5px; 
              height: 100%;
          }        
        ha-markdown $: |
          h1 {
              font-weight: normal;
              font-size: 24px;
          }
          table{
            border-collapse: collapse;
            font-size: 0.9em;
            font-family: Roboto;
            width: 100%;
            outline: 0px solid #393c3d;
            margin-top: 10px;
          }
          td {
              padding: 5px 5px 5px 5px;
              text-align: left;
              border-bottom: 0px solid #1c2020;
          }
          tr:nth-of-type(even) {
              background-color: rgb(54, 54, 54, 0.3);
          }

Local stops: travelling solution

I tied the update to my person. entity and when I move around I click two buttons to see what is near me

  • Location update (just in case it is not updating fast enough)
  • Local stops update: this updates every entity with local stops tied to my name, I have this setup for France, Switzerland and Netherlands. The map nicely follows me around and adds the stops

image

Clone this wiki locally