Show your MLB game info

The current project is a card that will stay updated with my Braves. The background image will actually change based on the venue. I have been working on the code for the background image and now I just need to fill in with scores and other info I decide on.


I’m sure the code can be cleaned up, I pulled the code from HERE and just added it to what I was looking for. Having trouble coming up with a design for the Lovelace card.
Sensors:

#MLB sensors

  - platform: rest
    resource: http://statsapi.mlb.com/api/v1/schedule?sportId=1&teamId=144
    name: mlb_game_status
    scan_interval: 
      hours: 24
    value_template: '{{ value_json.dates[0].games[0].status.detailedState }}'
    json_attributes:
      - dates
  - platform: template
    sensors:

      mlb_away_score:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            No_Game
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["score"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Away
          {% else %}
            {{ states.sensor.mlb_game_status.attributes["dates"][0]["games"][0]["teams"]["away"]["team"]["name"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/mlb.com/builds/site-core/f1bd3a33969d8febdbcb23b1161db091cf3ae918_1561045539/images/logos/team-cap-on-light/{{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["team"]["id"] | int }}.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      mlb_game_time:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            No_Game
          {% else %}
          {% set time = states.sensor.mlb_game_status.attributes["dates"][0]["games"][0]["gameDate"] %}
          {% if (time[11:13]|int - 5) > 12 %}
            {{ (time[11:13]|int - 5 - 12)|string ~ time[13:16] }}
          {% else %}
            {{ (time[11:13]|int - 5)|string ~ time[13:16] }}
          {% endif %}
          {% endif %}
      mlb_home_score:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            No_Game
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["score"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Home
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["team"]["name"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/mlb.com/builds/site-core/f1bd3a33969d8febdbcb23b1161db091cf3ae918_1561045539/images/logos/team-cap-on-light/{{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["team"]["id"] | int }}.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      mlb_venue:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Park
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["venue"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Park
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["venue"]["name"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/mlb.com/builds/site-core/f1bd3a33969d8febdbcb23b1161db091cf3ae918_1561045539/images/logos/team-primary-on-light/{{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["team"]["id"] | int }}.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      home_pct:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Pct
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            PCT
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["leagueRecord"]["pct"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      away_pct:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Pct
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            PCT
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["leagueRecord"]["pct"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      home_wins:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            W
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Wins
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["leagueRecord"]["wins"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      away_wins:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            W
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Wins
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["leagueRecord"]["wins"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      home_losses:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            L
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Losses
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["home"]["leagueRecord"]["losses"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
      away_losses:
        value_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            L
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["team"]["name"] }}
          {% endif %}
        friendly_name_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            Losses
          {% else %}
            {{ states.sensor.mlb_game_status.attributes.dates[0]["games"][0]["teams"]["away"]["leagueRecord"]["losses"] }}
          {% endif %}
        entity_picture_template: >-
          {% if states('sensor.mlb_game_status') == 'unknown' %}
            https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcR8rGHWIehoVzpadKbNwJhQ_IxdUbKv81ed06p_3fRsSvmJzluS
          {% else  %}
            https://www.mlbstatic.com/team-logos/league-on-dark/1.svg
          {% endif %}
        entity_id: sensor.mlb_game_status
#MLB sensors#########
2 Likes

Share your Projects is about sharing. A picture does not count.

image

Lovelace Card:

type: vertical-stack
cards:
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Great American Ball Park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/2602.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: American Family Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/32.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Angel Stadium
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/1.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Oriole Park at Camden Yards
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/2.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Fenway Park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/3.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Guaranteed Rate Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/4.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Progressive Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/5.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Kauffman Stadium
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/7.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Fenway Park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/3.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: RingCentral Coliseum
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/10.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Tropicana Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/12.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Globe Life Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/13.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Rogers Centre
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/14.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Chase Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/15.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Truist Park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/16.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Wrigley Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/17.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Coors Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/19.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: Dodger Stadium
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/22.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: PNC Park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/31.jpg
  - type: conditional
    conditions:
      - entity: sensor.venue
        state: American Family Field
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(255,255,255,0.8)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/32.jpg

2 Likes

Awesome work! I’ve started to incorporate this into my own dashboard as well, but it seem that the images are missing for a number of venues. Do you know where / how we can find the missing ones?

1 Like

Changing night to day will change to a day game and there is no sense to the way venues are numbered, you just have to change the number for the jpg.
https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/2602.jpg

I was looking for the same and found the MLB stat API json query to get the venue names with their respective url’s.

[
 {
  "Team": "Milwaukee Brewers",
  "Venue Name": "American Family Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/32.jpg"
 },
 {
  "Team": "Los Angeles Angels",
  "Venue Name": "Angel Stadium",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/1.jpg"
 },
 {
  "Team": "St. Louis Cardinals",
  "Venue Name": "Busch Stadium",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2889.jpg"
 },
 {
  "Team": "Arizona Diamondbacks",
  "Venue Name": "Chase Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/15.jpg"
 },
 {
  "Team": "New York Mets",
  "Venue Name": "Citi Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/3289.jpg"
 },
 {
  "Team": "Philadelphia Phillies",
  "Venue Name": "Citizens Bank Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2681.jpg"
 },
 {
  "Team": "Detroit Tigers",
  "Venue Name": "Comerica Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2394.jpg"
 },
 {
  "Team": "Colorado Rockies",
  "Venue Name": "Coors Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/19.jpg"
 },
 {
  "Team": "Los Angeles Dodgers",
  "Venue Name": "Dodger Stadium",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/22.jpg"
 },
 {
  "Team": "Boston Red Sox",
  "Venue Name": "Fenway Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/3.jpg"
 },
 {
  "Team": "Texas Rangers",
  "Venue Name": "Globe Life Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/13.jpg"
 },
 {
  "Team": "Cincinnati Reds",
  "Venue Name": "Great American Ball Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2602.jpg"
 },
 {
  "Team": "Chicago White Sox",
  "Venue Name": "Guaranteed Rate Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/4.jpg"
 },
 {
  "Team": "Kansas City Royals",
  "Venue Name": "Kauffman Stadium",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/7.jpg"
 },
 {
  "Team": "Miami Marlins",
  "Venue Name": "loanDepot park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/4169.jpg"
 },
 {
  "Team": "Houston Astros",
  "Venue Name": "Minute Maid Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2392.jpg"
 },
 {
  "Team": "Washington Nationals",
  "Venue Name": "Nationals Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/3309.jpg"
 },
 {
  "Team": "San Francisco Giants",
  "Venue Name": "Oracle Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2395.jpg"
 },
 {
  "Team": "Baltimore Orioles",
  "Venue Name": "Oriole Park at Camden Yards",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2.jpg"
 },
 {
  "Team": "San Diego Padres",
  "Venue Name": "Petco Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/2680.jpg"
 },
 {
  "Team": "Pittsburgh Pirates",
  "Venue Name": "PNC Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/31.jpg"
 },
 {
  "Team": "Cleveland Indians",
  "Venue Name": "Progressive Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/5.jpg"
 },
 {
  "Team": "Oakland Athletics",
  "Venue Name": "Oakland Coliseum",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/10.jpg"
 },
 {
  "Team": "Toronto Blue Jays",
  "Venue Name": "Rogers Centre",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/14.jpg"
 },
 {
  "Team": "Minnesota Twins",
  "Venue Name": "Target Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/3312.jpg"
 },
 {
  "Team": "Seattle Mariners",
  "Venue Name": "T-Mobile Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/680.jpg"
 },
 {
  "Team": "Tampa Bay Rays",
  "Venue Name": "Tropicana Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/12.jpg"
 },
 {
  "Team": "Atlanta Braves",
  "Venue Name": "Truist Park",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/16.jpg"
 },
 {
  "Team": "Chicago Cubs",
  "Venue Name": "Wrigley Field",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/17.jpg"
 },
 {
  "Team": "New York Yankees",
  "Venue Name": "Yankee Stadium",
  "URL": "https:\/\/prod-gameday.mlbstatic.com\/responsive-gameday-assets\/1.3.0\/images\/stadiums\/night\/3313.jpg"
 }
]

I also updated the rgba in the lovelace card to be able to see the scores using the night stadiums.

mlbgamescores

Lovelace Card example:

  - type: conditional
    conditions:
      - entity: sensor.mlb_venue
        state: loanDepot park
    card:
      type: picture-elements
      elements:
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_away_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 10%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(0,0,0,.6)
            '--ha-card-border-radius': 10px
        - type: custom:hui-element
          card_type: glance
          entities:
            - entity: sensor.mlb_home_score
          name: Some toggle (default style)
          style:
            top: 10%
            left: 70%
            transform: translate(0,0)
            '--paper-item-icon-color': red
            '--ha-card-background': rgba(0,0,0,.6)
            '--ha-card-border-radius': 10px
      image: >-
        https://prod-gameday.mlbstatic.com/responsive-gameday-assets/1.3.0/images/stadiums/night/4169.jpg
2 Likes

THANK YOU!

With a single post, you’ve solved three different problems for me.

  1. I now have images for all the various ballparks.
  2. I now have a card that works with the white font of my dark theme.
  3. Since I have light and dark versions of this card, I can now also make use of the day / night images and dynamically switch between them based on whether I am in light mode or dark mode.

With this, I now have everything I need to really build the view that I want. Unfortunately, it comes at the very moment that both my teams are eliminated, so I probably won’t make any more progress until the spring. Once I have it, though, I’ll be sure to post the latest updates.

Thanks again!