-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - reset detected plates after configured period #82
Comments
Honestly, this is something the whole "HA" world is missing...partially I can understand why (the majority of entities are exposed by integrations that should take care of it) but mostly, imho, it seems a de-facto choice in the HA world. Anyhow...the only way to mitigate this issue is to use an old script, which still works fortunately: https://github.com/xannor/hass_py_set_state (there is also a more recent version here but I'm unsure about it) Please note, despite what stated in the readme you can not install it trough HACS: you need to manually create the |
disclaimer: I was 20 years ago a coder, only a biz guy now. so bare with me. A much more elegant solution would be to have a method of resetting the watched_plates status, either manually (via an action we could fire, or via timer) """Vehicle detection using Plate Recognizer cloud service.""" from PIL import Image, ImageDraw, UnidentifiedImageError from homeassistant.components.image_processing import ( _LOGGER = logging.getLogger(name) PLATE_READER_URL = "https://api.platerecognizer.com/v1/plate-reader/" EVENT_VEHICLE_DETECTED = "platerecognizer.vehicle_detected" ATTR_PLATE = "plate" CONF_API_TOKEN = "api_token" DATETIME_FORMAT = "%Y-%m-%d_%H-%M-%S" PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def get_plates(results : List[Dict]) -> List[str]: def get_orientations(results : List[Dict]) -> List[str]: def setup_platform(hass, config, add_entities, discovery_info=None):
class PlateRecognizerEntity(ImageProcessingEntity):
|
You could also use the 'last_detection' attribute which is a timestamp. |
Interesting, thanks for the tip.
Awesome you actually answered the comment :-)
btw, I also did some mods. (i was fighting my ignorance around py and
hass). I changed the record of image to always save the image for debug
purposes. When someone approaches the gate the image fires the motion
event. Sometimes it takes the picture too soon or too late and the plate
gets blurry / unfocused. Also for the non recognized plates for due
diligence is also nice to see you tried to enter.
for sure you could do a much better code than I can do.
then again I just could run an automation based on the triggered event
right? maybe we can have different events, one for recognized plates but
other for recognized wacthed_plates. Actually I think I have a bug because
I turn on allowed plates in the block where you fire the event, but at that
point any plate that is extracted, watched or not , fires the event.
Anyway, kudos for the great work.
Always fun to get back coding a bit
*Gonçalo Caeiro - **Co-Founder and Chairman*
Mobile: +1 (857)-316-5953 ; +351 917828727 | E-mail:
***@***.***
www.infosistema.com*|* LinkedIn
<https://www.linkedin.com/company/infosistema> *|* Facebook
<https://www.facebook.com/aInfosistema> *|* Vimeo
<https://vimeo.com/infosistema>
*Please consider the environment before printing this e-mail.**The
information transmitted in this electronic mail message is intended for the
sole use of the person or entity to which it is addressed and may be
confidential or legally protected. Non-authorized use, copy, retransmission
or dissemination of the information contained in this message is strictly
forbidden.*
…On Thu, Feb 8, 2024 at 11:13 PM doenau ***@***.***> wrote:
You could also use the 'last_detection' attribute which is a timestamp.
Then you can use that timestamp in the automation to check that if
last_detection time is after the time the gate was last closed (ie: it is a
new detection), then go ahead and open the gate.
—
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVW4RQHVNHF2GBTGLPVG43YSVL2DAVCNFSM6AAAAAA26C66UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVGA3TQNJZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm just a user, not the integration owner :) anyway.. re: your comment about the automations... Plate-check automation:
Custom sensor for each plate:
Automation to fire when "085zyt" is detected:
|
ahahahha, even for kudos then.
but aren't you managing the platerecognizer source code ?
*Gonçalo Caeiro - **Co-Founder and Chairman*
Mobile: +1 (857)-316-5953 ; +351 917828727 | E-mail:
***@***.***
www.infosistema.com*|* LinkedIn
<https://www.linkedin.com/company/infosistema> *|* Facebook
<https://www.facebook.com/aInfosistema> *|* Vimeo
<https://vimeo.com/infosistema>
*Please consider the environment before printing this e-mail.**The
information transmitted in this electronic mail message is intended for the
sole use of the person or entity to which it is addressed and may be
confidential or legally protected. Non-authorized use, copy, retransmission
or dissemination of the information contained in this message is strictly
forbidden.*
…On Fri, Feb 9, 2024 at 12:55 AM doenau ***@***.***> wrote:
Interesting, thanks for the tip. Awesome you actually answered the comment
:-) btw, I also did some mods. (i was fighting my ignorance around py and
hass).....
I'm just a user, not the integration owner :)
anyway.. re: your comment about the automations...
I use my camera's cross-line detection as the trigger for the main
plate-check automation...
Then as individual separate automations, I detect whether the plate entity
changes to True.
Plate-check automation:
alias: Vehicle Arrived - Plate Check
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.driveway_cross_line_alarm
- binary_sensor.front_yard_cross_line_alarm
to: "on"
from: "off"
condition: []
action:
- service: notify.mobile_app_andy
data:
title: Vehicle Arrived
message: A car has pulled up the driveway
data:
image: /local/images/plates/platerecognizer_driveway_main_latest.png
url: /lovelace-test/driveway
enabled: false
- service: image_processing.scan
data: {}
target:
entity_id: image_processing.platerecognizer_driveway_main
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
mode: single
Custom sensor for each plate:
plate_085zyt:
friendly_name: "085zyt"
value_template: "{{ state_attr('image_processing.platerecognizer_driveway_main', 'watched_plates')['085zyt'] }}"`
Automation to fire when "085zyt" is detected:
`alias: Vehicle arrived - 085zyt
description: ""
trigger:
- platform: state
entity_id:
- sensor.plate_085zyt
to: "True"
from: "False"
condition: []
action:
- service: notify.mobile_app
data:
title: Vehicle arrived
message: XXXX is home
- service: notify.google_assistant_sdk
data:
target:
- Living room Display
- Bed 4 Display
- Main Bedroom Wifi
message: XXXX is home
- service: notify.lg_webos_tv_nano86tpa
data:
message: XXXX is home
mode: single
—
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAVW4RRATBU32SM62LK3EJDYSVXY5AVCNFSM6AAAAAA26C66UCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZVGE3DINRRG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I used the script to reset watched plates to 0 as well as the detected plates to "false". Except that when I trigger the plate reading, it displays the last plate read for 2 seconds before displaying the new one... do you have a yaml to share to test? |
At the moment, the detected vehicle count remains the same until the next API call, as do the 'watched plates' true/false states.
It would be helpful to have these (optional configuration) reset to 0 and 'false' again after a few minutes (perhaps optional configuration as part of the yaml config) so they are a better representation of the current state.
The text was updated successfully, but these errors were encountered: