8000 Alexa should handle channelMetadata: "name" as a valid channel. · Issue #29274 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Alexa should handle channelMetadata: "name" as a valid channel. #29274
Closed
@clapbr

Description

@clapbr

Home Assistant release with the issue: 0.102

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.): Ubuntu venv

Integration: Alexa smart home (https://www.home-assistant.io/integrations/alexa.smart_home/)

Description of problem:
Relevant API: https://developer.amazon.com/docs/device-apis/alexa-channelcontroller.html
@Dilbert66 recently implemented the channel changer and it handles the case where Alexa requests a channel's number or callSign. IE:

      "channel": {
          "number": "1234",
          "callSign": "KSTATION1",
          "affiliateCallSign": "KSTATION2",
          "uri": "someUrl"
      }

In my case it wasn't working for channel names because Alexa sent the requested channel as:

      "channelMetadata": {
          "name": "fox",
      }

The handler function is this one: https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/alexa/handlers.py#L1143 - I'm not a dev but quickly tweaked the function to this and it worked well:

async def async_api_changechannel(hass, config, directive, context):
    """Process a change channel request."""
    channel = "0"
    entity = directive.entity
    payload = directive.payload["channel"]
    payload_name = "number"
    metapayload = directive.payload["channelMetadata"]
    if "number" in payload:
        channel = payload["number"]
        payload_name = "number"
    elif "callSign" in payload:
        channel = payload["callSign"]
        payload_name = "callSign"
    elif "affiliateCallSign" in payload:
        channel = payload["affiliateCallSign"]
        payload_name = "affiliateCallSign"
    elif "uri" in payload:
        channel = payload["uri"]
        payload_name = "uri"
    elif "name" in metapayload:
        channel = metapayload["name"]
        payload_name = "name"

For reference this is how openhab handles it.
@ochlocracy @balloob Pinging you guys since you maintain the component.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0