NHL API Custom Component - Track your favorite hockey team in Home Assistant!

Great! My pleasure.

image

Really digging this integration paired with a grid and mushroom cards! Thanks @jayblackedout for taking the time to put this integration together. Love it.

Edit: Once the game ended this evening, I noticed I could hide the middle row as the time remaining and period no longer mattered. So I created a conditional card, with the same two column grid with a mushroom entity for each. Using the statuses from the documentation I have it to only display the time and period grid when the game is in either ā€œIn Progressā€ or ā€œIn Progress - Criticalā€.

image

1 Like

Looks great! Happy youā€™re enjoying it.

Everytime I add the systemmonitor code AFTER the NHL code I lose the NHL sensors???

sensor:
  - platform: nhl_api
    team_id: 8
    name: "NHL Montreal Canadiens"
    scan_interval: 5
    
  - platform: nhl_api
    team_id: 10  
    name: "NHL Maple Leafs"
    scan_interval: 5
    
  - platform: nhl_api
    team_id: 23  
    name: "NHL Vancouver Canucks"
    scan_interval: 5    
    
  - platform: nhl_api
    team_id: 52
    name: "NHL Winnipeg Jets"
    scan_interval: 5
    
  - platform: nhl_api
    team_id: 20
    name: "NHL Calgary Flames"
    scan_interval: 5
    
  - platform: nhl_api
    team_id: 22
    name: "NHL Edmonton Oilers"
    scan_interval: 5      

      
  -  platform: template
     sensors:
      nhl_edmonton_oilers_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_score }}"
      nhl_edmonton_oilers_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_score }}"    

  -  platform: template
     sensors:
      nhl_maple_leafs_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_score }}"
      nhl_maple_leafs_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_score }}"
        
  -  platform: template
     sensors:
      nhl_calgary_flames_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_score }}"
      nhl_calgary_flames_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_score }}"        
        
      nhl_montreal_canadiens_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_score }}"
      nhl_montreal_canadiens_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_score }}"
        
      nhl_vancouver_canucks_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_score }}"
      nhl_vancouver_canucks_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_score }}"
        
      nhl_winnipeg_jets_away_team: 
        entity_picture_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_score }}"
      nhl_winnipeg_jets_home_team: 
        entity_picture_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_score }}"
input_number:
  away_score:
    min: 0
    max: 100
  home_score:
    min: 0
    max: 100

Everytime I add the following below AFTER the nhl code I lose the NHL lovelace!

###SYSTEM#
sensor:  
  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /config
      - type: disk_use
      - type: disk_free
      - type: memory_use_percent
      - type: memory_use
      - type: memory_free
      - type: swap_use_percent
      - type: swap_use
      - type: swap_free
      - type: load_1m
      - type: load_5m
      - type: load_15m
      - type: network_in
        arg: eth0
      - type: network_out
        arg: eth0
      - type: throughput_network_in
        arg: eth0
      - type: throughput_network_out
        arg: eth0
      - type: packets_in
        arg: eth0
      - type: packets_out
        arg: eth0
      - type: ipv4_address
        arg: eth0
      - type: ipv6_address
        arg: eth0
      - type: processor_use
      - type: processor_temperature
      - type: last_boot



I lose my Teams and it shows as not avaialble?

Why is that?

Remove the second sensor: from your YAML and donā€™t modify the indentation of the rest.

1 Like
sensor:
  - platform: nhl_api
    team_id: 8
    name: "NHL Montreal Canadiens"
    scan_interval: 5

  - platform: nhl_api
    team_id: 10
    name: "NHL Maple Leafs"
    scan_interval: 5

  - platform: nhl_api
    team_id: 23
    name: "NHL Vancouver Canucks"
    scan_interval: 5

  - platform: nhl_api
    team_id: 52
    name: "NHL Winnipeg Jets"
    scan_interval: 5

  - platform: nhl_api
    team_id: 20
    name: "NHL Calgary Flames"
    scan_interval: 5

  - platform: nhl_api
    team_id: 22
    name: "NHL Edmonton Oilers"
    scan_interval: 5

  - platform: template

      nhl_edmonton_oilers_away_team:
        entity_picture_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.away_score }}"
      nhl_edmonton_oilers_home_team:
        entity_picture_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_edmonton_oilers.attributes.home_score }}"

  - platform: template

      nhl_maple_leafs_away_team:
        entity_picture_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_maple_leafs.attributes.away_score }}"
      nhl_maple_leafs_home_team:
        entity_picture_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_maple_leafs.attributes.home_score }}"

  - platform: template

      nhl_calgary_flames_away_team:
        entity_picture_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_calgary_flames.attributes.away_score }}"
      nhl_calgary_flames_home_team:
        entity_picture_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_calgary_flames.attributes.home_score }}"
        
  - platform: template
      nhl_montreal_canadiens_away_team:
        entity_picture_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.away_score }}"
      nhl_montreal_canadiens_home_team:
        entity_picture_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_montreal_canadiens.attributes.home_score }}"
        
  - platform: template
      nhl_vancouver_canucks_away_team:
        entity_picture_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.away_score }}"
      nhl_vancouver_canucks_home_team:
        entity_picture_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_vancouver_canucks.attributes.home_score }}"
        
  - platform: template
      nhl_winnipeg_jets_away_team:
        entity_picture_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_name }}"
        value_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.away_score }}"
      nhl_winnipeg_jets_home_team:
        entity_picture_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_logo }}"
        friendly_name_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_name }}"
        value_template: "{{ states.sensor.nhl_winnipeg_jets.attributes.home_score }}"
