giuseppecastaldo / ha-addons

Home Assistant Whatsapp Add-on
Apache License 2.0
64 stars 21 forks source link

[Bug]: Camera Proxy API not working #90

Open markushergeth opened 2 months ago

markushergeth commented 2 months ago

The problem

When I try to fetch a snapshot from a integrated camera to send it as image via the supervisor api it is not working.

I am using the following code

action: whatsapp.send_message
data:
  clientId: default
  to: 49**********@s.whatsapp.net
  body:
    image:
      url: http://supervisor/core/api/camera_proxy/camera.reolink_doorbell_schnappschusse_klar

The message is not showing up. In the logs of the add on I can only see

[2024-09-23T17:24:59.269] [ERROR] default - Cannot read properties of undefined (reading 'payload')

When I use the send notification option for android smartphone app I have the following yaml

action: notify.mobile_app_markus_s23
data:
  data:
    ttl: 0
    priority: high
    image: /api/camera_proxy/camera.reolink_doorbell_schnappschusse_klar
  message: Es hat geklingelt
enabled: true

So at least I think the URL should be right according to the REST API documentation

And according to Supervisor Endpoints the add on should have access with this.

Am I dumb and overlook something os is there really a bug with the add on?

What version of Home Assistant Core has the issue?

2024.9.2

What version of the addon has the issue?

1.4.1

What type of installation are you running?

Home Assistant OS

Log information

[15:55:27] INFO: Installed custom component.
[2024-09-23T15:55:28.403] [INFO] default - Whatsapp Addon started.
[2024-09-23T15:55:29.541] [INFO] default - default client is ready.
[2024-09-23T16:57:57.752] [ERROR] default - Cannot read properties of undefined (reading 'payload')
[2024-09-23T16:58:23.232] [ERROR] default - Cannot read properties of undefined (reading 'payload')
[2024-09-23T17:13:33.150] [ERROR] default - Cannot read properties of undefined (reading 'payload')
[2024-09-23T17:20:39.394] [ERROR] default - Cannot read properties of undefined (reading 'payload')
[2024-09-23T17:24:59.269] [ERROR] default - Cannot read properties of undefined (reading 'payload')

Additional information

No response

CancunManny commented 1 month ago

Hi, not sure if this would help but on action: whatsapp.send_message


  clientId: default
  to: 49**********@s.whatsapp.net
  body:
    image:
      url: http://supervisor/core/api/camera_proxy/camera.reolink_doorbell_schnappschusse_klar ```

I think you need quotation marks around the http url as per this example on the documentation

service: whatsapp.send_message
data:
  clientId: default
  to: 391234567890@s.whatsapp.net
  body:
    image:
      url: "https://dummyimage.com/600x400/000/fff.png"
    caption: Simple text