blakeblackshear / frigate-hass-integration

Frigate integration for Home Assistant
MIT License
732 stars 113 forks source link

<unknown>:1: SyntaxWarning: invalid decimal literal #718

Open clowncracker opened 1 month ago

clowncracker commented 1 month ago

Version of the custom_component

Frigate: 0.14.1-f4f3cfa HA Addon: 5.4.0

Configuration

  host: xxx
  user: xxx
  password: xxx

go2rtc:
  streams:
    front_door:
      - ffmpeg:http://xxx.xxx.x.xxx/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=xxx&password=xxx#video=copy#audio=copy#audio=opus
      #- rtsp://reolink_ip/Preview_01_sub
    garage:
      - ffmpeg:http://192.168.1.238/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=xxx&password=xxx#video=copy#audio=copy#audio=opus
    office:
      - ffmpeg:http://192.168.1.251/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=xxx&password=xxx#video=copy#audio=copy#audio=opus

detectors:
  coral:
    type: edgetpu
    device: usb

cameras:
  front_door:
    mqtt:
      timestamp: false
      bounding_box: false
      crop: true
      quality: 100
      height: 500
      required_zones:
        - entryway
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/front_door?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      width: 2560
      height: 1920
      fps: 5
    record:
      enabled: true
      retain:
        days: 14
        mode: all
    objects:
      track:
        - person
        - car
      filters:
        person:
          mask:
            - 438,916,469,598,556,260,656,0,922,0,1051,286,1028,669,1021,976,1023,1077,997,1111,924,1108,823,1103,611,1091,439,1082
            - 2265,1541,2332,927,2244,462,2560,388,2560,895,2560,1675
            - 1151,1070,1171,1115,1271,1115,1480,1110,1768,1106,2115,1081,2301,1054,2299,872,2277,689,2236,522,2134,528,1897,471,1516,423,1156,426
        car:
          mask:
            - 438,916,469,598,556,260,656,0,922,0,1051,286,1028,669,1021,976,1023,1077,997,1111,924,1108,823,1103,611,1091,439,1082
            - 1151,1070,1171,1115,1271,1115,1480,1110,1768,1106,2115,1081,2301,1054,2299,872,2277,689,2236,522,2134,528,1897,471,1516,423,1156,426
    snapshots:
      enabled: true
    zones:
      entryway:
        coordinates: 
          2560,1920,2560,1681,2173,1506,1928,1579,1593,1321,930,1404,475,1307,321,1319,0,1319,0,1920
    review:
      alerts:
        required_zones:
          - entryway
  garage:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/garage?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - detect
            - record
    detect:
      enabled: true
      width: 2560
      height: 1920
      fps: 5
    record:
      enabled: true
      retain:
        days: 14
        mode: all
    objects:
      track:
        - person
      filters:
        person:
          mask:
            - 0,0,2560,0,2560,353,963,383,486,431,0,529
            - 216,1920,906,1920,627,978,268,1022,165,1617,160,1767
            - 127,1575,246,1354,193,1162,0,1340,0,1577
    snapshots:
      enabled: true
  office:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://127.0.0.1:8554/office?video=copy&audio=aac
          input_args: preset-rtsp-restream
          roles:
            - audio
            - detect
            - record
    audio:
      enabled: true
    detect:
      enabled: true
      width: 2560
      height: 1920
      fps: 5
    record:
      enabled: true
      retain:
        days: 14
        mode: all
      events:
        objects: []
    objects:
      track:
        - person
      filters:
        person:
          mask:
            - 465,237,173,300,292,945,549,908
    snapshots:
      enabled: false
    review:
      alerts:
        labels:
          - speech
      detections:
        labels:
          - car

version: 0.14
camera_groups:
  All_Cameras:
    order: 1
    icon: LuAperture
    cameras:
      - front_door
      - garage
      - office

Describe the bug

Randomly throughout the day, I get the following errors in my logs:

Logger: py.warnings
Source: components/mqtt/models.py:192
First occurred: 9:43:06 AM (2 occurrences)
Last logged: 9:43:06 AM

<unknown>:1: SyntaxWarning: invalid decimal literal
Logger: py.warnings
Source: helpers/template.py:333
First occurred: 9:43:06 AM (3 occurrences)
Last logged: 9:43:06 AM

<unknown>:1: SyntaxWarning: invalid decimal literal

These always coincide with Frigate triggers in MQTT, but they don't happen every time Frigate registers an event. This is with my front door camera, where plenty of people walk/drive by throughout the day. I've included a specific example in my debug logs below. I'm hoping to figure out the source of these problems and to avoid them showing up in my Home Assistant logs.

Debug log

