Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Axis option to enable/disable camera #36420

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion homeassistant/components/axis/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):

device = hass.data[AXIS_DOMAIN][config_entry.unique_id]

if not device.option_camera:
if not device.api.vapix.params.image_format:
return

async_add_entities([AxisCamera(device)])
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/axis/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

ATTR_MANUFACTURER = "Axis Communications AB"

CONF_CAMERA = "camera"
CONF_EVENTS = "events"
CONF_MODEL = "model"
CONF_STREAM_PROFILE = "stream_profile"
Expand Down
7 changes: 0 additions & 7 deletions homeassistant/components/axis/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

from .const import (
ATTR_MANUFACTURER,
CONF_CAMERA,
CONF_EVENTS,
CONF_MODEL,
CONF_STREAM_PROFILE,
Expand Down Expand Up @@ -77,12 +76,6 @@ def serial(self):
"""Return the serial number of this device."""
return self.config_entry.unique_id

@property
def option_camera(self):
"""Config entry option defining if camera should be used."""
supported_formats = self.api.vapix.params.image_format
return self.config_entry.options.get(CONF_CAMERA, bool(supported_formats))
MartinHjelmare marked this conversation as resolved.
Show resolved Hide resolved

@property
def option_events(self):
"""Config entry option defining if platforms based on events should be created."""
Expand Down
3 changes: 1 addition & 2 deletions tests/components/axis/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from homeassistant.components import camera
from homeassistant.components.axis.const import (
CONF_CAMERA,
CONF_STREAM_PROFILE,
DOMAIN as AXIS_DOMAIN,
)
Expand Down Expand Up @@ -70,7 +69,7 @@ async def test_camera_with_stream_profile(hass):

async def test_camera_disabled(hass):
"""Test that Axis camera platform is loaded properly but does not create camera entity."""
with patch.dict(ENTRY_OPTIONS, {CONF_CAMERA: False}):
with patch("axis.vapix.Params.image_format", new=None):
await setup_axis_integration(hass)

assert len(hass.states.async_entity_ids(CAMERA_DOMAIN)) == 0
2 changes: 0 additions & 2 deletions tests/components/axis/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from homeassistant import data_entry_flow
from homeassistant.components.axis import config_flow
from homeassistant.components.axis.const import (
CONF_CAMERA,
CONF_EVENTS,
CONF_MODEL,
CONF_STREAM_PROFILE,
Expand Down Expand Up @@ -352,7 +351,6 @@ async def test_option_flow(hass):

assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"] == {
CONF_CAMERA: True,
CONF_EVENTS: True,
CONF_STREAM_PROFILE: "profile_1",
}
Expand Down
3 changes: 1 addition & 2 deletions tests/components/axis/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from homeassistant import config_entries
from homeassistant.components import axis
from homeassistant.components.axis.const import (
CONF_CAMERA,
CONF_EVENTS,
CONF_MODEL,
DOMAIN as AXIS_DOMAIN,
Expand All @@ -48,7 +47,7 @@
MODEL = "model"
NAME = "name"

ENTRY_OPTIONS = {CONF_CAMERA: True, CONF_EVENTS: True}
ENTRY_OPTIONS = {CONF_EVENTS: True}

ENTRY_CONFIG = {
CONF_HOST: "1.2.3.4",
Expand Down