HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
49 stars 9 forks source link

Failed to call service openhasp.push_image / OpenHASP 0.6.4 #93

Closed nate922 closed 2 years ago

nate922 commented 2 years ago

openHASP Custom Component 0.6.4 - HA Supervisor Core 2022.03.5

Any calls to service comes back with "Failed to call service openhasp.push_image" The component seems to save the image however fails on [homeassistant.helpers.script.websocket_api_script] / http connection

-- Config:

service: openhasp.push_image data: obj: p3b2 image: https://people.sc.fsu.edu/~jburkardt/data/jpg/lena.jpg width: 200 height: 200 target: entity_id: openhasp.entranceplate


Debugs:

homeassistant.components.openhasp: debug
homeassistant.components.websockets: debug
homeassistant.components.websocket_api: debug

2022-03-15 14:33:53 DEBUG (SyncWorker_1) [custom_components.openhasp.image] image_to_rgb565 out_image: /tmp/tmp8lngngap 2022-03-15 14:33:53 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139894856448464] Received {'type': 'execute_script', 'sequence': [{'service': 'openhasp.push_image', 'data': {'obj': 'p3b2', 'image': 'https://people.sc.fsu.edu/~jburkardt/data/jpg/lena.jpg', 'width': 200, 'height': 200}, 'target': {'entity_id': 'openhasp.entranceplate'}}], 'id': 69} 2022-03-15 14:33:53 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1: 2022-03-15 14:33:53 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139894856448464] Error handling message: 2022-03-15 14:33:53 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [139894856448464] Sending {"id":68,"type":"result","success":false,"error":{"code":"unknown_error","message":""}}

Any pointers would be greatly appreciated. Thanks guys.

htvekov commented 2 years ago

Hi'

Working perfectly here with similar test scenario:

service: openhasp.push_image
data:
  image: https://people.sc.fsu.edu/~jburkardt/data/jpg/lena.jpg
  obj: p2b40
  width: 128
  height: 128
target:
  entity_id: openhasp.wt32_02

Are you using duckdns or similar by any chance, as openHASP custom component currently doesn't support SSL/HTTPS. I had similar error messages back when I initially tested the push image function. I was running with duckdns, but had to revert to local http access only in order to get push image to work.

Initially openHASP didn't support HTTPS paths, but @fvanroie has made the neccessary changes some months back to the actual plate sw. This has been tested and is working perfectly.

But currently CC recieves the converted image in a folder that HA doesn't allow HTTPS access to. Folder is not exposed outside HA core at all, so it's not even possible to whitelist it. We need @dgomes to make the necessary changes to the custom component in order to be able to use both HTTP/HTTPS and SSL certs.

Check out my issue report here: https://github.com/HASwitchPlate/openHASP-custom-component/issues/81

Ciao !

nate922 commented 2 years ago

@htvekov Thanks for the reply

I read your issue report and you're right. I am using the exact setup you mentioned on your report, with duckdns and https.

However, this is strange as I do not get any debug on the plate itself, no MQTT messages pointing to the URL so we might be looking a separate issue. I understand that with the https setup it wouldn't of worked anyway.

Were you getting this message when you were using https ?

2022-03-15 14:33:53 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Error for call_service at pos 1:

htvekov commented 2 years ago

Can't really remember what errors I got back then. Some are included in the two gitHub issue reports I made, but certainly not all.

Have you tested that push image works in your environment with local files from whitelisted HA folders (www) ? Try and make that simple test directly from HA developer tab -> service calls. Even though it most likely wont work according to your log files. Issue seems to lie elsewhere in HA. Also strange that no MQTT command is issued.

But in order to make cc push image work at all, you have to (at least temporary) disable HA HTTPS and SSL 😉

service: openhasp.push_image
data:
  image: http://192.xxx.x.xx:8123/local/my_favourite_picture.png
  obj: p2b40
  width: 128
  height: 128
target:
  entity_id: openhasp.wt32_02
nate922 commented 2 years ago

http works great, looks like we hit the same issue.

Really appreciate your time @htvekov - have a great evening!