JayBlackedOut / hass-nhlapi

NHL Stats API Integration Into Home Assistant
69 stars 18 forks source link

Alexa issues #29

Closed nutsofamily closed 3 years ago

nutsofamily commented 3 years ago

I cannot get Alexa to report anything.

I also copied verbatum the home and away automation template you had for away and home team scores but I dont get anything.

The device I want to hear on is called "white" which is the echo device.

If I call to service the notify.alexa_media with { "message": "Test", "data": { "type": "announce", "method": "speak" }, "target": ["White"]}. I can hear it come through the device.

JayBlackedOut commented 3 years ago

Hi, please format your code properly by highlighting it and clicking on the <> button. I can't tell what the issue is without seeing your indentation. Please also paste your configuration.yaml entry. Thanks.

nutsofamily commented 3 years ago
  - platform: nhl_api
    team_id: 10
    name: 'NHL Toronto Maple Leafs'

  - platform: nhl_api
    team_id: 8
    name: 'NHL Montreal Canadiens'

  - platform: nhl_api
    team_id: 22
    name: 'NHL Edmonton Oilers'

  - platform: nhl_api
    team_id: 23
    name: 'NHL Vancouver Cannucks'

  - platform: template
    sensors:
      nhl_toronto_maple_leafs_away_team:
        friendly_name_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.away_name }}'
        value_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.away_score }}'
        entity_picture_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.away_logo }}'
      nhl_toronto_maple_leafs_home_team:
        friendly_name_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.home_name }}'
        value_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.home_score }}'
        entity_picture_template: '{{ states.sensor.nhl_toronto_maple_leafs.attributes.home_logo }}'`
nutsofamily commented 3 years ago
`- alias: 'Montreal Goal Announcement'
  trigger:
    platform: event
    event_type: nhl_goal
    event_data:
      team_id: "8"
  action:
    service: notify.alexa_media
    entity_id: media_player.white
    data:
      message: 'The habs scored!'

########
- alias: 'Vancouverl Goal Announcement'
  trigger:
    platform: event
    event_type: nhl_goal
    event_data:
      team_id: "23"
  action:
    service: notify.alexa_media
    entity_id: media_player.white
    data:
      message: 'Canucks scored!'

      ######
- alias: 'Toronto Goal Announcment'
  trigger:
    platform: event
    event_type: nhl_goal
    event_data:
      team_id: "10"
  action:
    service: notify.alexa_media
    entity_id: media_player.white
    data:
      message: 'The Leafs scored!'

      #####
- id: away_scores
  alias: away_scores
  initial_state: true
  trigger:
  - platform: template
    value_template: "{{ states.sensor.away_team.state  | int > states('numeric_input.away_score') | int }}"
  action:
  - service: input_number.set_value
    entity_id: numeric_input.away_score
    data_template: 
      value: "{{ states.sensor.away_team.state |int }}"
  - service: notify.alexa_media
    data:
      target: 
        - "White"
      message: "{{ state_attr( 'sensor.away_team', 'friendly_name') }} score!"
      data: 
        type: "tts"      
######
- id: home_scores
  alias: home_scores
  initial_state: true
  trigger:
  - platform: template
    value_template: "{{ states.sensor.home_team.state  | int > states('numeric_input.home_score') | int }}"
  action:
  - service: input_number.set_value
    entity_id: numeric_input.home_score
    data_template: 
      value: "{{ states.sensor.home_team.state |int }}"
  - service: notify.alexa_media
    data:
      target: 
        - "White"
      message: "{{ state_attr( 'sensor.home_team', 'friendly_name') }} score!"
      data: 
        type: "tts"

- id: final_score
  alias: final_score
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.nhl_hockey
    from: "Game Over"
    to: "Final"
  action:
  - service: notify.alexa_media
    data:
      target: 
        - "White"
      message: "Final Score: {{ state_attr( 'sensor.away_team', 'friendly_name') }} {{ states('sensor.away_team') }},, {{ state_attr( 'sensor.home_team', 'friendly_name') }}{{ states('sensor.home_team') }} !"
      data: 
        type: "tts"`
nutsofamily commented 3 years ago

My lovelace card shows scores properly as well as game times. I just cant seem to get the alexa automation TTS

JayBlackedOut commented 3 years ago

At first glance, the YAML looks fine. What happens if you trigger the automation manually from the automation config panel?

JayBlackedOut commented 3 years ago

I just looked up your Alexa custom component. I believe you should have the following in the action section of the automation:

  service: notify.alexa_media
    data:
      data:
        type: tts
      target: 
        - media_player.white
      message: 'Canucks scored!'
nutsofamily commented 3 years ago
`- alias: Vancouverl Goal Announcement
  trigger:
    platform: event
    event_type: nhl_goal
    event_data:
      team_id: '23'
  action:
  service: notify.alexa_media
    data:
      data:
        type: tts
      target: 
        - media_player.white
      message: 'Canucks scored!'`

I get :Error loading /config/configuration.yaml: mapping values are not allowed here in "/config/automations.yaml", line 9, column 9

nutsofamily commented 3 years ago

The only TTS I hear executing is final score (albeit Alexa does not report a score just "none to ..

The other automations dont do anything

nutsofamily commented 3 years ago

Executing away score I get: Logger: homeassistant.components.automation.away_scores Source: components/automation/init.py:408 Integration: Automation (documentation, issues) First occurred: 9:24:35 PM (1 occurrences) Last logged: 9:24:35 PM

Error while executing automation automation.away_scores: Error rendering data template: UndefinedError: 'None' has no attribute 'state'

In log

JayBlackedOut commented 3 years ago
`- alias: Vancouverl Goal Announcement
  trigger:
    platform: event
    event_type: nhl_goal
    event_data:
      team_id: '23'
  action:
  service: notify.alexa_media
    data:
      data:
        type: tts
      target: 
        - media_player.white
      message: 'Canucks scored!'`

I get :Error loading /config/configuration.yaml: mapping values are not allowed here in "/config/automations.yaml", line 9, column 9

Everything under action is under indented. This is not an issue with the sensor or goal event though... I will close this issue but recommend you ask for help on the Home Assistant Community forums as I am no expert on how to configure your custom Alexa component properly.