2024-08-30 09:08:20.955 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on frigate/events (qos=0): b'{"before": {"id": "1725034100.514825-0isech", "camera": "front_door", "frame_time": 1725034100.514825, "snapshot": null, "label": "car", "sub_label": null, "top_score": 0.0, "false_positive": true, "start_time": 1725034100.514825, "end_time": null, "score": 0.84375, "box": [600, 994, 922, 1112], "area": 37996, "ratio": 2.7288135593220337, "region": [432, 758, 1084, 1410], "stationary": false, "motionless_count": 0, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false, "attributes": {}, "current_attributes": []}, "after": {"id": "1725034100.514825-0isech", "camera": "front_door", "frame_time": 1725034100.710479, "snapshot": {"frame_time": 1725034100.710479, "box": [472, 994, 762, 1105], "area": 32190, "region": [268, 729, 960, 1421], "score": 0.75390625, "attributes": []}, "label": "car", "sub_label": null, "top_score": 0.76171875, "false_positive": false, "start_time": 1725034100.514825, "end_time": null, "score": 0.75390625, "box": [472, 994, 762, 1105], "area": 32190, "ratio": 2.6126126126126126, "region": [268, 729, 960, 1421], "stationary": false, "motionless_count": 1, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false, "attributes": {}, "current_attributes": []}, "type": "new"}'
2024-08-30 09:08:20.955 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"before": {"id": "1725034100.514825-0isech", "camera": "front_door", "frame_time": 1725034100.514825, "snapshot": null, "label": "car", "sub_label": null, "top_score": 0.0, "false_positive": true, "start_time": 1725034100.514825, "end_time": null, "score": 0.84375, "box": [600, 994, 922, 1112], "area": 37996, "ratio": 2.7288135593220337, "region": [432, 758, 1084, 1410], "stationary": false, "motionless_count": 0, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false, "attributes": {}, "current_attributes": []}, "after": {"id": "1725034100.514825-0isech", "camera": "front_door", "frame_time": 1725034100.710479, "snapshot": {"frame_time": 1725034100.710479, "box": [472, 994, 762, 1105], "area": 32190, "region": [268, 729, 960, 1421], "score": 0.75390625, "attributes": []}, "label": "car", "sub_label": null, "top_score": 0.76171875, "false_positive": false, "start_time": 1725034100.514825, "end_time": null, "score": 0.75390625, "box": [472, 994, 762, 1105], "area": 32190, "ratio": 2.6126126126126126, "region": [268, 729, 960, 1421], "stationary": false, "motionless_count": 1, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false, "attributes": {}, "current_attributes": []}, "type": "new"}' with variables {} with default value 'default' and Template<template=({{ value_json['after']['camera'] | lower | replace('-','_') }}/{{ value_json['type']}}) renders=114>
2024-08-30 09:08:20.955 DEBUG (MainThread) [homeassistant.components.automation.front_door_alert_blueprint] Automation trigger 'None' triggered by mqtt topic frigate/events
2024-08-30 09:08:20.956 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Front Door: Alert w/ Blueprint, entity_id=automation.front_door_alert_blueprint, source=mqtt topic frigate/events>
2024-08-30 09:08:20.956 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.front_door_alert_blueprint, old_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:19.395000-07:00, mode=parallel, current=0, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>, new_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=1, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>>
2024-08-30 09:08:20.956 INFO (MainThread) [homeassistant.components.automation.front_door_alert_blueprint] Front Door: Alert w/ Blueprint: Running automation actions
2024-08-30 09:08:20.958 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=automation.front_door_alert_blueprint, old_last_reported=2024-08-30T09:08:20.956436-07:00, new_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=1, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>>
2024-08-30 09:08:20.958 INFO (MainThread) [homeassistant.components.automation.front_door_alert_blueprint] Front Door: Alert w/ Blueprint: Choose at step 1: Frigate Event: Running automation actions
2024-08-30 09:08:20.958 INFO (MainThread) [homeassistant.components.automation.front_door_alert_blueprint] Front Door: Alert w/ Blueprint: Choose at step 1: Frigate Event: Executing step setting variables
2024-08-30 09:08:20.959 WARNING (MainThread) [py.warnings] <unknown>:1: SyntaxWarning: invalid decimal literal

2024-08-30 09:08:20.960 WARNING (MainThread) [py.warnings] <unknown>:1: SyntaxWarning: invalid decimal literal

2024-08-30 09:08:20.962 WARNING (MainThread) [py.warnings] <unknown>:1: SyntaxWarning: invalid decimal literal

