Using Event Number as Trigger for Ignition On and Off

vk3vcs7 years ago

Hello All,

I am Playing with Meitrack T336G and am tring to get Ignition sense to work via the accessory wire on the tracker.

I have played with Attributes and i am able to get it to work via the (Status) as this shows 0000 when no accessories in connected and shows 0200 when accessories is connected. However i would like to know if you can use (Event) as this shows Event 2 when accessory wire is connected and Event 10 when accessory wire is disconnected, but the issue i have that once it has the event 2 for example it will change back to another event number say Event 35 and make it come up with Ignition off. I need to make it stick and ignore all other events apart from 2 and 10.

Its a little hard to explain, but i have 2 types of meitrack devices that both report the events the same way but not the status.

Thanks

vk3vcs7 years ago

This may have been better under Server :-)

Anton Tananaev7 years ago

I believe you can use computed attributes and attributes copying to achieve what you want, if I'm understanding correctly.

chris murphy7 years ago

I'm also working on this.

I thought attributes copying would just fix it if the attribute disappeared between messages from the device.
What happens with our "event" attribute is

event "code"
35 ( tracking normally )
2 ( ignition started )
10 (ignition stopped )
etc

so it continuously sends 35... 35... 35... 35... 35... 35... 2 (started) 35... 35... 35... 35... 35... 35 .... 35 10 (stopped) 35 35.

It works if I make an Alarm that looks for event == "2"
But the ignition computed attribute defaults to off when it doesn't seen the 2 anymore.

Is there a way to make it remember the "2" and ignore all other numbers until it sees "10".

Thanks very much

Anton Tananaev7 years ago

Can you explain me again what you want to achieve. What is the problem with just checking event code 2 and 10 and copying ignition attribute. In your example, what do you want to get as a result?

chris murphy7 years ago

I have done that except when it goes from event code 2 to the normal 35 it thinks the ignition is off so I get an ignition on message but immediately get ignition off.

Sorry if I am explaining this poorly

Basically what I want to do is

event = "2" change ignition state to on and stay on & if event != "2" do nothing

Anton Tananaev7 years ago

What's the expression that you are using now?

chris murphy7 years ago

ignition
event ? event == 2 : true
boolean

Anton Tananaev7 years ago

You should probably have something like this:

event ? event == 2 ? true : null : null
chris murphy7 years ago

thanks very much! works perfect. can you tell me what language that is?

Anton Tananaev7 years ago

I would recommend reading documentation carefully:

https://www.traccar.org/documentation/computed-attributes/

Ernesto Vallejo7 years ago

I have a question about this same device

I want to try trips and stops reports using ignition values on (event code 2) and off (event code 10)

I must set in config file report.trip.useIgnition to true

My question is:

do I need to have all position records with ignition value or is it enough only with the one that states ignition turned on and then the one that states ignition turned off?

Thanks

Anton Tananaev7 years ago

As far as I remember, you need all positions to have ignition. You can attribute copying functionality if your device doesn't include ignition in every message.

Ernesto Vallejo7 years ago

Thanks Anton. One last question, What happens with older data that doesnt have ignition info when I try to run a trip report over them?

Anton Tananaev7 years ago

I believe that it falls back to using speed threshold.