Klathmon / python-family-hub-local

Python API for accessing information from Samsung FamilyHub fridges locally.
MIT License
12 stars 2 forks source link

Error handling message: type camera_thumbnail #1

Open aLTeReGo-SWI opened 5 years ago

aLTeReGo-SWI commented 5 years ago

I’ve been the Samsung Family Hub component with Home Assistant for several months now and a couple of weeks ago for no apparent reason it suddenly stopped working. The following related error appears in my home-assistant.log file.

Relevant Section of Home Assistant configuration.yaml

camera:

Troubleshooting Steps Taken: I rebooted my Router Rebooted the Smart Hub Upgraded Home Assistant from 0.84.6 to 0.87.0 Verified the cameras are working and images are current in both SmartThings App and Family Hub App

SmartHub Model RF23M8590SG/AA,RF23M8590SR/AA,RF23M8070SG/AA,RF23M8570S

SmartHub Software Version TIZEN 3.0 (FHUB3M.KM.US.RF8000.MP 20181121_061901

Latest version software already installed

2019-02-09 14:09:49 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 18}

Traceback (most recent call last):

File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response

await func(hass, connection, msg)

File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/init.py", line 463, in websocket_camera_thumbnail

image = await async_get_image(hass, msg['entity_id'])

File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/init.py", line 93, in async_get_image

image = await camera.async_camera_image()

File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image

return await self.family_hub_cam.async_get_cam_image()

File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image

pil_images = list(map(Image.open, images))

File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2687, in open

% (filename if filename else fp))

OSError: cannot identify image file <_io.BytesIO object at 0x6dc4a420>

Grepping the Home Assistant Log for the word 'hub' returns additional info 2019-02-09 14:09:49 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 18} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image 2019-02-09 14:09:53 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 28} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() 2019-02-09 14:10:02 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 34} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() 2019-02-09 14:10:13 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 40} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image 2019-02-09 14:10:24 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 46} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() 2019-02-09 14:10:32 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1821292624] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 52} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image 2019-02-09 14:12:48 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1797889872] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 22} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() 2019-02-09 14:13:01 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1797889872] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 28} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() self._hub.update() self._hub.update() 2019-02-09 14:13:50 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1854923408] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 22} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image self._hub.update() self._hub.update() 2019-02-09 14:14:13 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1854923408] Error handling message: {'type': 'camera_thumbnail', 'entity_id': 'camera.familyhub_camera', 'id': 30} File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/familyhub.py", line 53, in async_camera_image return await self.family_hub_cam.async_get_cam_image() File "/usr/local/lib/python3.6/site-packages/pyfamilyhublocal/init.py", line 33, in async_get_cam_image

Klathmon commented 5 years ago

Thanks for the in-depth report, that helps a ton!

So first things first, it looks like the error is that it can't find the image at the place that this lib is saying it should be.

Can you go to http://10.10.10.19:17654/.krate/owner/share/scloud/glazeCameraInfo.txt and let me know if anything shows up? Specifically it should be a text file which has array of pastHistory_URL and/or a GlazeURL line, and a bunch of URLs after that.

Just make sure not to include your userId if you copy and paste that file somewhere. In my exploration of this API I learned that with that ID you might be able to access some info stored in your samsung account (like fridge drawings, pictures, and other stuff), so just treat that like a password.

If that link is working and those fields are there, try replacing glazeCameraInfo.txt with one of the images from the GlazeURL list, so it will look something like this:

http://10.10.10.19:17654/.krate/owner/share/scloud//camera_1_2019-02-09.jpg

That should point directly to one of the levels of the camera in the fridge, so let me know if it doesn't load or something.

aLTeReGo-SWI commented 5 years ago

Output from > http://10.10.10.19:17654/.krate/owner/share/scloud/glazeCameraInfo.txt

