iOS actionable notification with camera image attached

Just began looking for a solution to this. Subscribed.

Hi all,
I got the camera feed working in a notification. You need to make sure that the camera has access to the internet itself. With a local ip address it won’t work.

The configuration:

  - name: iphones
    platform: group
    services:
      - service: ios_iphone_van_alex
      - service: ios_hildes_iphone

The automayion code:
action:

    - service: notify.iphones
      data:
        message: "Beweging achterkant huis!"
        data:
          push:
            category: camera
          entity_id: camera.achterkant

Yes the camera is easy to do. Never had a problem, it’s the combination of it and the custom actions in the same push Notification

USo I managed to figure out what is causing this and was able to fix it but I do not know the implications of my fix.

What is happening:

The ios app wants a Lowercase category of “camera” in order to load the Camera “player” in the notification.

When we name our custom category the HA-ios code turns them into uppercase before passing them to the iphone for interpretation. So now in your phone its look for category CAMERA to load the actions and category camera to load the camera stream.

What I did to fix it or at least to get it working is changed this line in the ios.py from vol.Upper to vol.Lower.

Can someone try running this copy or if someone can thing of a better fix? by running this copy you might have to make some changes to your config to make sure your config and messages match your capitalization.

https://github.com/rbflurry/home-assistant/blob/ios-notify-camera-fix/homeassistant/components/ios.py#L124

However this implementation limits the use of the camera stream to only that notification actions. So you could not create multiple camera categories for different situations.

1 Like

Cool! I’d like to test for you. Where would I put this file? Would I put it in custom components? Can’t see where homeassistant stores these files on a Mac

I could not get it to work under custom components and had to make the changes to the live copy.

Cool, thank you to invest some time on it, I’ll try it and comment about it!

It would be awesome to add the necessary changes to the docs, in addition to the PR with the change.

As soon as I can figure out where the file should go I’ll be happy to help test. I tried searching for an hour and gave up. No idea on a Mac where it installs. :frowning:

Maybe /Library/Python/2.6/site-packages/ or whatever version you are on?

1 Like

If you need to ‘tune’ your Home Assistant installation, in a shell where you can run HA, enter python and find out where the ios component is:

import homeassistant.components.ios as ios
print(ios.__file__)

It should show you something like /path/to/homeassistant/components/ios.py. Edit that file.

1 Like

So I can confirm, this fixes the issue.

I can create different notifications with different cameras but there is a limitation with the notifications. Only one set can be used.

the fix is now live in 0.54.0

Can someone post a working example?

This will be on the website soon as an example.

ios:
  push:
    categories:
      - name: Camera With Actions
        identifier: 'camera'
        actions:
          - identifier: 'OPEN_COVER'
            title: 'Open Cover'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: no
          - identifier: 'CLOSE_COVER'
            title: 'Close Cover'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: yes

and the automation to send the message would look like this.

- alias: Send Message when iphone
  trigger:
    - platform: state
      entity_id: input_boolean.test
      from: 'off'
      to: 'on'
  action:
   service: notify.ios_ryans_iphone_app
   data_template:
      title: 'Cover Left Open'
      message: >
        "No one is but the cover is open"
      data:
        push:
          category: camera
        entity_id: camera.cam234
5 Likes

Will this work for more then one camera?

In one message?no Or a different camera on different messages? yes

The camera entity_id is sent in the message body so it can change.

I wonder if someone could eventually rewrite this to allow for multiple combinations of cameras and actionable notifications? I would totally if I knew what I was doing. :thinking:

I would, but I am pretty sure you need a mac to code in swift… I have been trying to figure out a generic message set and automations for a catch all but It still needs some work.

For example I have my camera message identifier setup with two buttons.

Open, Turn on, Yes, Unlock

and

Close, Turn Off, No, Lock

That way it could easily be used in one or more use case.

Guys, this can be work with any camera?
my work also with android with a use pushbullet?

Has anyone got this working yet?

I can only get either notifications OR camera, but never both at the same time.