Hourmeter calculation while using ignition digital input to measure something else

Leo4 years ago

Hello,

I am using a GPS device that measures and report the external battery voltage using the "power" attribute and this device has only one digital input that is reported to the server as the "ignition" attribute.

I need the hourmeter (engine hours) aggregation done by the traccar server but I would like to use the digital input to capture another signal ("doors" for example) and use the battery voltage to compute the "ignition" status.

I was thinking about using Computed Attributes to calculate them. Something like:

Doors
ignition ? ignition : null  
Boolean
Ignition
power ? power > 13.2 : null
Boolean

However my solution doesn't work because I cannot guarantee the first piece of code is executed before the second.

Is there any other viable solution to my problem?

Thanks,

Anton Tananaev4 years ago

Combine the expression.

Leo4 years ago

Sorry Anton, I didnĀ“t understand your response.

Are you suggesting I can make an attribute assignment inside the expression?

Because I need to make 2 calculations and assign each calculation to a different attribute.

I am not sure how I can combine 2 expressions into one and still make 2 attribute assignments.

Anton Tananaev4 years ago

Well, obviously you keep "Ignition" attribute as it is and just add ignition calculation to the "Door" attribute directly. I think it's a pretty obvious way to avoid dependency. Am I missing something?

Leo4 years ago

Hi Anton, thanks for your time.

If I understood your solution, the problem with it is that my hour meter (engine hours) will then tell me how long the doors were open (or closed).
I need the hour meter (engine hours) to tell me how long the engine was running (i.e. power > 13.2 volts) .

Anton Tananaev4 years ago

I see the problem. I guess there is no way to achieve what you are trying to do.

Leo4 years ago

Ok, so I believe the only solution would be to fork and adapt your EngineHoursHandler class :-)

I might try to do that...

Thanks for your time.