Description
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.