Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Amfitri\u00f3"
"host": "Amfitri\u00f3"
},
"description": "Introdueix el nom d'amfitri\u00f3 o l'adre\u00e7a IP d'un dispositiu Heos (preferiblement un connectat a la xarxa per cable).",
"title": "Connexi\u00f3 amb Heos"
}
},
"title": "Heos"
Comment thread
andrewsayre marked this conversation as resolved.
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Host"
"host": "Host"
},
"description": "Bitte gib den Hostnamen oder die IP-Adresse eines Heos-Ger\u00e4ts ein (vorzugsweise eines, das per Kabel mit dem Netzwerk verbunden ist).",
"title": "Mit Heos verbinden"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Host"
"host": "Host"
},
"description": "Please enter the host name or IP address of a Heos device (preferably one connected via wire to the network).",
"title": "Connect to Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Host"
"host": "Host"
},
"description": "Introduce el nombre de host o direcci\u00f3n IP de un dispositivo Heos (preferiblemente conectado por cable a la red).",
"title": "Conectar a Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "H\u00f4te"
"host": "H\u00f4te"
},
"description": "Veuillez saisir le nom d\u2019h\u00f4te ou l\u2019adresse IP d\u2019un p\u00e9riph\u00e9rique Heos (de pr\u00e9f\u00e9rence connect\u00e9 au r\u00e9seau filaire).",
"title": "Se connecter \u00e0 Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"step": {
"user": {
"data": {
"access_token": "Host"
"host": "Host"
},
"description": "Inserire il nome host o l'indirizzo IP di un dispositivo Heos (preferibilmente uno connesso alla rete tramite cavo).",
"title": "Connetti a Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "\ud638\uc2a4\ud2b8"
"host": "\ud638\uc2a4\ud2b8"
},
"description": "Heos \uae30\uae30\uc758 \ud638\uc2a4\ud2b8 \uc774\ub984 \ub610\ub294 IP \uc8fc\uc18c\ub97c \uc785\ub825\ud574\uc8fc\uc138\uc694. (\uc720\uc120 \ub124\ud2b8\uc6cc\ud06c\ub85c \uc5f0\uacb0\ud558\ub294 \uac83\uc774 \uc88b\uc2b5\ub2c8\ub2e4)",
"title": "Heos \uc5f0\uacb0"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/lb.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Apparat"
"host": "Apparat"
},
"description": "Gitt den Numm oder IP-Adress vun engem Heos-Apparat an (am beschten iwwer Kabel mam Reseau verbonnen).",
"title": "Mat Heos verbannen"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"step": {
"user": {
"data": {
"access_token": "Vert"
"host": "Vert"
}
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Vert"
"host": "Vert"
},
"description": "Vennligst skriv inn vertsnavnet eller IP-adressen til en Heos-enhet (helst en tilkoblet via kabel til nettverket).",
"title": "Koble til Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Host"
"host": "Host"
},
"description": "Wprowad\u017a nazw\u0119 hosta lub adres IP urz\u0105dzenia Heos (preferowane po\u0142\u0105czenie kablowe, nie WiFi).",
"title": "Po\u0142\u0105cz si\u0119 z Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"step": {
"user": {
"data": {
"access_token": "Servidor"
"host": "Servidor"
}
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "\u0425\u043e\u0441\u0442"
"host": "\u0425\u043e\u0441\u0442"
},
"description": "\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043c\u044f \u0445\u043e\u0441\u0442\u0430 \u0438\u043b\u0438 IP-\u0430\u0434\u0440\u0435\u0441 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 Heos (\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u0431\u0435\u043b\u044c).",
"title": "Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "Gostitelj"
"host": "Gostitelj"
},
"description": "Vnesite ime gostitelja ali naslov IP naprave Heos (po mo\u017enosti eno, ki je z omre\u017ejem povezana \u017ei\u010dno).",
"title": "Pove\u017eite se z Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"step": {
"user": {
"data": {
"access_token": "V\u00e4rd"
"host": "V\u00e4rd"
},
"description": "Ange v\u00e4rdnamnet eller IP-adressen f\u00f6r en Heos-enhet (helst en ansluten via kabel till n\u00e4tverket).",
"title": "Anslut till Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
4 changes: 2 additions & 2 deletions homeassistant/components/heos/.translations/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"step": {
"user": {
"data": {
"access_token": "\u4e3b\u6a5f\u7aef"
"host": "\u4e3b\u6a5f\u7aef"
},
"description": "\u8acb\u8f38\u5165\u4e3b\u6a5f\u6bb5\u540d\u7a31\u6216 Heos \u88dd\u7f6e IP \u4f4d\u5740\uff08\u5df2\u900f\u904e\u6709\u7dda\u7db2\u8def\u9023\u7dda\uff09\u3002",
"title": "\u9023\u7dda\u81f3 Heos"
}
},
"title": "Heos"
"title": "HEOS"
}
}
22 changes: 17 additions & 5 deletions homeassistant/components/heos/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import voluptuous as vol

