BeardedTek / HassPyFrigate

GNU General Public License v3.0
2 stars 0 forks source link

Lot of Starting Apache httpd web server: apache2 in the log. #1

Closed rjm12rjm12 closed 2 years ago

rjm12rjm12 commented 2 years ago

This looks great, just installed it. Will try out when I get home. Should this be happening continuously?

[15:46:48] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:49] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:49] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:50] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:50] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:51] INFO: Starting Apache... Starting Apache httpd web server: apache2. [15:46:51] INFO: Starting Apache... Starting Apache httpd web server: apache2.

williamkennyAK commented 2 years ago

I've noticed this as well. It runs perfectly fine, but definitely filling the error log. A new version is coming out VERY soon that adds an event viewer and some visual improvements. Should be out within a few days.

rjm12rjm12 commented 2 years ago

Great, I'll be looking for the update. Any thoughts about a way to only get one notification per some time period. I'm tracking when my dog is ready to come in, but just want to get one notification.

Thanks for you work.

Rob


From: William Kenny @.> Sent: Thursday, December 16, 2021 3:53 PM To: BeardedTek/HassPyFrigate @.> Cc: Rob @.>; Author @.> Subject: Re: [BeardedTek/HassPyFrigate] Lot of Starting Apache httpd web server: apache2 in the log. (Issue #1)

I've noticed this as well. It runs perfectly fine, but definitely filling the error log. A new version is coming out VERY soon that adds an event viewer and some visual improvements. Should be out within a few days.

— Reply to this email directly, view it on GitHubhttps://github.com/BeardedTek/HassPyFrigate/issues/1#issuecomment-996186006, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKH65JG6SB2V77YS2Z6TKELURJGVPANCNFSM5KHIQOYA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

BeardedTek commented 2 years ago

https://community.home-assistant.io/t/frigate-mobile-app-notifications/311091 contains a blueprint that does this. I have not implemented it yet as I'm trying to get more notifications for testing at this point, but will most likely write one for the next iteration of the addon.

bruno-dogancic commented 2 years ago

I would like to try this one out but I cannot set it up... I have installed and started addon, in home assistant configuration I did this: (Only changed my hass public ip)

rest_command:
  hasspyfrigate:
    url: https://mypublicip.duckdns.org:8123/cgi-bin/hasspyrest.py
    method: POST
    headers:
      accept: "application/json, text/html"
      user-agent: "Mozilla/5.0 {{ useragent }}"
    payload: '{
      "table": "events",
      "debug": "1",
      "function": "INSERT",
      "columns" : {
      "event_id": "{{event_id}}",
      "url": "{{url}}",
      "camera": "{{camera}}",
      "type": "{{type}}",
      "bbox": "{{bbox}}"
      }
      }'
    content_type: "application/json; charset=utf-8"

And added notification automation as this (also, only changed my hass ip address)

- id: "hasspyfrigate"
  alias: HassPyFrigate
  description: Object Detection Alerts Using HassPyFrigate
  trigger:
    - platform: mqtt
      topic: frigate/events
  condition:
    - condition: template
      value_template: '{{ trigger.payload_json["type"] == "end" }}'
    - condition: template
      value_template:
        "{{ trigger.payload_json[\"after\"][\"label\"] == \"person\" or\n\
        \   trigger.payload_json[\"after\"][\"label\"] == \"bird\" or\n   trigger.payload_json[\"\
        after\"][\"label\"] == \"dog\" or\n   trigger.payload_json[\"after\"][\"label\"\
        ] == \"cat\" or\n   trigger.payload_json[\"after\"][\"label\"] == \"bear\" or\n\
        \   trigger.payload_json[\"after\"][\"label\"] == \"horse\" \n}}"
  action:
    - service: notify.notify
      data:
        message: '{{ trigger.payload_json["after"]["label"] | title }} Detected'
        data:
          notification_icon: mdi:cctv
          ttl: 0
          priority: high
          sticky: true
          actions:
            - action: URI
              title: Event Viewer
              uri: https://mypublicip.duckdns.org:8123/cgi-bin/hasspyfrigate.py?id={{trigger.payload_json['after']['id']}}&camera={{trigger.payload_json['after']['camera']}}&bbox=true
          image: /api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg?bbox=1
          tag: '{{trigger.payload_json["after"]["id"]}}'
          alert_once: true
    - service: rest_command.hasspyfrigate
      data:
        event_id: "{{trigger.payload_json['after']['id']}}"
        camera: "{{trigger.payload_json['after']['camera']}}"
        type: "{{ trigger.payload_json['after']['label'] | title }}"
        bbox: 1
  mode: single

Do I have to do anything besides that? I run my homeassistant on raspberry PI as Home Assistant Operating System.

Cheers!

