blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
19.09k stars 1.74k forks source link

[Support]: Simple automation doesnt catch mqtt event #2218

Closed Pascal66 closed 3 years ago

Pascal66 commented 3 years ago

Describe the problem you are having

automation doesnt catch mqtt event

- id: 'Frigate_frontdoor'
  alias: 'Frigate: frontdoor notification'

  trigger:
  - platform: mqtt
    topic: frigate/events
  condition: []

  action:
  - service: notify.telegram_bot
    data_template:
      message: "A {{trigger.payload_json['after']['label']}} was detected."
      data:
        photo:
        - url: http://ccab4aaf-frigate:5000/api/events/{{trigger.payload_json['after']['id']}}/thumbnail.jpg
          caption: "{{trigger.payload_json['after']['label']}} detected"

  - service: telegram_bot.send_message
    data:
      parse_mode: html
      keyboard: {}
      title: Frigate Event
      message: "{{trigger.event.data['args']}}"

Version

Debug 0.9.4-26ae608

Frigate config file

#relevant part:
mqtt:
  # Required: host name
  host: core-mosquitto
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: user
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: passwd
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 30

Relevant log output

#no

FFprobe output from your camera

#no

Frigate stats

No response

Operating system

HassOS

Install method

HassOS Addon

Coral version

USB

Network connection

Wired

Camera make and model

Not needed

Any other information that may be helpful

No response

blakeblackshear commented 3 years ago

Are you certain that frigate and home assistant are connected to the same mqtt server? Is frigate set to use a password when connecting to mqtt?

Pascal66 commented 3 years ago

Sure. I've all mqtt msg with mqtt. I've all mqtt test But my autmation doesnt read anything :)

blakeblackshear commented 3 years ago

Have you tried using something like MQTT Explorer? If you don't have any errors in the logs for Frigate, I don't know why this one mqtt topic would be failing.

Pascal66 commented 3 years ago

Yes mqtt explorer is working well

blakeblackshear commented 3 years ago

Then Frigate is firing mqtt events fine. Do you see error messages in Home Assistant's log? Have you added the mqtt integration for Home Assistant? Not sure why Home Assistant wouldn't get the messages unless it isn't connected.

Pascal66 commented 3 years ago

No errors, I've mosquitto broker in hass , wich work fine, i'm searching for a simpler automation, I've tested with 'core-mosquitto' or '192.168.1.xx', same result (as no result) I've nodered in hass wich is working well with mqtt

Pascal66 commented 3 years ago

Modified things, and now I've an error ! 👍 (that's better...

2021-11-11 15:57:34 ERROR (MainThread) [homeassistant.components.automation.frigate_frontdoor_notification] Error while executing automation automation.frigate_frontdoor_notification: Unable to find service notify.telegram_bot
2021-11-11 15:57:43 ERROR (MainThread) [homeassistant.components.automation.frigate_frontdoor_notification] Frigate: frontdoor notification: Error executing script. Service not found for call_service at pos 1: Unable to find service notify.telegram_bot
Pascal66 commented 3 years ago

Thank you for your help