Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ omit =
homeassistant/components/calendar/todoist.py
homeassistant/components/camera/bloomsky.py
homeassistant/components/camera/canary.py
homeassistant/components/camera/familyhub.py
homeassistant/components/camera/ffmpeg.py
homeassistant/components/camera/foscam.py
homeassistant/components/camera/mjpeg.py
Expand Down
59 changes: 59 additions & 0 deletions homeassistant/components/camera/familyhub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""
Family Hub camera for Samsung Refrigerators.

For more details about this platform, please refer to the documentation
https://home-assistant.io/components/camera.familyhub/
"""
import logging
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_NAME)
from homeassistant.components.camera import Camera
from homeassistant.helpers.aiohttp_client import async_get_clientsession

_LOGGER = logging.getLogger(__name__)

REQUIREMENTS = ['pyfamilyhublocal==0.0.2']

CONF_IP = 'address'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have CONF_IP_ADDRESS in const.py. Please use that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, and i'm updating the docs now


DEFAULT_NAME = 'FamilyHub Camera'

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_IP): cv.string,
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
})

async def async_setup_platform(hass, config, async_add_devices, discovery_info=None):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1
line too long (85 > 79 characters)

"""Set up the Family Hub Camera."""
from pyfamilyhublocal import FamilyHubCam
address = config.get(CONF_IP)
name = config.get(CONF_NAME)

session = async_get_clientsession(hass)
family_hub_cam = FamilyHubCam(address, hass.loop, session)

async_add_devices([FamilyHubCamera(name, family_hub_cam)], True)



class FamilyHubCamera(Camera):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (3)


def __init__(self, name, family_hub_cam):
super().__init__()
self._name = name
self.family_hub_cam = family_hub_cam

async def camera_image(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be async_camera_image.

"""Return a still image response."""
return await self.family_hub_cam.async_get_cam_image()

@property
def name(self):
return self._name

@property
def should_poll(self):
return False
3 changes: 3 additions & 0 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ libnacl==1.6.1
# homeassistant.components.dyson
libpurecoollink==0.4.2

# homeassistant.components.camera.foscam
pyfamilyhublocal==0.0.2

# homeassistant.components.camera.foscam
libpyfoscam==1.0

Expand Down