from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from homeassistant.const import CONF_HOST, CONF_NAME

from .const import DOMAIN

Expand All @@ -20,15 +20,22 @@ class HeosFlowHandler(config_entries.ConfigFlow):

VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH
DISCOVERED_HOSTS = {}
Comment thread
andrewsayre marked this conversation as resolved.
Outdated
Comment thread
andrewsayre marked this conversation as resolved.
Outdated

async def async_step_discovery(self, discovery_info):
"""Handle a discovered Heos device."""
friendly_name = "{} ({})".format(
discovery_info[CONF_NAME], discovery_info[CONF_HOST])
self.DISCOVERED_HOSTS[friendly_name] = discovery_info[CONF_HOST]
# Only a single entry is needed for all devices
entries = self.hass.config_entries.async_entries(DOMAIN)
Comment thread
andrewsayre marked this conversation as resolved.
Outdated
if entries:
return self.async_abort(reason='already_setup')
# Only continue if this is the only active flow
flows = self.hass.config_entries.flow.async_progress()
Comment thread
andrewsayre marked this conversation as resolved.
Outdated
heos_flows = [flow for flow in flows if flow['handler'] == DOMAIN]
if len(heos_flows) == 1:
return await self.async_step_user(
{CONF_HOST: discovery_info[CONF_HOST]})
return self.async_show_form(step_id='user')
return self.async_abort(reason='already_setup')

async def async_step_import(self, user_input=None):
Expand All @@ -52,19 +59,24 @@ async def async_step_user(self, user_input=None):
host = None
if user_input is not None:
host = user_input[CONF_HOST]
# Map host from friendly name if in discovered hosts
host = self.DISCOVERED_HOSTS.get(host, host)
heos = Heos(host)
try:
await heos.connect()
return await self.async_step_import(user_input)
self.DISCOVERED_HOSTS.clear()
return await self.async_step_import({CONF_HOST: host})
except (asyncio.TimeoutError, ConnectionError):
errors[CONF_HOST] = 'connection_failure'
finally:
await heos.disconnect()

# Return form
host_type = str if not self.DISCOVERED_HOSTS \
else vol.In(list(self.DISCOVERED_HOSTS))
return self.async_show_form(
step_id='user',
data_schema=vol.Schema({
vol.Required(CONF_HOST, default=host): str
vol.Required(CONF_HOST, default=host): host_type
}),
errors=errors)
4 changes: 2 additions & 2 deletions homeassistant/components/heos/strings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"config": {
"title": "Heos",
"title": "HEOS",
"step": {
"user": {
"title": "Connect to Heos",
"description": "Please enter the host name or IP address of a Heos device (preferably one connected via wire to the network).",
"data": {
"access_token": "Host"
"host": "Host"
}
}
},
Expand Down
Loading