Giter Club home page Giter Club logo

axis's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar kane610 avatar lokaltog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

axis's Issues

Dict error after updatingg HA to 1.15

After updating HA from 1.14.4 to 1.15.1 I am getting below error on trying to add an Axis camera.

Model: A8004
Firmware: 1.65.4

Applications installed: VMD3 / VMD4.

Any suggestions?

Sep 20 21:14:09 hassbian hass[23363]: 2020-09-20 21:14:09 ERROR (MainThread) [aiohttp.server] Error handling request
Sep 20 21:14:09 hassbian hass[23363]: Traceback (most recent call last):
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
Sep 20 21:14:09 hassbian hass[23363]:     resp = await task
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
Sep 20 21:14:09 hassbian hass[23363]:     resp = await handler(request)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
Sep 20 21:14:09 hassbian hass[23363]:     return await handler(request)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
Sep 20 21:14:09 hassbian hass[23363]:     return await handler(request)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
Sep 20 21:14:09 hassbian hass[23363]:     return await handler(request)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
Sep 20 21:14:09 hassbian hass[23363]:     return await handler(request)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/view.py", line 129, in handle
Sep 20 21:14:09 hassbian hass[23363]:     result = await result
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/config/config_entries.py", line 169, in post
Sep 20 21:14:09 hassbian hass[23363]:     return await super().post(request, flow_id)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
Sep 20 21:14:09 hassbian hass[23363]:     result = await method(view, request, *args, **kwargs)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/data_entry_flow.py", line 106, in post
Sep 20 21:14:09 hassbian hass[23363]:     result = await self._flow_mgr.async_configure(flow_id, data)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 156, in async_configure
Sep 20 21:14:09 hassbian hass[23363]:     result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/data_entry_flow.py", line 204, in _async_handle_step
Sep 20 21:14:09 hassbian hass[23363]:     result: Dict = await getattr(flow, method)(user_input)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/axis/config_flow.py", line 73, in async_step_user
Sep 20 21:14:09 hassbian hass[23363]:     password=user_input[CONF_PASSWORD],
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/axis/device.py", line 270, in get_device
Sep 20 21:14:09 hassbian hass[23363]:     await hass.async_add_executor_job(device.vapix.initialize)
Sep 20 21:14:09 hassbian hass[23363]:   File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
Sep 20 21:14:09 hassbian hass[23363]:     result = self.fn(*self.args, **self.kwargs)
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/axis/vapix.py", line 93, in initialize
Sep 20 21:14:09 hassbian hass[23363]:     self.initialize_applications()
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/axis/vapix.py", line 179, in initialize_applications
Sep 20 21:14:09 hassbian hass[23363]:     app_item.update()
Sep 20 21:14:09 hassbian hass[23363]:   File "/srv/homeassistant/lib/python3.7/site-packages/axis/applications/guard_suite_base.py", line 23, in update
Sep 20 21:14:09 hassbian hass[23363]:     for profile in raw["data"]["profiles"]:
Sep 20 21:14:09 hassbian hass[23363]: KeyError: 'data'

HTTPS support

I saw in a thread somewhere that you may be planning to do some work on this plugin in the near future. It would be great to have HTTPS support and the ability to specify the certificate to expect from the camera, to support self-signed certificates without messing with the certificates trusted by the host / client.

Support for Access control?

Hi, just found this library. I have a A1001 door controller and tested the current state of the HomeAssistant integration. It appears that I can get a few states off of it, but no lock control (e.g. as switch entities) came across. It would be wonderful to be able to both discover and control the door lock state(s) for configured doors (as well as doors configured on additional connected/linked door controllers). Is this a planned feature? If not, I can look into adding it once I have some spare time.

(I also connected to an A8207VE MkII keypad/cam device, which was integrated via VAPIX to the aforementioned door controller -- I can see more information, including PIR state, camera feed and door status, however, I cannot operate the door lock through that as well. Being able to operate the door directly through a connection to the door controller(s) themselves would be optimal.)

