Companion App 1.7.0 Android Link To Camera

The following code all works great, except for the “click_action:” I am receiving a 401 Unauthorized Error when clicking my notification. I am guessing the “click action” does not support tempting? How do I link to my camera when clicking the notification on an android device? The official posted instructions appeared to apply to IOS only.

- id: '1544020732242'
  alias: Notify - Front Door Motion
  trigger:
  - entity_id: binary_sensor.front_door_motion
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: input_boolean.occupied_mode
    state: 'off'
  action:
  - data:
      entity_id: camera.front_door
      filename: /config/www/tmp/snapshot.jpg
    service: camera.snapshot
    service: notify.mobile_app_moto_g_5_plus
    data:
      title: "Someone Is At The Front Door!"
      message: "Someone Is At The Front Door!"
      data:
        image: https://***.***.***/local/tmp/snapshot.jpg?{{ now ().minute }}{{ now ().second }}
        tag: tag
        color: red
        sticky: false
        clickAction: https://***.***.***/api/camera_proxy_stream/camera.front_door?token={{states.camera.front_door.attributes.access_token}} 

Any help is appreciated. Thank-you

Change data to data_template in the service call and try again

I got it to work by doing so. Thank-you!

Too bad the data -> data_template messes up the automation in the UI a bit.

What are you using the snapshot for? I see many first take the snapshot then send the picture to the mobile. But for me this works as good (without snapshot):


- data_template:
      data:
        image: https://URL/api/camera_proxy/camera.MYCAM?token={{ state_attr("camera.MYCAM", "access_token") }}
      message: Door open
      title: Notification Test
    service: notify.mobile_app_XXXX

Is the snapshot taken for other purposes as well?

snapshot ensures the image is taken at the trigger, what you have will render the image when the device receives the notification, so if its delayed it may be from a different time. In this case you probably won’t notice much difference.

If you used something like clickAction or uri in an action then the image would be from when you tapped on the notification/action.