tinderfridge 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a1a23e33e307a89386dbf4d61f3a9852e000e3382ec3c61de5b1c45c0335f11
4
- data.tar.gz: 4261d085ad57d3205da9b27fcd38d74bd3bb47e482f0fbcfb391918e4abac268
3
+ metadata.gz: e18a7294bb3132350b0d3f1062527eaff38f2b9a90a5bc1057ffd59da58d6389
4
+ data.tar.gz: cc269b3ff4508d928ccd00af98fa0574d21ab27f970a113d04f39a4ba65ed516
5
5
  SHA512:
6
- metadata.gz: 12677e84815ddad014bf40df64798fbb05c46be764106143e16d2964a73d71a402bfb9d66bbc6f1422ec83766628ec0f6e2ddf9817fb64e38988523f9b4c3479
7
- data.tar.gz: '0749d1e2bf1b022313bbe807c08836df740d223d1b5d81efd5bb388693c84c707d436e5dc35f9fe827518dcf6ce97db70e9f8c948a5d3b0e64f75b4780f722f5'
6
+ metadata.gz: e235a1c592b8323a591469684c3a21526e5dda8a61eb539bcaf493dff7094e20e87b67168b90032b610925fdfbc724ac44b649d0c5a531510e275a2b48e288b9
7
+ data.tar.gz: abedb8f8ed9b7be27bbb263f3225cb0097b0a2e711e4d71122fda6210f20010cece9b1e034ec715bddc5a0778f34d364b1dcfaf7742cd9abd3c6d18f7236f48a
@@ -54,6 +54,15 @@ module Tinkerforge
54
54
  # Instance Methods #
55
55
  #----------------------------------------------------------------------#
56
56
 
57
+ # Returns the device's UID. Not to be confused with #uid, which returns the numeric UID.
58
+ attr_reader :uid_string
59
+
60
+ # Returns the device's numeric Device Identifier.
61
+ attr_reader :device_identifier
62
+
63
+ # Returns the device's Display Name.
64
+ attr_reader :device_display_name
65
+
57
66
  # Returns the device's IPConnection object.
58
67
  attr_reader :ipcon
59
68
 
@@ -62,6 +71,27 @@ module Tinkerforge
62
71
  "%s (%s@%s:%s)" % [self.class, @uid_string, ipcon.host, ipcon.port]
63
72
  end
64
73
 
74
+ # Returns the device's state.
75
+ def state
76
+ identity = get_identity
77
+
78
+ [
79
+ [ 'uid' , uid_string ],
80
+ [ 'update_time' , Time.now.gmtime ],
81
+ [ 'device_identifier' , device_identifier ],
82
+ [ 'device_display_name', device_display_name ],
83
+ [ 'firmware_version' , identity[4].join('.') ],
84
+
85
+ [ 'connected', { 'uid' => identity[1], 'position' => identity[2] } ],
86
+ [ 'ipcon' , { 'host' => ipcon.host , 'port' => ipcon.port } ],
87
+
88
+ respond_to?('get_chip_temperature' ) ? [ 'chip_temperature' , get_chip_temperature ] : nil,
89
+ respond_to?('get_spitfp_error_count') ? [ 'spitfp_error_count', get_spitfp_error_count ] : nil,
90
+ respond_to?('get_status_led_config' ) ? [ 'status_led_config' , get_status_led_config ] : nil,
91
+
92
+ ].compact.to_h
93
+ end
94
+
65
95
  # Identifies a Tinkerforge device by blinking its status led.
66
96
  #
67
97
  # Supports recent devices. When invoked on older devices, does nothing.
@@ -63,6 +63,23 @@ module Tinkerforge
63
63
  end.size
64
64
  end
65
65
 
66
+ # Returns the state of devices in the collection.
67
+ def state
68
+ smap 'state'
69
+ end
70
+
71
+ # Turns off light sources such as screens and RGB LEDs for devices in the collection.
72
+ #
73
+ # Ignores devices that do not support the blackout method.
74
+ def blackout
75
+ smap 'blackout'
76
+ end
77
+
78
+ # Returns a list of unique IP Connections used by devices in the collection.
79
+ def ipcons
80
+ smap('ipcon').values.compact.uniq
81
+ end
82
+
66
83
  private
67
84
 
68
85
  def smap(m)
@@ -135,5 +135,7 @@
135
135
  2147 CO2 Bricklet 2.0 Tinkerforge::BrickletCO2V2 bricklet_co2_v2
136
136
  2152 Energy Monitor Bricklet Tinkerforge::BrickletEnergyMonitor bricklet_energy_monitor
137
137
  2153 Compass Bricklet Tinkerforge::BrickletCompass bricklet_compass
138
+ 2156 Performance DC Bricklet Tinkerforge::BrickletPerformanceDC bricklet_performance_dc
139
+ 2157 Servo Bricklet 2.0 Tinkerforge::BrickletServoV2 bricklet_servo_v2
138
140
  2161 IMU Bricklet 3.0 Tinkerforge::BrickletIMUV3 bricklet_imu_v3
139
141
  2162 Industrial Dual AC Relay Bricklet Tinkerforge::BrickletIndustrialDualACRelay bricklet_industrial_dual_ac_relay
@@ -3,7 +3,7 @@ require 'tinkerforge/version'
3
3
  module Tinkerforge
4
4
 
5
5
  # Tinderfridge version.
6
- TINDERFRIDGE_VERSION = '0.2.0'
6
+ TINDERFRIDGE_VERSION = '0.3.0'
7
7
 
8
8
  # About Tinkerforge & Tinderfridge.
9
9
  def self.about
metadata CHANGED
@@ -1,27 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinderfridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tinkerforge
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.1'
20
+ - - ">="
18
21
  - !ruby/object:Gem::Version
19
22
  version: 2.1.27
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.1'
30
+ - - ">="
25
31
  - !ruby/object:Gem::Version
26
32
  version: 2.1.27
27
33
  description: