# Automations

Automations examples.

# Notify Mobile App.

#### Notify Mobile App using image and button.

The below is a notification using the Android APP of Home Assistant to notify with an image from API of the camera or a photo from a screenshot saved local.

##### Camera API image.

```yaml
action: notify.mobile_app_kostas
data:
  message: Αυτό είναι ένα μυνήμα.
  title: Κάποιος είναι στην αυλόπορτα.
  data:
    image: /api/camera_proxy/camera.garden_door
    entity_id: camera.garden_door
    actions:
      - action: URI
        title: Κάμερα
        uri: /lovelace-cameras/garden
      - action: URI
        title: Άνοιγμα Εικόνας
        uri: /media/local/camera/garden_door/person.jpg
```

##### Photo from screenshot saved local.

```yaml
action: notify.mobile_app_kostas
data:
  message: Αυτό είναι ένα μυνήμα.
  title: Κάποιος είναι στην αυλόπορτα.
  data:
    image: /media/local/camera/garden_door/person.jpg
    entity_id: camera.garden_door
    actions:
      - action: URI
        title: Κάμερα
        uri: /lovelace-cameras/garden
      - action: URI
        title: Άνοιγμα Εικόνας
        uri: /media/local/camera/garden_door/person.jpg
```

##### File Location Mapping

The key difference is that /local/ maps to /config/www/ directory, while /media/local/ maps to /media/ directory

<table id="bkmrk-physical-path-notifi" style="border-collapse:collapse;width:100%;"><colgroup><col style="width:33.3333%;"></col><col style="width:33.3333%;"></col><col style="width:33.3333%;"></col></colgroup><tbody><tr><td>**Physical Path**</td><td>**Notification Path**</td><td>**Usage**</td></tr><tr><td>/config/www/file.jpg</td><td>/local/file.jpg</td><td>Public access, no auth required</td></tr><tr><td>/media/file.jpg</td><td>/media/local/file.jpg</td><td>Authenticated access, secure</td></tr><tr><td>Camera entity</td><td>/api/camera\_proxy/camera.entity\_id</td><td>Live camera proxy</td></tr></tbody></table>

<span style="color:rgb(224,62,45);">**Ins0mniA**</span>

# Auto Update Home Assistant

Automation that auto update Home Assistant OS , Supervisor

##### Nightly HA updates (core/supervisor/OS/add-ons)

```yaml
alias: Nightly HA updates (core/supervisor/OS/add-ons)
description: Create backup, then install all available Supervisor-provided updates.
triggers:
  - at: "03:15:00"
    trigger: time
conditions: []
actions:
  - alias: Create backup using UI-defined settings
    action: backup.create_automatic
    data: {}
  - delay: "00:02:00"
  - alias: Install available Supervisor updates (core/supervisor/OS/add-ons)
    action: update.install
    target:
      entity_id: |-
        {{ expand(integration_entities('hassio'))
           | selectattr('domain','eq','update')
           | selectattr('state','eq','on')
           | map(attribute='entity_id') | list }}
    data:
      backup: true
mode: single

```

##### Nightly HACS updates

```yaml
alias: Nightly HACS updates
description: Install all available HACS updates exposed as update entities.
triggers:
  - at: "03:30:00"
    trigger: time
conditions: []
actions:
  - alias: Install available HACS updates
    action: update.install
    target:
      entity_id: |-
        {{ expand(integration_entities('hacs'))
           | selectattr('domain','eq','update')
           | selectattr('state','eq','on')
           | map(attribute='entity_id') | list }}
    data: {}
mode: single

```

<span style="color:rgb(224,62,45);">**Ins0mniA**</span>