Session timeouts

Cameras with the firmware 6.50 will eventually timeout the RTSP session at which point the camera responds with a 454 message instead of 200/ok. I have tried to extend the timeout on the camera or set it to 0. When the timeout is set to 0 or anonymous is allowed, the camera can't even get to its own VMD4 config page. Once the camera starts responding with 454 HA never trys to create a new session and the log is filled with more 454's after that point. Streaming still works but VMD4 events never make it to HA.

Also in my testing, if I did set the camera to one of these modes HA would never contact the camera again no matter how many times I restarted HA or the camera. My only workaround was to edit the device registry file and readd the camera. So that is a separate request to allow us to remove cameras without editing the device registry file.

2020-03-26 00:26:49 DEBUG (MainThread) [axis.rtsp] Received data ['RTSP/1.0 200 OK', 'CSeq: 4', 'Public: OPTIONS, DESCRIBE, GET_PARAMETER, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN', 'Server: GStreamer RTS
P server', 'Session: rkWgPZCGKBUj7MkC; timeout=60', 'Date: Wed, 25 Mar 2020 23:26:51 GMT', ''] from 192.168.1.41
2020-03-26 00:26:49 DEBUG (MainThread) [axis.rtsp] RTSP session (192.168.1.41) state playing
2020-03-26 00:26:49 DEBUG (MainThread) [axis.rtsp] RTSP session (192.168.1.41) state playing
2020-03-26 00:26:49 DEBUG (MainThread) [axis.rtsp] RTSP session (192.168.1.41) state playing
2020-03-26 00:27:09 DEBUG (MainThread) [axis.rtsp] OPTIONS rtsp://192.168.1.42/axis-media/media.amp?video=0&audio=0&event=on RTSP/1.0
CSeq: 4
User-Agent: HASS Axis
Session: N7_Xkk8ES1PglRDl




2020-03-26 00:27:51 DEBUG (MainThread) [axis.rtsp] Received data ['RTSP/1.0 454 Session Not Found', 'CSeq: 4', 'Server: GStreamer RTSP server', 'Date: Wed, 25 Mar 2020 23:27:54 GMT', ''] from 192.168.1.41
2020-03-26 00:27:51 DEBUG (MainThread) [axis.rtsp] 192.168.1.41 RTSP 454 Session
2020-03-26 00:27:51 DEBUG (MainThread) [axis.rtsp] RTSP session (192.168.1.41) state playing
2020-03-26 00:27:51 DEBUG (MainThread) [axis.rtsp] RTSP session (192.168.1.41) state playing
2020-03-26 00:28:04 DEBUG (MainThread) [axis.rtsp] OPTIONS rtsp://192.168.1.42/axis-media/media.amp?video=0&audio=0&event=on RTSP/1.0
CSeq: 4
User-Agent: HASS Axis
Session: N7_Xkk8ES1PglRDl

Server disconnected without sending a response

Hi !

Once again thanks for the amazing work on this component. I've recently added a new Axis camera in my setup and I get the following error in HA:

Logger: homeassistant.components.light
Source: components/axis/light.py:70
Integration: Light (documentation, issues)
First occurred: 5:39:28 PM (1 occurrences)
Last logged: 5:39:28 PM

Error adding entities for domain light with platform axis
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 102, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 81, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 143, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
  File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 186, in _receive_event
    raise RemoteProtocolError(msg)
httpcore.RemoteProtocolError: Server disconnected without sending a response.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/axis/vapix.py", line 265, in request
    response = await self.config.session.request(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1506, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1593, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1621, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1658, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1695, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: Server disconnected without sending a response.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 614, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 798, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/axis/light.py", line 70, in async_added_to_hass
    await self.device.api.vapix.light_control.get_current_intensity(
  File "/usr/local/lib/python3.9/site-packages/axis/light_control.py", line 189, in get_current_intensity
    return await self._request(
  File "/usr/local/lib/python3.9/site-packages/axis/vapix.py", line 296, in request
    raise RequestError("Connection error: {}".format(errc))
axis.errors.RequestError: Connection error: Server disconnected without sending a response.

Everything seems to work fine though.

Thanks for your help,
Kind regards,

WM

Axis Firmware: 10.10.71
HA: 2022.4.5

Issue with firmwares 5.50 and older

Originally reported in HASS repo home-assistant/core#42415

There is an issue with the transition to httpx and firmwares of 5.50 and older. It works perfectly fine on newer firmwares.

Tested on a 5.75 which have Apache webserver rather than Boa and there are more differences when looking at network traces. Looking at a web request with unauthorised response setting up digest there is much more data related to the same session than on a device with boa, with boa every session ends after web server response, so looking in wire shark gives a much narrower scope per following.

Requests seemed to handle all this perfectly fine down to 5.20 or even earlier. So I think httpx is sensitive to what responses is sent from the Boa webserver.

The change from requests to httpx: https://github.com/Kane610/axis/pull/52/files
The change to async httpx: https://github.com/Kane610/axis/pull/53/files

asyncio fail

On Python 3.7.3, when trying out your package I'm getting a problem with asyncio.
Please advise what environment / Python version / asyncio version you've used with this?
(And if there is any documentation, and where it exists?)

Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) TypeError: __init__() takes 1 positional argument but 2 were given

Support for speakers as media_player entity in HA

Hi,

Thanks for the great work !

I've recently installed a new AXIS I8016-LVE and I was wondering if the internal speaker could be seen in HA as a media_player entity. The Synology surveillance client can send any sound file to the speaker, so there may be a way I guess. Then, that could also be applied to other AXIS Network Speakers such as the C1410.

What information would you need that could help ?

Thanks !
Kind regards,

WM

Axis f34

So I am currently running home assistant os and can use the F34 camera but only one video source shows by default and no way of displaying the others. Would it be possible to add support for multiple camera within the same appliance ?
Like for example if i try to configure the camera i get this error

`Logger: aiohttp.server
Source: components/axis/config_flow.py:264
First occurred: 12:17:53 PM (2 occurrences)
Last logged: 12:20:25 PM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 89, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 190, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 72, in post
result = await self._flow_mgr.async_init(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_init
flow, result = await task
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 179, in _async_init
result = await self._async_handle_step(flow, flow.init_step, data, init_done)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/usr/src/homeassistant/homeassistant/components/axis/config_flow.py", line 232, in async_step_init
return await self.async_step_configure_stream()
File "/usr/src/homeassistant/homeassistant/components/axis/config_flow.py", line 264, in async_step_configure_stream
if not video_source["Enabled"]:
KeyError: 'Enabled'`

error handling event type with no MessageInstance

In trying to debug an Axis HA issue (home-assistant/core#109345), I used this library to query the A9188 device in question.

I get an exception when processing the various event types:


Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/jono/axis/axis/./__main__.py", line 114, in <module>
    asyncio.run(
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/./__main__.py", line 59, in main
    device = await axis_device(host, port, username, password)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/./__main__.py", line 35, in axis_device
    await device.vapix.initialize_event_instances()
  File "/home/jono/axis/axis/vapix/vapix.py", line 216, in initialize_event_instances
    await self.event_instances.do_update(skip_support_check=True)
  File "/home/jono/axis/axis/vapix/interfaces/api_handler.py", line 89, in do_update
    await self.update()
  File "/home/jono/axis/axis/vapix/interfaces/api_handler.py", line 113, in update
    self._items = await self._api_request()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/interfaces/event_instances.py", line 24, in _api_request
    return await self.get_event_instances()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/interfaces/event_instances.py", line 29, in get_event_instances
    response = ListEventInstancesResponse.decode(bytes_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/models/event_instance.py", line 190, in decode
    return cls(data=EventInstance.decode_from_list(events))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/models/event_instance.py", line 140, in decode_from_list
    events = [cls.decode(v) for v in data]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/models/event_instance.py", line 140, in <listcomp>
    events = [cls.decode(v) for v in data]
              ^^^^^^^^^^^^^
  File "/home/jono/axis/axis/vapix/models/event_instance.py", line 129, in decode
    stateful=data["data"]["MessageInstance"].get("@isProperty", None) == "true",
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

It appears there is an event type returned that does not have a MessageInstance body:

 {'data': {'@topic': 'true', 'MessageInstance': None},
  'topic': 'tns1:EventBuffer/Begin'},

I'm not sure if this event type should just be skipped, or if some different parsing logic is required.

Option to choose stream profile

HI Kane,

As discussed yesterday in the HA Github, could you please create an option to choose a stream profile in the Axis HA integration?

When I open multiple camera views (like mobile phone app, lovelace dashboard, Axis recorder), and they all use different profiles, I often get no livestream and the warning "Too many viewers".

More info about this can be found here:
https://www.axis.com/support/faq/FAQ115847
https://www.axis.com/files/whitepaper/White_paper_buffer_limitation.pdf

It looks like they suggest to use the same stream profile on multiple devices to prevent this problem.

Thanks in advance for looking at this and for all the great work!

Future events



{
    'operation': 'Initialized',
    'topic': 'tns1:LightControl/tnsaxis:LightStatusChanged/Status',
    'type': 'state',
    'value': 'OFF'
}
{
  'operation': 'Initialized',
  'topic': 'tnsaxis:Storage/Recording',
  'type': 'recording',
  'value': '0'
}
{
  'operation': 'Initialized',
  'topic': 'tnsaxis:Storage/Disruption',
  'source': 'disk_id',
  'source_idx': 'NetworkShare',
  'type': 'disruption',
  'value': '1'
}
{
  'operation': 'Initialized',
  'topic': 'tns1:Device/tnsaxis:HardwareFailure/StorageFailure',
  'source': 'disk_id',
  'source_idx': 'SD_DISK',
  'type': 'disruption',
  'value': '1'
}
{
  'operation': 'Initialized',
  'topic': 'tns1:VideoSource/tnsaxis:LiveStreamAccessed',
  'type': 'accessed',
  'value': '1'
}
{
  'operation': 'Initialized',
  'topic': 'tns1:Device/Trigger/DigitalInput',
  'source': 'InputToken',
  'source_idx': '0',
  'type': 'LogicalState',
  'value': 'false'
}
{
  'operation': 'Initialized',
  'topic': 'tns1:RuleEngine/MotionRegionDetector/Motion',
  'source': 'VideoSource',
  'source_idx': '0',
  'type': 'State',
  'value': '0'
}

Axis problem with post command

hello, im see you proyect and im awesome, i have little question about post request.

im working with Axis cameras and i cant reach to create a motion detection event using Vapix.

Can you explain me? :c

Axis integration, motion sensors randomly stops reporting

The problem

I have added AXIS M7011 camera with 3x motion sensors using AXIS integration.
Randomly 1-12h, all 3x motion sensors stopping reporting any motion. On the same time, camera stream works fine.
If i make Reload of integration, motion sensors works again for 1-12 hours.

Later i installed second test HA on another machine and connected AXIS M7011. Motion sensors works for weeks without any problems (same camera).

Please help, how to debug this?

What is version of Home Assistant Core has the issue?

core-2021.9.6

home-assistant/core#56129

rtsp streaming player window

Hi,

I'm trying to develop a rtsp video display window using gstreamer integrated with axis code, then do you have any reference or example of the subject?

Thank you.

Request: option to allow stream to be configurable

Thanks for the great work on this component !

It would be great to get an option to allow stream to be configurable. I have an AXIS M3058, and the default image with the component is the 360° fisheye view. It would be great to be able to select, as an example, the quad-view.

Thanks !

RTSP handshake problems after HA 0.57.1

After upgrading HA to 0.57.1 the following errors occur in home-assistant.log:

2017-11-04 18:43:03 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _SelectorSocketTransport._read_ready()
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 730, in _read_ready
    self._protocol.data_received(data)
  File "/srv/homeassistant/lib/python3.5/site-packages/axis/rtsp.py", line 76, in data_received
    self.transport.write(self.method.message.encode())
  File "/srv/homeassistant/lib/python3.5/site-packages/axis/rtsp.py", line 190, in message
    message = self.message_methods[self.session.method]()
  File "/srv/homeassistant/lib/python3.5/site-packages/axis/rtsp.py", line 224, in SETUP
    message = "SETUP " + self.session.control_url + " RTSP/1.0\r\n"
TypeError: Can't convert 'NoneType' object to str implicitly

Using Hassbian v1.3, Axis M1031-W camera
Although the camera functioning well in HA.

Feature request of PTZ commands and preset positions in Axis cameras

It would be nice to add PTZ commands and preset positions for Axis cameras. I tried the ONVIF integration and it sort of works, but it is extremely slow with the Axis cameras, so it's unusable.
In addition it would be nice to be able to force MJPEG video configuration, which is the fastest communication with the cameras.

Axis camera motion sensor becomes unavailable

The problem

The motion sensors (vdm4) of my Axis cameras (both P3228-LVE) turn unavailable after a certain time.
When I restart HA or reload the integration the sensors are available. There is no specific warning or error in my log.

This only happens for my Axis P3228-LVE. The sensors of my M3106-LVE-MkII are working fine.

What version of Home Assistant Core has the issue?

core-2023.4.3

home-assistant/core#91558

Websocket support

https://github.com/dmannion1972/axis-websocket-metadata-python/blob/main/getsesssionid.py

https://github.com/dmannion1972/axis-websocket-metadata-python

encode/httpx#304
https://gist.github.com/tomchristie/3293d5b118b5646ce79cc074976744b0

import trio

async def main():
    async with ws_connect("ws://127.0.0.1:8765") as websockets:
        await websockets.send("Hello, world.")
        message = await websockets.recv()
        print(message)

trio.run(main)
import base64
import contextlib
import os

import httpx
import wsproto


class ConnectionClosed(Exception):
    pass


class WebsocketConnection:
    def __init__(self, network_steam):
        self._ws_connection_state = wsproto.Connection(wsproto.ConnectionType.CLIENT)
        self._network_stream = network_steam
        self._events = []

    async def send(self, text):
        """
        Send a text frame over the websocket connection.
        """
        event = wsproto.events.TextMessage(text)
        data = self._ws_connection_state.send(event)
        await self._network_stream.write(data)

    async def recv(self):
        """
        Receive the next text frame from the websocket connection.
        """
        while not self._events:
            data = await self._network_stream.read(max_bytes=4096)
            self._ws_connection_state.receive_data(data)
            self._events = list(self._ws_connection_state.events())

        event = self._events.pop(0)
        if isinstance(event, wsproto.events.TextMessage):
            return event.data
        elif isinstance(event, wsproto.events.CloseConnection):
            raise ConnectionClosed()


@contextlib.asynccontextmanager
async def ws_connect(url):
    headers = {
        "connection": "upgrade",
        "upgrade": "websocket",
        "sec-websocket-key": base64.b64encode(os.urandom(16)),
        "sec-websocket-version": "13",
    }

    async with httpx.AsyncClient() as client:
        async with client.stream("GET", url, headers=headers) as response:
            network_steam = response.extensions["network_stream"]
            yield WebsocketConnection(network_steam)

Delay in Home Assistant live view

Hi Kane,

I don't know if you can help me with this, but I've the problem that my live view in HA always have a delay of +- 10 seconds.
If this with both my Axis cameras, and it has always been like this.

Do you have any idea about how to make the delay shorter?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.