Skip to content

Commit

Permalink
Fix merge conflict with versions
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli committed Aug 10, 2017
2 parents 261bda8 + b06ce9b commit 47491ca
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hassio/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Const file for HassIO."""
from pathlib import Path

HASSIO_VERSION = '0.51'
HASSIO_VERSION = '0.52'

URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
'hassio/{}/version.json')
Expand Down
6 changes: 3 additions & 3 deletions hassio/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ async def start(self):
await self.api.start()
_LOGGER.info("Start hassio api on %s", self.config.api_endpoint)

# start addon mark as system
await self.addons.auto_boot(STARTUP_SYSTEM)

try:
# HomeAssistant is already running / supervisor have only reboot
if await self.homeassistant.is_running():
_LOGGER.info("HassIO reboot detected")
return

# start addon mark as system
await self.addons.auto_boot(STARTUP_SYSTEM)

# start addon mark as services
await self.addons.auto_boot(STARTUP_SERVICES)

Expand Down
25 changes: 23 additions & 2 deletions hassio/dock/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

_LOGGER = logging.getLogger(__name__)

AUDIO_DEVICE = "/dev/snd:/dev/snd:rwm"


class DockerAddon(DockerBase):
"""Docker hassio wrapper for HomeAssistant."""
Expand All @@ -28,6 +30,11 @@ def name(self):
"""Return name of docker container."""
return "addon_{}".format(self.addon.slug)

@property
def hostname(self):
"""Return slug/id of addon."""
return self.addon.slug.replace('_', '-')

@property
def environment(self):
"""Return environment for docker add-on."""
Expand All @@ -43,6 +50,20 @@ def environment(self):
'TZ': self.config.timezone,
}

@property
def devices(self):
"""Return needed devices."""
devices = self.addon.devices or []

# use audio devices
if self.addon.with_audio and AUDIO_DEVICE not in devices:
devices.append(AUDIO_DEVICE)

# Return None if no devices is present
if devices:
return devices
return None

@property
def tmpfs(self):
"""Return tmpfs for docker add-on."""
Expand Down Expand Up @@ -122,12 +143,12 @@ def _run(self):
self.dock.containers.run(
self.image,
name=self.name,
hostname=self.addon.slug,
hostname=self.hostname,
detach=True,
network_mode=self.addon.network_mode,
ports=self.addon.ports,
extra_hosts=self.mapping,
devices=self.addon.devices,
devices=self.devices,
cap_add=self.addon.privileged,
environment=self.environment,
volumes=self.volumes,
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"hassio": "0.51",
"hassio": "0.52",
"homeassistant": "0.50.2",
"resinos": "1.0",
"resinhup": "0.3",
Expand Down

0 comments on commit 47491ca

Please sign in to comment.