skrashevich/double-take

Does the notify automation still work? Can't get it to work properly

atv2016 opened this issue · 11 comments

From the docs i used below notify automation, but it's not working.

alias: Notify
trigger:
  - platform: state
    entity_id: sensor.double_take_david
  - platform: state
    entity_id: sensor.double_take_unknown
condition:
  - condition: template
    value_template: '{{ trigger.to_state.state != trigger.from_state.state }}'
action:
  - service: notify.mobile_app
    data:
      message: |-
        {% if trigger.to_state.attributes.match is defined %}
          {{trigger.to_state.attributes.friendly_name}} is near the {{trigger.to_state.state}} @ {{trigger.to_state.attributes.match.confidence}}% by {{trigger.to_state.attributes.match.detector}}:{{trigger.to_state.attributes.match.type}} taking {{trigger.to_state.attributes.attempts}} attempt(s) @ {{trigger.to_state.attributes.duration}} sec
        {% elif trigger.to_state.attributes.unknown is defined %}
          unknown is near the {{trigger.to_state.state}} @ {{trigger.to_state.attributes.unknown.confidence}}% by {{trigger.to_state.attributes.unknown.detector}}:{{trigger.to_state.attributes.unknown.type}} taking {{trigger.to_state.attributes.attempts}} attempt(s) @ {{trigger.to_state.attributes.duration}} sec
        {% endif %}
      data:
        attachment:
          url: |-
            {% if trigger.to_state.attributes.match is defined %}
              http://localhost:3000/api/storage/matches/{{trigger.to_state.attributes.match.filename}}?box=true&token={{trigger.to_state.attributes.token}}
            {% elif trigger.to_state.attributes.unknown is defined %}
               http://localhost:3000/api/storage/matches/{{trigger.to_state.attributes.unknown.filename}}?box=true&token={{trigger.to_state.attributes.token}}
            {% endif %}
        actions:
          - action: URI
            title: View Image
            uri: |-
              {% if trigger.to_state.attributes.match is defined %}
                http://localhost:3000/api/storage/matches/{{trigger.to_state.attributes.match.filename}}?box=true&token={{trigger.to_state.attributes.token}}
              {% elif trigger.to_state.attributes.unknown is defined %}
                 http://localhost:3000/api/storage/matches/{{trigger.to_state.attributes.unknown.filename}}?box=true&token={{trigger.to_state.attributes.token}}
              {% endif %}
mode: parallel
max: 10

it's an example. you need to change values -- entity_id's, URL's...

Well i removed the david sensor but other then that it should work.
Localhost should work from the local HA instance right ?

Nothing else that needs to be changed as far as i can see ?

Localhost should work from the local HA instance right ?
is Double-Take installed as add-on in HA?
Well i removed the david sensor but other than that it should work.
You need to add your's sensor instead

Yes double take is a add-on in HA.

I am triggering on double_take_unknown (as i want the unknowns).

in this case, you must replace localhost with 0a217ee8-double-take (if addon was installed from my repo)

@skrashevich This hasn't changed anything. I still get:

Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:761 
Integration: Telegram bot (documentation, issues) 
First occurred: 27 September 2023, 13:57:43 (1146 occurrences) 
Last logged: 09:09:49

Status code 500 (retry #2) loading http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token=
Status code 500 (retry #3) loading http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token=
Status code 500 (retry #4) loading http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token=
Status code 500 (retry #5) loading http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token=
Can't load data in http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token= after 5 retries

Can't send file with kwargs: {'url': 'http://0a217ee8-double-take:3000/api/storage/matches/6efdac5f-31cd-41f8-8eb5-45ae86e759e5.jpg?box=true&token=', 'caption': 'unknown is near the diningroom_camera_1 @ 25.23% by compreface:snapshot taking 24 attempt(s) @ 2.34 sec', 'timeout': 1000}

Below is my yaml i use:

service: telegram_bot.send_photo
data:
  url: >-
    {% if trigger.to_state.attributes.match is defined %}
    http://0a217ee8-double-take:3000/api/storage/matches/{{trigger.to_state.attributes.match.filename}}?box=true&token={{trigger.to_state.attributes.token}}
    {% elif trigger.to_state.attributes.unknown is defined %}
    http://0a217ee8-double-take:3000/api/storage/matches/{{trigger.to_state.attributes.unknown.filename}}?box=true&token={{trigger.to_state.attributes.token}}
    {% endif %}
  caption: |-
    {% if trigger.to_state.attributes.match is defined %}
          {{trigger.to_state.attributes.friendly_name}} is near the {{trigger.to_state.state}} @ {{trigger.to_state.attributes.match.confidence}}% by {{trigger.to_state.attributes.match.detector}}:{{trigger.to_state.attributes.match.type}} taking {{trigger.to_state.attributes.attempts}} attempt(s) @ {{trigger.to_state.attributes.duration}} sec
        {% elif trigger.to_state.attributes.unknown is defined %}
          unknown is near the {{trigger.to_state.state}} @ {{trigger.to_state.attributes.unknown.confidence}}% by {{trigger.to_state.attributes.unknown.detector}}:{{trigger.to_state.attributes.unknown.type}} taking {{trigger.to_state.attributes.attempts}} attempt(s) @ {{trigger.to_state.attributes.duration}} sec
        {% endif %}
  timeout: 1000

Can you please help?

Not sure if its on same topic but its related to the automation so I ask this here.
I got the automation working and got a notification on my phone. however when I press on "view image" I get this error:

{"error":"Access denied to IP address: ::ffff:192.168.68.158"}

The IP address is the IP address of my phone. I am on same network and not sure what to do to get it to work. any pointers?

I got this as well. The automation listed is not correct. There must be some way to authenticate io addresses or use the correct one but the ONLY way I got this working is by changing the directory where the matches are stored and putting them into a WWW directory. It's not ideal as it doesn’t show the box around the match.

________________________________ From: igalg99 @.> Sent: 29 October 2023 20:16 To: skrashevich/double-take @.> Cc: atv2016 @.>; Author @.> Subject: Re: [skrashevich/double-take] Does the notify automation still work? Can't get it to work properly (Issue #124) Not sure if its on same topic but its related to the automation so I ask this here. I got the automation working and got a notification on my phone. however when I press on "view image" I get this error: {"error":"Access denied to IP address: ::ffff:192.168.68.158"} The IP address is the IP address of my phone. I am on same network and not sure what to do to get it to work. any pointers? — Reply to this email directly, view it on GitHub<#124 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEBCFU7QAGNHMPC3RZ33EO3YB2TQ7AVCNFSM6AAAAAA5JIIAEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGIYTIMZUGM. You are receiving this because you authored the thread.Message ID: @.***>

I see. Thanks for the proposed solution. You have changed in configuration the lactation to the "media path"? So it will store , matches , train and latest into www public folder?

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.