humble_rpi-plugin-dhtsensor 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 004540a96dd99d1f6b6205c1c522e61e9c09a499
4
- data.tar.gz: 0000ef795a80d662c1ced88d9aa5e345354708e4
3
+ metadata.gz: 519cd5db8ea218d0a0bf695914fffd87044a0bec
4
+ data.tar.gz: 2053942ef02267580a1de02f57f7bfdf1109b18c
5
5
  SHA512:
6
- metadata.gz: c026fbb1cff1ecb8bdd506c74731e9691c61462df9ec71996a8965263436584a0e1a4ae5f048a6409723209644afe6de26c7a158b67bee18c7db72352f3c4b0c
7
- data.tar.gz: 02e7ecb98a68837d13d5873012fecf82a8abf66806ede803e152384c70442aa90f00019361753dadb5413e955b1d11eecb11ef4dc747b08920123c19bb892d72
6
+ metadata.gz: 856c1961e647dd32cc02d8b80c5a335cea517210bf2fc774c78efb9f6e678814ebb788122cd1350f2215ee955454e52c2ccd7eaae21d2b60dd77dd3c3f330700
7
+ data.tar.gz: c2e3ea86d40c1034d3f5f8eb93e162bc5f7859946b2f27588b1e24c35070d4fe1fccf8240ed1130edbbf5d23f5b4817e783fcb7c06b1ad497b173fc12dd163db
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- Zqx'ߌ+�dy}��q9N"t{�قQ ��i]��I3��Dz������ʁJ3���W��L��n��TG��@CV�������?5GiJ�|�jȫ4�C�JʒJ�ͱ��F�!���ˍ�X��K8t<�5Vư���� ���?t���?���3��N�0kJ�Y/�E2���ڱ�i6���`������#L+���T��!�~;G"Ӯ'ңH�6'�O���"���q����n�6�?�X���
1
+ V�\�ת���0fH�ʎ�u�W�lDy`��C�=��֛�Z���$�=�5��l�Kx,������K�͙���y%N@��:�g��zV�"��X(Ơ��1O �z<��=ɲ\�>�{E*�g�%�� S����2�3*�3�1V{��9�1�Z���-��}���7\���|�-N�E�����9r��8�H^io�
2
+ ��@����� "���,�5�h�m%� �or������yS�6��b}�"g��6<R
@@ -22,7 +22,8 @@ class HumbleRPiPluginDhtSensor
22
22
  temperature_threshold: 1,
23
23
  humidity_threshold: 2,
24
24
  interval: 3,
25
- msg_format: "%s/dht11_sensor: temperature: %s humidity: %s"
25
+ msg_format: "%s/dht11_sensor: temperature: %s humidity: %s",
26
+ pushrate: 60
26
27
  }.merge settings
27
28
 
28
29
  @version = h[:version]
@@ -30,6 +31,7 @@ class HumbleRPiPluginDhtSensor
30
31
  @humidity_threshold = h[:humidity_threshold]
31
32
  @interval = h[:interval]
32
33
  @msg_format = h[:msg_format]
34
+ @pushrate = h[:pushrate]
33
35
 
34
36
  @notifier = variables[:notifier]
35
37
  @device_id = variables[:device_id] || 'pi'
@@ -42,14 +44,17 @@ class HumbleRPiPluginDhtSensor
42
44
 
43
45
  val = DhtSensor.read(@pin, @version)
44
46
  push val
47
+ last_push = Time.now
45
48
 
46
49
  loop do
47
50
 
48
- val = DhtSensor.read(@pin, @version)
51
+ val = DhtSensor.read(@pin, @version)
49
52
 
50
- if (@old_tval - val.temperature).abs >= @temperature_threshold or \
51
- (@old_hval - val.humidity).abs >= @humidity_threshold then
53
+ if last_push + @pushrate < Time.now and \
54
+ ((@old_tval - val.temperature).abs >= @temperature_threshold or \
55
+ (@old_hval - val.humidity).abs >= @humidity_threshold) then
52
56
  push val
57
+ last_push = Time.now
53
58
  end
54
59
 
55
60
  sleep @interval
@@ -70,4 +75,4 @@ class HumbleRPiPluginDhtSensor
70
75
 
71
76
  end
72
77
 
73
- end
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humble_rpi-plugin-dhtsensor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file