tinderfridge 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tinderfridge/device.rb +1 -0
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json +1 -1
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb +1 -1
- data/lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.json +7 -0
- data/lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.rb +58 -0
- data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.rb +7 -0
- data/lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.rb +14 -0
- data/lib/tinderfridge/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11aec071db2201e67dee0935c5a37ba2f801d2337cf0dc938ea465a9c0435bd3
|
4
|
+
data.tar.gz: ad2faa18ff3320c9320ded930b47f54c38e9471eba0bb52e2aa23cb48da3d108
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 440adf1b54a1787963688f4392fe686e07b898eae1361d3f245526a244f6e677b5a29a7cd84f2f3aa0221ef4300372dcbae18b55200cef2b96d6fa7206a0c7d0
|
7
|
+
data.tar.gz: 8204e15a1106392bbde997f2e65704b2cfd176c4e18066685f26e8a50a6cd62e3002b10e8fd6224f16540d946c94c66f66e96f6941b90c7255beec4e4c545a60
|
data/lib/tinderfridge/device.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletGPSV3
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'fix_led_config' => get_fix_led_config,
|
9
|
+
'fix' => fix?,
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns true if a fix is available.
|
14
|
+
def fix?
|
15
|
+
get_status[0]
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns latitude and longitude as reported by the GPS Bricklet.
|
19
|
+
#
|
20
|
+
# Nil when there is no fix (position not determined).
|
21
|
+
def coordinates
|
22
|
+
if fix?
|
23
|
+
c = get_coordinates
|
24
|
+
[
|
25
|
+
c[0] / (c[1] == 'N' ? 1000000.0 : -1000000.0),
|
26
|
+
c[2] / (c[3] == 'E' ? 1000000.0 : -1000000.0)
|
27
|
+
]
|
28
|
+
else
|
29
|
+
nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns a Time object representing the time as reported by the GPS Bricklet.
|
34
|
+
def time
|
35
|
+
# FIXME: This will not work after 31-Dec-2099.
|
36
|
+
dt = get_date_time.map &:to_s
|
37
|
+
dt = dt[0].rjust(6,'0').unpack('a2a2a2').reverse + dt[1].rjust(9,'0').concat('000').unpack('a2a2a2a6')
|
38
|
+
dt[0].prepend '20'
|
39
|
+
Time.gm *dt.map(&:to_i)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns a URL for viewing the current coordinates on OpenStreetMap.
|
43
|
+
def openstreetmap_marker_url(zoom=12)
|
44
|
+
if c = coordinates
|
45
|
+
"https://www.openstreetmap.org/?mlat=%f&mlon=%f&zoom=%d" % [c, zoom].flatten
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def _view_21x8
|
52
|
+
"GPSv3 #{uid_string.rjust 8}\n\n" +
|
53
|
+
((c = coordinates) ? (" Lat %10.5f\n Lon %10.5f" % c) : ' no fix')
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -2,6 +2,13 @@ module Tinkerforge
|
|
2
2
|
|
3
3
|
class BrickletOutdoorWeather
|
4
4
|
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'sensor_data' => sensors,
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
5
12
|
# Returns the last measured data for all sensors.
|
6
13
|
#
|
7
14
|
# The result is a Hash, with sensor identifiers as the keys. Values per sensor are:
|
data/lib/tinderfridge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinderfridge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lllist.eu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tinkerforge
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json
|
78
78
|
- lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.rb
|
79
79
|
- lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.json
|
80
|
+
- lib/tinderfridge/devices/bricklet_gps_v3/bricklet_gps_v3.rb
|
80
81
|
- lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json
|
81
82
|
- lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.rb
|
82
83
|
- lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- lib/tinderfridge/devices/bricklet_particulate_matter/bricklet_particulate_matter.json
|
122
123
|
- lib/tinderfridge/devices/bricklet_performance_dc/bricklet_performance_dc.json
|
123
124
|
- lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.json
|
125
|
+
- lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.rb
|
124
126
|
- lib/tinderfridge/devices/bricklet_ptc_v2/bricklet_ptc_v2.json
|
125
127
|
- lib/tinderfridge/devices/bricklet_real_time_clock_v2/bricklet_real_time_clock_v2.json
|
126
128
|
- lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.json
|