Hello, I've written an idle event handler that controls ignition changes (cachemanager lastposition), motion changes, and speed changes, and stores the vehicle's idle time in the position attribute based on these changes. I've configured the idle time so that it can be configured in the keys(config) file. If the vehicle's speed drops to 0 while the ignition is on, if the motion status changes from true to false, or if the vehicle's ignition is switched from off to on after a long period of inactivity and doesn't move at all, we record these datetime in the position attributes. We also store the idle alarm status value in the position attributes. If an alarm is triggered during the idle time, we prevent unnecessary re-triggering of the alarm during the idle time. The event are based on the system time, so the protocol can be used on all independent devices. I'm running a few more tests. If there's interest, I'll submit a pull request to the main repo in a few days. A new feature would be nice if it's approved.
Files I've modified
I've created a new event handler file and added it to Processingevent handler.java
Added new idle time in keys file.
Best regards.
Feel free to send a PR and we'll take a look.
Hello Anton again. Should we trigger alarm_parking for this event, or would it be better to create a new alarm key (like ALARM_IDLE)?
What is alarm_parking?
Which alarm triggering combination would be more suitable for our new idleeventhandler.java design? I wanted to ask your opinion before submitting a PR.
Which would be more suitable: ALARM_PARKING or ALARM_IDLE ?
"src/main/java/org/traccar/model/Position.java"
ALARM keys
How is parking related to idling? I'm not sure I understand the question. What are you implementing exactly? I thought it's idling.
Of course, we calculate idle time. We've read some discussion about user parking times in past forum threads. We base this on ALARM_IDLE.
Can we just do it through calculated attribute? Just retrieve the Idling time from position attribute (as a Boolean condition) and trigger the event that we want?
There's no idling attribute, right? Idling is just having ignition without moving for some min period of time.
What I suggested is to have an Idling time attribute, like a timer and we catch it in calculated attribute to put our own minimum,
Like: if idlingTime > 600 this will rise a true Boolean
That can also work.
The event handler code I'm currently writing stores the vehicle's idle transition time as a timestamp in the position.attributes file. If the time is exceeded at the next position, it triggers the appropriate alarm. The idle time can be set in the configuration file, but in this case, it applies to all vehicles. It's working fine for now.
However, your suggested approach of "Like: idlingTime > 600, this will increase to a true Boolean value" would be a better approach. I'll try to make the idle time adjustable for each vehicle. The reason I'm writing this post is to combine our ideas to create a better feature.
I'm trying to pay attention to several things while developing this. It's crucial to avoid memory and thread leaks, and I'm also trying to make the code changes as minimal as possible.
I'll keep you updated on any developments.
There's no plan to do that at this point.