mrmay-dev / owntags

Ⓣ OwnTags is an OwnTracks client for tracking your own 'AirTags' 🏷 made with OpenHaystack.
11 stars 5 forks source link

prefix in the settings.toml #6

Open 23tom2323 opened 1 year ago

23tom2323 commented 1 year ago

I don't yet understand what the prefix information in the settings.toml should look like.

owntags/
└── application/
    └── keys/
        ├── prefix-1.keyfile     # Car1
        ├── prefix-2.keyfile     # Car2
    ├── prefix-2.keyfile     # Unicorn
    └── prefix-2.keyfile     # Dragon

@settings.toml

[tag_options.prefix prefix-1]
[tag_options.prefix prefix-2]
[tag_options.prefix prefix-3]
[tag_options.prefix prefix-4]

tag_name = "prefix-1" # Car1
tag_name = "prefix-2" # Car2
tag_name = "prefix-3" # Unicorn
tag_name = "prefix-4" # Dragon

or should it look like this?

owntags/
└── application/
    └── keys/
        ├── car1.keyfile     
        ├── car2.keyfile     
    ├── unicorn.keyfile  
    └── dragon.keyfile  

@settings.toml

[tag_options.prefix]
tag_name = "car1"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.prefix]
tag_name = "car2"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.prefix]
tag_name = "unicorn"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.prefix]
tag_name = "dragon"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  
Systm21 commented 1 year ago

Do you already have prefix files with stored keys? Maybe its a little bit clearer for you, when you have data that you can work with.

Simplified it should something like this (can test it in the afternoon):


[tag_options.car1]
tag_name = "car1"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.car2]
tag_name = "car2"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.unicorn]
tag_name = "unicorn"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.dragon]
tag_name = "dragon"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

@mrmay-dev Can i rename the prefixes in the Keyfile? Does it also work?

MUST be tag_options.dragon and tag_name = dragon Identically? ...or can i rename it with tag_name?

mrmay-dev commented 1 year ago

@Systm21 , you are right that the prefix name ([tag_options.dragon]) MUST match the (tag_name = "dragon"). I think it's redundant and want to work the code so it pulls the prefix from the toml block header.

Yes, changing the prefixes on the keyfile works so long as the name is changed in the settings.toml. I named mine for Minecraft items. LOL

Also, check out the timestamps. Each key must be unique.

My keyfiles are:

and the corresponding TOML blocks read:

[tag_options.alex]
tag_name = "alex"  
location = true 
waypoint = false  
timestamp = 1000000001  
radius = false  

[tag_options.steve]
tag_name = "steve"  
location = true 
waypoint = false  
timestamp = 1000000002 
radius = false 

[tag_options.sheep]
tag_name = "sheep"  
location = true 
waypoint = false  
timestamp = 1000000003 
radius = false 

That's what OwnTracks uses to track waypoints. If the timestamps are the same, OwnTracks thinks it's the same waypoint.

Systm21 commented 1 year ago

Ok, got it. but the timestamps can be anything as long as its unique, just like fakestamps 😁 ?

mrmay-dev commented 1 year ago

LOL Love it. Fakestamps!

Yup, any sting of numbers that represent a Unix/Posix date. Honestly, haven't tried future dates... that would be interesting. 😁

23tom2323 commented 1 year ago

Short update. Soon everything will be running. I call up, it goes to the mqtt and the broker gets the data. So far so good.

I noticed in the broker in the objects of the individual ESPs that data is mixed up. For example, data from Unicom is entered into Car. Also changing the TID, what Systm21 has already mentioned, would be really nice.

But today we're going in Holiday for two weeks. 1000 km there and 1000 km back, so I take a few own tags with me. ;-).

Thank you for your support, I'll be back soon.

Bildschirm­foto 2023-09-15 um 08 07 45
mrmay-dev commented 1 year ago

Cool! Hope it gos well. What app is that screenshot from? Looks interesting.

Tell me about that battery level line that's highlighted. Is it OwnTracks? Been wishing I knew enough to add that into the payload that is sent with the keys.

Systm21 commented 1 year ago

What app is that screenshot from? Looks interesting.

It's a smarthomeserver called iobroker, simillar to Home Assistant.

Tell me about that battery level line that's highlighted. Is it OwnTracks? Been wishing I knew enough to add that into the payload that is sent with the keys.

Would you like a full json string to sort out, what you need?

{"_type":"location","BSSID":"be:ef:fe:ed:6f:9a","SSID":"SomeWifi","acc":15,"alt":363,"batt":62,"bs":2,"conn":"w","created_at":1694554648,"lat":49.5132895,"lon":9.4512478,"m":-1,"t":"u","tid":"ab","tst":1694553859,"vac":1,"vel":0}