input_number:
  away_score:
    min: 0
    max: 100
  home_score:
    min: 0
    max: 100

The above doesnt seem to work

NVMD: I moved all sensors into its own file and it all works. Thanks.

Hi! Iā€™m completely new to HA, HACS, and this NHL API integration. Iā€™ve gotten HA setup, HACS installed, downloaded your integration (THANK YOU), and Iā€™m now in the process of configuring. I add the below code to the configuration.yaml file:

sensor:
  - platform: nhl_api
    team_id: 3

But keep getting this error when trying to validate the yaml:

Configuration invalid!
Platform error sensor.nhl_api - Integration ā€˜nhl_apiā€™ not found.

Iā€™m sure itā€™s a stupid simple step Iā€™m missing, but I definitely appreciate any guidance! Once I get things up and running, the goal will be to have light blink every time my team scores. Thanks!

Did you reboot after installing this component from HACS? HA doesnā€™t know the platform exists which was installed from HACS until a reboot.

1 Like

:man_facepalming: well thatā€™s embarrassing. instead of rebooting through the settings, i was trying to reboot from the yaml config checker - and it wouldnā€™t let me since there was a ā€œconfig errorā€ being thrown. looks like itā€™s working now. onto frontend and automations!

1 Like

iā€™ve edited my configuration.yaml and iā€™m able to see the basic NHL card on my dashboard. the next step seems to be to edit the ui-lovelace.yaml file. i donā€™t see that in any directories so iā€™m assuming iā€™m supposed to create the file manually? can you please point me in the right direction? iā€™m having trouble finding documentation to do this step correctly. thanks in advance!

Click the 3 stacked dots at the top-right of your dashboard and select ā€œEdit Dashboardā€. Then click ā€œAdd Cardā€ in the bottom right. Scroll down to the very bottom and select manual. This will allow you to paste in the YAML examples I shared in the repository.

You can also play around with other cards to display the sensor information as you see fit. Enjoy!

thanks @jayblackedout! i feel like iā€™m getting closer here, but iā€™m getting the below issue when using the sample config:

You need to create the template sensors. Read the full frontline examples page.

is this the page youā€™re referring to? hass-nhlapi/frontend.md at a8b322e3758e4bc59431022c1c25186baee7dcc8 Ā· JayBlackedOut/hass-nhlapi Ā· GitHub

if so, iā€™ve read through it 20 times and canā€™t figure out what iā€™m doing wrong :joy:. iā€™ve updated the configuration.yaml and can see that the sensor data is being passed through. i just canā€™t get it to display the scoreboard in the card. iā€™m sure iā€™m missing something, but itā€™s not glaring to me.

Please post your full configuration as a code block and Iā€™ll have a look.

thanks and sorry in advance. i wasnā€™t able to copy the config yaml in the browser iā€™m using for some reason, so hereā€™s a screenshot:

configuration.yaml

lovelace/card config:

- hours_to_show: 24
        graph: line
        type: sensor
        entity: sensor.nhl_new_york_rangers
        detail: 1
        name: NHL - NYR
      - type: entities
        show_header_toggle: false
        entities:
          - entity: sensor.nhl_new_york_rangers
          - entity: sensor.away_team
          - entity: sensor.home_team

You have plate in your config rather than template which would explain why your template sensors arenā€™t rendering. Once thatā€™s fixed, double check the entity IDs of the new sensors and make sure you have them listed correctly in your Lovelace configuration.

1 Like

Hi! This component looks grate! Too bad Iā€™m in Sweden! Is it possible to do something similar for SHL ?
Sens you have a reddy component ?
http://doc.openapi.shl.se

Looks like the SHL API is well documented. I donā€™t have the time or appetite to take that on right now but someone could easily do so. They can even re-use some of my code as the endpoints look similar.

1 Like