Closed terrorforma closed 1 year ago
I believe home assistant already contains a last_changed attribute. A template sensor would probably work.
{{ as_timestamp(states.sensor.name_of_entity.last_changed) }}
Thanks for the reply. It seems that if the same numberplate is seen many hours later and there hasn't been another car or a misread between, home assistant does not update the "last_changed" attribute, as it hasn't actually changed (the sensor just keeps the last seen numberplate). This is the issue I have.
So an automation to say open a roller door with my car would be triggered when a car is in the drive way but if the number plate of the car has not been read before that, the door could open with the wrong car there (if my car was the last read), as it will just use what is already in the sensor. If I do use the last updated value to avoid that situation, the door may not open if no other cars have been in the driveway (which is most times), as the sensor has not updated since the first time it saw my car after another car (or mis read). I hope that makes sense! 😀
You're trying to get your garage door to open when your license plate is captured? Security concerns aside, you might have better luck triggering automations using the image or ROI sensors and checking the plate sensor as a condition. i.e. When a plate image or ROI changes, verify the plate sensor matches the plate you want.
I think you can get there with the sensors already provided, but you're likely going to have some additional problems to solve for. Not to mention the risk that all anyone needs to do is show an image of your license plate to your camera and your garage opens. ;)
Haha yes there are security concerns, though I'm not too concerned as the trigger would be frigate determining there is a car in the driveway, not just a person holding the licence plate up (though you are correct that they could replace their plate with mine and it would open). Plus there are enough cameras around that I'd know about it anyway. But definitely something I will consider. :D
On the question, currently the image and ROI are reported as camera entities, which are hard to determine when they update. Home assistant have added an image entity in 2023.7 https://www.home-assistant.io/integrations/image/ so that may be a better option and solve everything I'm attempting to do.
Yeah, I see what you mean. I was assuming the last_changed attribute would update when the image does; it doesn't.
I'll see about adding a timestamp & image to the MQTT Recorder.
I confirmed that the new MQTT image entity support does in fact update the last_changed property.
I added three new entities that should show up in home assistant:
You'll need to pull the updated docker container for sclaflin/plate-minder:latest.
Let me know how you get on!
Thanks @sclaflin I'll have a look.
Hey @sclaflin Ever since updating the docker container it doesn't seem to be recognising any plates. I noticed only because there was no mqtt sensors/images created in HA when they should and checking the log (file_recorder_plate_log_do_not_modify) there is no record of anything recognised. The docker logs (for both plate-minder and open-alpr-http-wrapper) don't show anything.The rtsp stream is operating normally.
Here is my config.yaml (passwords removed!)
sources:
- type: rtsp
name: FrontYard
url: rtsp://admin:<password>@192.168.0.65/cam/realmonitor?channel=1&subtype=0
preInputArgs:
- -rtsp_transport
- tcp
preOutputArgs: []
captureInterval: 1
alwaysRestart: false
openALPR:
url: http://192.168.0.22:3001/detect
country_code: au
recorders:
- type: mqtt
url: http://192.168.0.35:1883
baseTopic: plate-minder
hassDiscovery:
enable: true
discoveryPrefix: homeassistant
mqttOptions:
username: mqtt-user
password: <password>
- type: file
pattern: ./data/images/{{DATE}}/{{SOURCE}}/{{TIME}}_{{PLATE}}.jpeg
retainDays: 30
filters:
- type: mask
debug: true
shapes:
- 0,396,133,376,457,340,853,320,1219,324,1612,334,1920,371,1920,0,0,0
- 1920,245,1920,1080,944,1080,890,287
- type: motion
debug: false
restService:
enable: true
port: 2576
Is there any other troubleshooting I can do?
Thanks 😊
I fixed a bug with the unique id's Plate-Minder generates to work with Home Assistant Discovery. I'm guessing that the entities you're currently using are now defunct. There should be new entities available in Home Assistant to replace them.
Maybe search entities in home assistant with your camera name?
Hey @terrorforma,
I'm closing this issue since it's been a few weeks since I heard back from you. If you're still having trouble, let me know!
Hey there,
I'm trying to figure out an automation using the data from the plate sensor, but because the sensor only updates when there's a change to the numberplate, it's not particularly useful. Could another mqtt sensor (or the existing sensor) have a "Last detected" value added? Either that or the mqtt sensor times out after a period of time and either switches to "unknown" or gets removed.
Thanks