{ "doorOpenedTime" : "2019-01-06T19:14:44", "GlazeURL" : [ "/camera_1_2019-01-06.jpg", "/camera_2_2019-01-06.jpg", "/camera_3_2019-01-06.jpg" ], "pastHistory_URL" : [ [ "/camera_1_2019-01-05.jpg", "/camera_2_2019-01-05.jpg", "/camera_3_2019-01-05.jpg" ], [ "/camera_1_2019-01-04.jpg", "/camera_2_2019-01-04.jpg", "/camera_3_2019-01-04.jpg" ], [ "/camera_1_2019-01-03.jpg", "/camera_2_2019-01-03.jpg", "/camera_3_2019-01-03.jpg" ], [ "/camera_1_2019-01-02.jpg", "/camera_2_2019-01-02.jpg", "/camera_3_2019-01-02.jpg" ], [ "/camera_1_2019-01-01.jpg", "/camera_2_2019-01-01.jpg", "/camera_3_2019-01-01.jpg" ], [ "/camera_1_2018-12-31.jpg", "/camera_2_2018-12-31.jpg", "/camera_3_2018-12-31.jpg" ], [ "/camera_1_2018-12-30.jpg", "/camera_2_2018-12-30.jpg", "/camera_3_2018-12-30.jpg" ], [ "/camera_1_2018-12-29.jpg", "/camera_2_2018-12-29.jpg", "/camera_3_2018-12-29.jpg" ], [ "/camera_1_2018-12-28.jpg", "/camera_2_2018-12-28.jpg", "/camera_3_2018-12-28.jpg" ], [ "/camera_1_2018-12-27.jpg", "/camera_2_2018-12-27.jpg", "/camera_3_2018-12-27.jpg" ], [ "/camera_1_2018-12-26.jpg", "/camera_2_2018-12-26.jpg", "/camera_3_2018-12-26.jpg" ], [ "/camera_1_2018-12-25.jpg", "/camera_2_2018-12-25.jpg", "/camera_3_2018-12-25.jpg" ], [ "/camera_1_2018-12-24.jpg", "/camera_2_2018-12-24.jpg", "/camera_3_2018-12-24.jpg" ], [ "/camera_1_2018-12-23.jpg", "/camera_2_2018-12-23.jpg", "/camera_3_2018-12-23.jpg" ], [ "/camera_1_2018-12-22.jpg", "/camera_2_2018-12-22.jpg", "/camera_3_2018-12-22.jpg" ], [ "/camera_1_2018-12-21.jpg", "/camera_2_2018-12-21.jpg", "/camera_3_2018-12-21.jpg" ], [ "/camera_1_2018-12-20.jpg", "/camera_2_2018-12-20.jpg", "/camera_3_2018-12-20.jpg" ], [ "/camera_1_2018-12-19.jpg", "/camera_2_2018-12-19.jpg", "/camera_3_2018-12-19.jpg" ], [ "/camera_1_2018-12-18.jpg", "/camera_2_2018-12-18.jpg", "/camera_3_2018-12-18.jpg" ] ], "pastHistory_doorOpenedTime" : [ "2019-01-06T04:10:12", "2019-01-05T04:10:02", "2019-01-04T04:00:18", "2019-01-03T03:40:28", "2019-01-02T05:21:04", "2019-01-01T04:25:08", "2018-12-31T04:25:28", "2018-12-30T01:26:43", "2018-12-29T04:44:25", "2018-12-28T05:20:41", "2018-12-27T05:22:34", "2018-12-26T03:10:38", "2018-12-25T05:30:01", "2018-12-24T03:53:17", "2018-12-23T05:45:55", "2018-12-22T03:24:19", "2018-12-21T04:57:51", "2018-12-20T03:59:44", "2018-12-19T02:37:29" ], "StorageModes" : [ "STORAGE_FRIDGE", "STORAGE_FREEZER", "STORAGE_FLEX_ZONE_18K", "STORAGE_PANTRY" ], "drawSize" : [ { "startX" : 14, "startY" : 87, "width" : 1252, "height" : 542 }, { "startX" : 14, "startY" : 178, "width" : 1252, "height" : 542 }, { "startX" : 14, "startY" : 116, "width" : 1252, "height" : 542 } ], "homeScreenIndex" : 1, "userId" : "REMOVED" }

I tried a variety of different image URLs. Some with an extra '/' as you stated above, and others without like the following, but all produced the same message 'Not Found'. http://10.10.10.19:17654/.krate/owner/share/scloud//camera_1_2019-01-05.jpg http://10.10.10.19:17654/.krate/owner/share/scloud/camera_3_2019-01-06.jpg

aLTeReGo-SWI commented 5 years ago

Interestingly enough, the following URL appears to produce a sock image of a salad

http://10.10.10.19:17654/.krate/owner/share/scloud/camera_1.jpg

Some onions and asparagus http://10.10.10.19:17654/.krate/owner/share/scloud/camera_2.jpg

Lime Water and a pitcher of lemon water http://10.10.10.19:17654/.krate/owner/share/scloud/camera_3.jpg

Klathmon commented 5 years ago

I'm at a loss for what could be causing those to return not found, and the stock images are quite weird! My fridge doesn't act like that at all.

I'm wondering if there is something that you did with the fridge (that I haven't done) that triggered that kind of response, especially with the stock images. I really don't know how else to help out here, aside from maybe seeing if a factory reset of the fridge software will resolve the issue?

You have the exact same model as me, and are on the same software version... that's really weird, sorry I can't be much more help.

Klathmon commented 5 years ago

I just noticed that the times and dates on your list are over a month old. It looks like something might be causing the software to stop writing to that system.

Before doing a factory reset, i'd look through the settings (both in the app and on the fridge itself) to make sure you didn't disable anything that may impact this. I'm not sure what you would be looking for, but it looks like something triggered the fridge to stop saving the image data around january 6th.

As a little background, the times on those dates look like they should apply to the last time the door was opened, but in my experience it doesn't, it's just a random time that it decides to update this location. On my fridge it happens about 3 times per day, but it happens regardless of whether I open the door or don't. So don't look for those times to make any sense, just look to see if you can get the dates to be today.

Actually, let's see if it's still saving the data but just not updating the glaze camera info, try this link and see if it loads something:

http://10.10.10.19:17654/.krate/owner/share/scloud/camera_1_2019-02-11.jpg

aLTeReGo-SWI commented 5 years ago

Both of the URLs below produced the same 'Not Found' error.

http://10.10.10.19:17654/.krate/owner/share/scloud/camera_1_2019-02-11.jpg http://10.10.10.19:17654/.krate/owner/share/scloud/camera_1_2019-02-12.jpg

This is super strange as the app is up-to-date. This appears to be Fridge specific and not related to your code. I appreciate you looking into this for me. I'll continue to tinker around with the fridge and see if there's anything I can find. If you have any other ideas or suggestions, don't hesitate to let me know. This is a real brain teaser. :(

img_2123

mikekubacki commented 2 years ago

In my case I cannot even see the actual txt file. Fridge name in my Deco Mesh network is shown as TIZEN, hence I figured out it must be the one and when trying the IP I get page not found. Maybe in recent updates the location or port has changed?

http://{the_ip}:17654/.krate/owner/share/scloud/glazeCameraInfo.txt