gugutab / TvOverlay

105 stars 3 forks source link

cached picture #9

Open grzestel opened 10 months ago

grzestel commented 10 months ago

My automation is capturing camera stream and oversaving as a file and then sending notification but by your integration displays only one cached picture, telegram notify and Notifications for android TV works fine

alias: a_wysyla powiadomienie overlay
sequence:
  - service: notify.tvoverlaynotify
    data:
      title: Wykryto!
      message: ruch na klatce
      data:
        id: notification_sample
        appTitle: Powiadomienie
        smallIcon: mdi:camera-account
        color: "#FFF000"
        largeIcon: mdi:motion-sensor
        corner: bottom_end
        seconds: 5
        image: http://192.168.88.70:8123/local/image/klatka.jpg
mode: restart
icon: mdi:television
gugutab commented 10 months ago

Hey @grzestel ! In this example I add an timestamp to the camera still URL to avoid this cache problem:

alias: Motion notification
trigger:
  - type: motion # For the trigger, I selected my camera device on the UI, and it had an option for 'Motion started detecting motion'
    platform: device
    device_id: [device_id]
    entity_id: [device_id]
    domain: binary_sensor
condition: []
action:
  - service: notify.tvoverlaysample
    data:
      message: Motion detect at Front door!
      data:
        image: >-
          [home_assistant_external_url]{{ state_attr('camera.[CAMERA]',
          'entity_picture')+'&time='}}{{as_timestamp(now())}} 
          # home_assistant_external_url is my https url for my home assistant. 
          # entity_picture is a parial url to the camera still image, like '/api/camera_proxy/camera.[CAMERA}?token=XXX'.
          # I added a timestamp simply to avoid the image being cached.
        color: "#B00020"
        largeIcon: mdi:motion-sensor
        smallIcon: mdi:camera
        seconds: 10
mode: single

I'm thinking in a way to add an optional way to disable cache