Skip to content

Commit c181a2f

Browse files
committed
clean up
1 parent 0640659 commit c181a2f

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

app/services/own_tracks/family_locations_formatter.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def build_owntracks_location(point)
4141
alt: point.altitude,
4242
batt: point.battery,
4343
bs: OwnTracks::Params.battery_status_to_numeric(point.battery_status),
44-
# t: OwnTracks::Params.trigger_to_string(point.trigger),
4544
vel: OwnTracks::Params.velocity_to_kmh(point.velocity),
4645
conn: OwnTracks::Params.connection_to_string(point.connection),
4746
}

app/services/own_tracks/params.rb

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ def battery_status_to_numeric(battery_status)
103103
end
104104
end
105105

106-
def trigger_to_string(trigger)
107-
case trigger
108-
when 'background_event' then 'p'
109-
when 'circular_region_event' then 'c'
110-
when 'beacon_event' then 'b'
111-
when 'report_location_message_event' then 'r'
112-
when 'manual_event' then 'u'
113-
when 'timer_based_event' then 't'
114-
when 'settings_monitoring_event' then 'v'
115-
else nil
116-
end
117-
end
118-
119106
def connection_to_string(connection)
120107
case connection
121108
when 'mobile' then 'm'
@@ -132,14 +119,8 @@ def velocity_to_kmh(velocity)
132119
velocity_float = velocity.to_f
133120
return nil if velocity_float.zero?
134121

135-
# Velocity should be in km/h for Owntracks format (integer)
136-
# If stored as m/s (typically < 50), convert to km/h
137-
# Otherwise assume it's already in km/h
138-
if velocity_float < 50
139-
(velocity_float * 3.6).round.to_i
140-
else
141-
velocity_float.round.to_i
142-
end
122+
# Reference: https://owntracks.org/booklet/tech/json/
123+
(velocity_float * 3.6).round.to_i
143124
end
144125
end
145126
end

0 commit comments

Comments
 (0)