ikalchev / HAP-python

A python implementation of the HomeKit Accessory Protocol (HAP)
Other
619 stars 119 forks source link

Camera accessory snapshot failed in bridge accessory #178

Open quadcube opened 5 years ago

quadcube commented 5 years ago

Tried to implement the camera accessory with according to the example from camera_main.py, where "get_snapshot" is not defined is thrown whenever there's a snapshot request. Implementing as a single accessory works though.

Exception happened during processing of request from ('192.168.88.237', 57022) Traceback (most recent call last): File "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread self.finish_request(request, client_address) File "/usr/local/lib/python3.5/dist-packages/pyhap/hap_server.py", line 839, in finish_request self.RequestHandlerClass(sock, client_addr, self, self.accessory_handler) File "/usr/local/lib/python3.5/dist-packages/pyhap/hap_server.py", line 143, in __init__ super(HAPServerHandler, self).__init__(sock, client_addr, server) File "/usr/lib/python3.5/socketserver.py", line 681, in __init__ self.handle() File "/usr/lib/python3.5/http/server.py", line 424, in handle self.handle_one_request() File "/usr/lib/python3.5/http/server.py", line 410, in handle_one_request method() File "/usr/local/lib/python3.5/dist-packages/pyhap/hap_server.py", line 204, in dispatch getattr(self, self.HANDLERS[self.command][path])() File "/usr/local/lib/python3.5/dist-packages/pyhap/hap_server.py", line 577, in handle_resource raise ValueError('Got a request for snapshot, but the Accessory ' ValueError: Got a request for snapshot, but the Accessory does not define a "get_snapshot" method

hunterjm commented 5 years ago

Bumping this. I got the same error. It looks like hap_server is looking at the bridge accessory instead of the camera.

bdraco commented 4 years ago

@quadcube This is how HomeAssistant solved this

https://github.com/home-assistant/core/blob/dev/homeassistant/components/homekit/accessories.py#L494