BeardedTek commented 2 years ago
actions:
            - action: URI
              title: Event Viewer
              uri: https://mypublicip.duckdns.org:8123/cgi-bin/hasspyfrigate.py?id={{trigger.payload_json['after']['id']}}&camera={{trigger.payload_json['after']['camera']}}&bbox=true

Should be:

actions:
            - action: URI
              title: Event Viewer
              uri: https://mypublicip.duckdns.org:8001/cgi-bin/hasspyfrigate.py?id={{trigger.payload_json['after']['id']}}&camera={{trigger.payload_json['after']['camera']}}&bbox=true

port 8001 as this is where the port should be configured by default.

The addon runs an instance of apache in docker which home assistant routes to the port forwarded in the config below.

Screenshot_20211218-100635_Home Assistant.png

BeardedTek commented 2 years ago

The code here is in a state of flux. The README is for v0.2, but the addon is still running v0.1. Please refer to the readme in the v0.1 release as it has changed slightly:

HassPyFrigate

Python 3 CGI script for better looking notifications

v0.1

SERVER SIDE SETUP

Home Assistant Automations

Android Companion App Notification

Example Android Actionable Notification

Click on "Event Viewer" to view HassPyFrigate Event Viewer Android Actionable Notification The following Automation will send an actionable notification to the android companion app (Should work with iOS as well)

alias: HassPyFrigate Alert
description: HassPyFrigate Object Detection Alerts Using Frigate
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: '{{ trigger.payload_json["type"] == "end" }}'
  - condition: template
    value_template: |-
      {{ trigger.payload_json["after"]["label"] == "person" or 
         trigger.payload_json["after"]["label"] == "car" or
         trigger.payload_json["after"]["label"] == "bird" or
         trigger.payload_json["after"]["label"] == "dog" or
         trigger.payload_json["after"]["label"] == "cat" or
         trigger.payload_json["after"]["label"] == "bear" or
         trigger.payload_json["after"]["label"] == "horse" 
      }}
action:
  - service: notify.mobile_app_sm_g986u1
    data:
      message: '{{ trigger.payload_json["after"]["label"] | title }} Detected'
      data:
        notification_icon: mdi:cctv
        ttl: 0
        priority: high
        sticky: true
        actions:
          - action: URI
            title: Snapshot
            uri: >-
              http://YOUR_SERVER/cgi-bin/hasspyfrigate.py?id={{trigger.payload_json['after']['id']}}&camera={{trigger.payload_json['after']['camera']}}&bbox=true&url=https://hass.jeandr.net/api/frigate/notifications/&time={{trigger.payload_json['after']['start_time']}}&css=../css/hasspyfrigate.css#
        image: >-
          /api/frigate/notifications/{{trigger.payload_json['after']['id']}}/snapshot.jpg?bbox=1
        tag: '{{trigger.payload_json["after"]["id"]}}'
        alert_once: true
mode: single
BeardedTek commented 2 years ago

Please also note I have updated the README.md in the addon repository to avoid confusion.

bruno-dogancic commented 2 years ago

Thank you for your prompt help! I cannot find cgi-bin folder in home assistant os.

Also, as I see, now for the notification I need local IP address, or? And do I need port if using local IP address. Sorry for so many questions I got lost with this documentation

BeardedTek commented 2 years ago

Conversation moved to a new issue in the addon repository

https://github.com/BeardedTek/BeardedTek-hassio-addons/issues/1

BeardedTek commented 2 years ago

Released next hassio addon will be delayed until after Christmas. My primary testing machine decided to quit working.

Hope everyone has a Merry Christmas/Happy Holidays.

BeardedTek commented 2 years ago

Quick update: I have been working on rewriting the code as it was a PITA to troubleshoot. I've made it more modular and am a couple days away from a new release!

This will actually download the clip and snap from Frigate, make a thumbnail of the event snapshot optimized for the web and make it available for viewing even if Frigate is offline, and so you can easily save events you want to keep.

It also allows for easily deleting events you no longer want. This will allow you to set your recordings on frigate to 1 day or even less and store everything here with less restrictions and no worry about recordings building up like crazy on your frigate drive (or in your home assistant instance if using the addon)

New Main Interface New Menu New Event Viewer New Clip Viewer New Snapshot Viewer

.

williamkennyAK commented 2 years ago

The easiest way at this point would be to:

1) Add a helper input boolean

2) Have your automation toggle the input boolean on

3) Have your automation wait an amount of time that you hard code in or grab from a helper variable then toggle it off after say 1 minute.

4) Add the input boolean as a condition to block execution.

In a future release I plan a config page that will allow you to easily modify your automations including a cool-down time.

BeardedTek commented 2 years ago

The new verison is now released under a different name: fEVR - frigate Event Video Recorder (pronounced [fee-ver] https://github.com/BeardedTek-com/fEVR

The UI is MUCH better and instead of heavily modifying this repository, I've moved it into a completely separate repo.

fEVR-main