This commit is contained in:
Andrei Sokolov 2025-11-23 12:41:50 +01:00
parent 06406591d0
commit c181a2f9a2
2 changed files with 2 additions and 22 deletions

View file

@ -41,7 +41,6 @@ class OwnTracks::FamilyLocationsFormatter
alt: point.altitude,
batt: point.battery,
bs: OwnTracks::Params.battery_status_to_numeric(point.battery_status),
# t: OwnTracks::Params.trigger_to_string(point.trigger),
vel: OwnTracks::Params.velocity_to_kmh(point.velocity),
conn: OwnTracks::Params.connection_to_string(point.connection),
}

View file

@ -103,19 +103,6 @@ class OwnTracks::Params
end
end
def trigger_to_string(trigger)
case trigger
when 'background_event' then 'p'
when 'circular_region_event' then 'c'
when 'beacon_event' then 'b'
when 'report_location_message_event' then 'r'
when 'manual_event' then 'u'
when 'timer_based_event' then 't'
when 'settings_monitoring_event' then 'v'
else nil
end
end
def connection_to_string(connection)
case connection
when 'mobile' then 'm'
@ -132,14 +119,8 @@ class OwnTracks::Params
velocity_float = velocity.to_f
return nil if velocity_float.zero?
# Velocity should be in km/h for Owntracks format (integer)
# If stored as m/s (typically < 50), convert to km/h
# Otherwise assume it's already in km/h
if velocity_float < 50
(velocity_float * 3.6).round.to_i
else
velocity_float.round.to_i
end
# Reference: https://owntracks.org/booklet/tech/json/
(velocity_float * 3.6).round.to_i
end
end
end