2024-08-30 09:08:20.962 INFO (MainThread) [homeassistant.components.automation.front_door_alert_blueprint] Front Door: Alert w/ Blueprint: Choose at step 1: Frigate Event: Test condition Notifications enabled for object label: False
2024-08-30 09:08:20.963 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.front_door_alert_blueprint, old_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=1, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>, new_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=0, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>>
2024-08-30 09:08:20.963 DEBUG (MainThread) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'frigate/front_door/car', ...  (1 bytes)
2024-08-30 09:08:20.963 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on frigate/front_door/car (qos=0): b'3'
2024-08-30 09:08:20.963 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.front_door_car_count, old_state=<state sensor.front_door_car_count=2; unit_of_measurement=objects, icon=mdi:car, friendly_name=Front Door car count @ 2024-08-30T09:08:19.396575-07:00>, new_state=<state sensor.front_door_car_count=3; unit_of_measurement=objects, icon=mdi:car, friendly_name=Front Door car count @ 2024-08-30T09:08:20.963328-07:00>>
2024-08-30 09:08:20.963 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=binary_sensor.front_door_car_occupancy, old_last_reported=2024-08-30T09:08:19.517029-07:00, new_state=<state binary_sensor.front_door_car_occupancy=on; device_class=occupancy, icon=mdi:car, friendly_name=Front Door car occupancy @ 2024-08-30T09:08:18.966296-07:00>>
2024-08-30 09:08:20.963 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: <Event automation_triggered[L]: name=Front Door: Alert w/ Blueprint, entity_id=automation.front_door_alert_blueprint, source=mqtt topic frigate/events>
2024-08-30 09:08:20.963 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: <Event state_changed[L]: entity_id=automation.front_door_alert_blueprint, old_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:19.395000-07:00, mode=parallel, current=0, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>, new_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=1, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>>
2024-08-30 09:08:20.964 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: <Event state_changed[L]: entity_id=automation.front_door_alert_blueprint, old_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=1, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>, new_state=<state automation.front_door_alert_blueprint=on; id=1724731961250, last_triggered=2024-08-30T09:08:20.956409-07:00, mode=parallel, current=0, max=10, friendly_name=Front Door: Alert w/ Blueprint @ 2024-08-30T08:35:20.211890-07:00>>
2024-08-30 09:08:20.964 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: <Event state_changed[L]: entity_id=sensor.front_door_car_count, old_state=<state sensor.front_door_car_count=2; unit_of_measurement=objects, icon=mdi:car, friendly_name=Front Door car count @ 2024-08-30T09:08:19.396575-07:00>, new_state=<state sensor.front_door_car_count=3; unit_of_measurement=objects, icon=mdi:car, friendly_name=Front Door car count @ 2024-08-30T09:08:20.963328-07:00>>
2024-08-30 09:08:20.964 DEBUG (MainThread) [paho.mqtt.client] Received PUBLISH (d0, q0, r0, m0), 'frigate/front_door/all', ...  (1 bytes)
2024-08-30 09:08:20.964 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on frigate/front_door/all (qos=0): b'3'
2024-08-30 09:08:20.964 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.front_door_all_count, old_state=<state sensor.front_door_all_count=2; unit_of_measurement=objects, icon=mdi:shield-alert, friendly_name=Front Door all count @ 2024-08-30T09:08:19.399614-07:00>, new_state=<state sensor.front_door_all_count=3; unit_of_measurement=objects, icon=mdi:shield-alert, friendly_name=Front Door all count @ 2024-08-30T09:08:20.964439-07:00>>
2024-08-30 09:08:20.964 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_reported[L]: entity_id=binary_sensor.front_door_all_occupancy, old_last_reported=2024-08-30T09:08:19.517451-07:00, new_state=<state binary_sensor.front_door_all_occupancy=on; device_class=occupancy, icon=mdi:home, friendly_name=Front Door all occupancy @ 2024-08-30T09:08:18.967604-07:00>>
2024-08-30 09:08:20.965 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: <Event state_changed[L]: entity_id=sensor.front_door_all_count, old_state=<state sensor.front_door_all_count=2; unit_of_measurement=objects, icon=mdi:shield-alert, friendly_name=Front Door all count @ 2024-08-30T09:08:19.399614-07:00>, new_state=<state sensor.front_door_all_count=3; unit_of_measurement=objects, icon=mdi:shield-alert, friendly_name=Front Door all count @ 2024-08-30T09:08:20.964439-07:00>>
github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

clowncracker commented 2 weeks ago

I'm still having this issue. @blakeblackshear

blakeblackshear commented 2 weeks ago

I don't see anything in the debug logs that indicates Frigate sends an invalid decimal value. I believe this is likely something in the blueprint or automation code in Home Assistant.